📄 aga.java
字号:
/*
* YALE - Yet Another Learning Environment
* Copyright (C) 2001-2004
* Simon Fischer, Ralf Klinkenberg, Ingo Mierswa,
* Katharina Morik, Oliver Ritthoff
* Artificial Intelligence Unit
* Computer Science Department
* University of Dortmund
* 44221 Dortmund, Germany
* email: yale-team@lists.sourceforge.net
* web: http://yale.cs.uni-dortmund.de/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
package edu.udo.cs.yale.operator.features.ga;
import edu.udo.cs.yale.operator.parameter.*;
import edu.udo.cs.yale.operator.OperatorException;
import edu.udo.cs.yale.operator.IOObject;
import edu.udo.cs.yale.generator.*;
import edu.udo.cs.yale.operator.features.*;
import edu.udo.cs.yale.tools.LogService;
import java.util.List;
/**
* @author ingo
* @version $Id: AGA.java,v 2.8 2004/09/14 08:39:05 ingomierswa Exp $
*/
public class AGA extends GeneratingGeneticAlgorithm {
public IOObject[] apply() throws OperatorException {
if (getParameterAsBoolean("restrictive_selection"))
FeatureGenerator.setSelectionMode(FeatureGenerator.SELECTION_MODE_RESTRICTIVE);
else
FeatureGenerator.setSelectionMode(FeatureGenerator.SELECTION_MODE_ALL);
return super.apply();
}
public List getGenerators() {
List generators = super.getGenerators();
if (getParameterAsBoolean("use_square_roots")) { generators.add(new SquareRootGenerator()); }
if (getParameterAsBoolean("use_power_functions")) { generators.add(new PowerGenerator()); }
if (getParameterAsBoolean("use_sin"))
generators.add(new TrigonometricFunctionGenerator(TrigonometricFunctionGenerator.SINUS));
if (getParameterAsBoolean("use_cos"))
generators.add(new TrigonometricFunctionGenerator(TrigonometricFunctionGenerator.COSINUS));
if (getParameterAsBoolean("use_tan"))
generators.add(new TrigonometricFunctionGenerator(TrigonometricFunctionGenerator.TANGENS));
if (getParameterAsBoolean("use_atan"))
generators.add(new TrigonometricFunctionGenerator(TrigonometricFunctionGenerator.ARC_TANGENS));
if (getParameterAsBoolean("use_exp"))
generators.add(new ExponentialFunctionGenerator(ExponentialFunctionGenerator.EXP));
if (getParameterAsBoolean("use_log"))
generators.add(new ExponentialFunctionGenerator(ExponentialFunctionGenerator.LOG));
if (getParameterAsBoolean("use_absolute_values")) generators.add(new AbsoluteValueGenerator());
if (getParameterAsBoolean("use_min")) generators.add(new MinMaxGenerator(MinMaxGenerator.MIN));
if (getParameterAsBoolean("use_max")) generators.add(new MinMaxGenerator(MinMaxGenerator.MAX));
if (getParameterAsBoolean("use_floor_ceil_functions")) {
generators.add(new FloorCeilGenerator(FloorCeilGenerator.FLOOR));
generators.add(new FloorCeilGenerator(FloorCeilGenerator.CEIL));
generators.add(new FloorCeilGenerator(FloorCeilGenerator.ROUND));
}
return generators;
}
protected List getPreProcessingPopulationOperators() {
List popOps = super.getPreProcessingPopulationOperators();
if (getParameterAsBoolean("remove_useless")) popOps.add(new RemoveUselessAttributes());
if (getParameterAsBoolean("remove_equivalent"))
popOps.add(new EquivalentAttributeRemoval(getParameterAsInt("equivalency_samples"),
getParameterAsDouble("equivalency_epsilon")));
int maxPeaks = getParameterAsInt("search_fourier_peaks");
if (maxPeaks > 0)
popOps.add(new FourierGenerator(maxPeaks,
getParameterAsInt("adaption_type"),
getParameterAsInt("attributes_per_peak"),
getParameterAsDouble("epsilon")));
return popOps;
}
public List getParameterTypes() {
List types = super.getParameterTypes();
types.add(new ParameterTypeBoolean("use_square_roots", "Generate square root values.", false));
types.add(new ParameterTypeBoolean("use_power_functions", "Generate the power of one attribute and another.",
false));
types.add(new ParameterTypeBoolean("use_sin", "Generate sinus.", false));
types.add(new ParameterTypeBoolean("use_cos", "Generate cosinus.", false));
types.add(new ParameterTypeBoolean("use_tan", "Generate tangens.", false));
types.add(new ParameterTypeBoolean("use_atan", "Generate arc tangens.", false));
types.add(new ParameterTypeBoolean("use_exp", "Generate exponential functions.", false));
types.add(new ParameterTypeBoolean("use_log", "Generate logarithmic functions.", false));
types.add(new ParameterTypeBoolean("use_absolute_values", "Generate absolute values.", false));
types.add(new ParameterTypeBoolean("use_min", "Generate minimum values.", false));
types.add(new ParameterTypeBoolean("use_max", "Generate maximum values.", false));
types.add(new ParameterTypeBoolean("use_floor_ceil_functions", "Generate floor, ceil, and rounded values.",
false));
types.add(new ParameterTypeBoolean("restrictive_selection", "Use restrictive generator selection (faster).",
true));
types.add(new ParameterTypeBoolean("remove_useless", "Remove useless attributes.", true));
types.add(new ParameterTypeBoolean("remove_equivalent", "Remove equivalent attributes.", true));
types.add(new ParameterTypeInt("equivalency_samples", "Check this number of samples to prove equivalency.",
1, Integer.MAX_VALUE, 5));
types.add(new ParameterTypeDouble("equivalency_epsilon",
"Consider two attributes equivalent if their difference is not bigger than epsilon.",
0.0d, Double.POSITIVE_INFINITY, 0.05d));
types.add(new ParameterTypeInt("search_fourier_peaks",
"Use this number of highest frequency peaks for sinus generation.",
0, Integer.MAX_VALUE, 0));
types.add(new ParameterTypeInt("attributes_per_peak", "Use this number of additional peaks for each found peak.",
1, Integer.MAX_VALUE, 1));
types.add(new ParameterTypeDouble("epsilon", "Use this range for additional peaks for each found peak.",
0, Double.POSITIVE_INFINITY, 0.1));
types.add(new ParameterTypeCategory("adaption_type", "Use this adaption type for additional peaks.",
SinusFactory.ADAPTION_TYPES, SinusFactory.GAUSSIAN));
return types;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -