Hide several elements from the UI
This commit is contained in:
parent
29a1bb64e3
commit
89402e0b05
@ -275,7 +275,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
*
|
||||
* @param opt The optimization problem that is to be solved.
|
||||
*/
|
||||
public void init(InterfaceOptimizationProblem opt) {
|
||||
public void initialize(InterfaceOptimizationProblem opt) {
|
||||
initializationOperator.initialize(this, opt);
|
||||
this.mutationOperator.initialize(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
|
@ -105,9 +105,6 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* InterfaceDataTypeDouble methods
|
||||
*/
|
||||
/**
|
||||
* This method allows you to request a certain amount of double data
|
||||
*
|
||||
@ -235,17 +232,14 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
System.arraycopy(doubleData, 0, this.genotype, 0, doubleData.length);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* AbstractEAIndividual methods
|
||||
*/
|
||||
/**
|
||||
* This method will allow a default initialisation of the individual
|
||||
*
|
||||
* @param opt The optimization problem that is to be solved.
|
||||
*/
|
||||
@Override
|
||||
public void init(InterfaceOptimizationProblem opt) {
|
||||
super.init(opt);
|
||||
public void initialize(InterfaceOptimizationProblem opt) {
|
||||
super.initialize(opt);
|
||||
// evil operators may not respect the range, so at least give some hint
|
||||
if (!Mathematics.isInRange(genotype, range)) {
|
||||
EVAERROR.errorMsgOnce("Warning: Individual out of range after initialization (and potential initial crossover/mutation)!");
|
||||
@ -304,9 +298,6 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
return strB.toString();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* InterfaceESIndividual methods
|
||||
*/
|
||||
/**
|
||||
* This method will allow the user to read the ES 'genotype'
|
||||
*
|
||||
|
@ -76,9 +76,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
* @param opt The optimization problem that is to be solved.
|
||||
*/
|
||||
@Override
|
||||
public void init(InterfaceOptimizationProblem opt) {
|
||||
((AbstractEAIndividual) this.doubleIndividual).init(opt);
|
||||
((AbstractEAIndividual) this.binaryIndividual).init(opt);
|
||||
public void initialize(InterfaceOptimizationProblem opt) {
|
||||
((AbstractEAIndividual) this.doubleIndividual).initialize(opt);
|
||||
((AbstractEAIndividual) this.binaryIndividual).initialize(opt);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,8 +105,8 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
((AbstractEAIndividual) this.binaryIndividual).initByValue(((Object[]) obj)[0], opt);
|
||||
}
|
||||
} else {
|
||||
((AbstractEAIndividual) this.doubleIndividual).init(opt);
|
||||
((AbstractEAIndividual) this.binaryIndividual).init(opt);
|
||||
((AbstractEAIndividual) this.doubleIndividual).initialize(opt);
|
||||
((AbstractEAIndividual) this.binaryIndividual).initialize(opt);
|
||||
System.out.println("Initial value for GAESIndividualDoubleData is not suitable!");
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import eva2.optimization.operator.mutation.MutateGAUniform;
|
||||
import eva2.problems.InterfaceOptimizationProblem;
|
||||
import eva2.tools.math.RNG;
|
||||
import eva2.util.annotation.Description;
|
||||
import eva2.util.annotation.Parameter;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
@ -229,10 +230,6 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* AbstractEAIndividual methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method will initialize the individual with a given value for the
|
||||
* phenotype.
|
||||
@ -373,6 +370,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
*
|
||||
* @param coding The used genotype coding method
|
||||
*/
|
||||
@Parameter(name = "coding", description = "Choose the coding to use.")
|
||||
public void setGACoding(InterfaceGADoubleCoding coding) {
|
||||
this.doubleCoding = coding;
|
||||
}
|
||||
@ -381,16 +379,13 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
return this.doubleCoding;
|
||||
}
|
||||
|
||||
public String gADoubleCodingTipText() {
|
||||
return "Choose the coding to use.";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows you to set the number of mulitruns that are to be performed,
|
||||
* necessary for stochastic optimizers to ensure reliable results.
|
||||
*
|
||||
* @param precision The number of multiruns that are to be performed
|
||||
*/
|
||||
@Parameter(description = "Gives the number of bits to be used to code a double.")
|
||||
public void setPrecision(int precision) {
|
||||
this.precision = precision;
|
||||
}
|
||||
@ -398,8 +393,4 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
public int getPrecision() {
|
||||
return this.precision;
|
||||
}
|
||||
|
||||
public String precisionTipText() {
|
||||
return "Gives the number of bits to be used to code a double.";
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +72,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
|
||||
* @param opt The optimization problem that is to be solved.
|
||||
*/
|
||||
@Override
|
||||
public void init(InterfaceOptimizationProblem opt) {
|
||||
((AbstractEAIndividual) this.numberData).init(opt);
|
||||
((AbstractEAIndividual) this.programData).init(opt);
|
||||
public void initialize(InterfaceOptimizationProblem opt) {
|
||||
((AbstractEAIndividual) this.numberData).initialize(opt);
|
||||
((AbstractEAIndividual) this.programData).initialize(opt);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,8 +101,8 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
|
||||
((AbstractEAIndividual) this.programData).initByValue(((Object[]) obj)[0], opt);
|
||||
}
|
||||
} else {
|
||||
((AbstractEAIndividual) this.numberData).init(opt);
|
||||
((AbstractEAIndividual) this.programData).init(opt);
|
||||
((AbstractEAIndividual) this.numberData).initialize(opt);
|
||||
((AbstractEAIndividual) this.programData).initialize(opt);
|
||||
System.out.println("Initial value for GAPIndividualDoubleData is not suitable!");
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +72,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
|
||||
* @param opt The optimization problem that is to be solved.
|
||||
*/
|
||||
@Override
|
||||
public void init(InterfaceOptimizationProblem opt) {
|
||||
((AbstractEAIndividual) this.integerData).init(opt);
|
||||
((AbstractEAIndividual) this.permutationData).init(opt);
|
||||
public void initialize(InterfaceOptimizationProblem opt) {
|
||||
((AbstractEAIndividual) this.integerData).initialize(opt);
|
||||
((AbstractEAIndividual) this.permutationData).initialize(opt);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,8 +101,8 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
|
||||
((AbstractEAIndividual) this.permutationData).initByValue(((Object[]) obj)[0], opt);
|
||||
}
|
||||
} else {
|
||||
((AbstractEAIndividual) this.integerData).init(opt);
|
||||
((AbstractEAIndividual) this.permutationData).init(opt);
|
||||
((AbstractEAIndividual) this.integerData).initialize(opt);
|
||||
((AbstractEAIndividual) this.permutationData).initialize(opt);
|
||||
System.out.println("Initial value for GIOBGAIndividualIntegerPermutationData is not suitable!");
|
||||
}
|
||||
}
|
||||
|
@ -110,12 +110,12 @@ public class TestESCrossover implements java.io.Serializable {
|
||||
tmpIndyD.setDoubleRange(newRange);
|
||||
for (int i = 0; i < partners.getTargetSize(); i++) {
|
||||
tmpIndyEA = (AbstractEAIndividual) ((AbstractEAIndividual) tmpIndyD).clone();
|
||||
tmpIndyEA.init(optimizationProblem);
|
||||
tmpIndyEA.initialize(optimizationProblem);
|
||||
partners.add(tmpIndyEA);
|
||||
}
|
||||
partners.init();
|
||||
daddy = (AbstractEAIndividual) ((AbstractEAIndividual) tmpIndyD).clone();
|
||||
daddy.init(optimizationProblem);
|
||||
daddy.initialize(optimizationProblem);
|
||||
plot.clearAll();
|
||||
plot.setUnconnectedPoint(-2, -2, 0);
|
||||
plot.setUnconnectedPoint(2, 2, 0);
|
||||
|
@ -15,6 +15,7 @@ import eva2.tools.math.Mathematics;
|
||||
import eva2.tools.math.RNG;
|
||||
import eva2.tools.math.StatisticUtils;
|
||||
import eva2.util.annotation.Description;
|
||||
import eva2.util.annotation.Hidden;
|
||||
import eva2.util.annotation.Parameter;
|
||||
|
||||
import java.util.*;
|
||||
@ -602,6 +603,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
return historyList;
|
||||
}
|
||||
|
||||
@Hidden
|
||||
public void setHistory(LinkedList<AbstractEAIndividual> theHist) {
|
||||
historyList = theHist;
|
||||
}
|
||||
@ -684,6 +686,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
*
|
||||
* @param d The new number of functioncalls.
|
||||
*/
|
||||
@Hidden
|
||||
public void setFunctionCalls(int d) {
|
||||
this.functionCallCount = d;
|
||||
}
|
||||
@ -738,6 +741,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
*
|
||||
* @param gen the value to set as new generation index
|
||||
*/
|
||||
@Hidden
|
||||
public void setGeneration(int gen) {
|
||||
this.generationCount = gen;
|
||||
}
|
||||
@ -2519,11 +2523,8 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
return seedCardinality;
|
||||
}
|
||||
|
||||
@Parameter(description = "The initial cardinality for binary genotype individuals, given as pair of mean and std.dev.")
|
||||
public void setSeedCardinality(Pair<Integer, Integer> seedCardinality) {
|
||||
this.seedCardinality = seedCardinality;
|
||||
}
|
||||
|
||||
public String seedCardinalityTipText() {
|
||||
return "The initial cardinality for binary genotype individuals, given as pair of mean and std.dev.";
|
||||
}
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ public class ANPSO extends NichePSO implements InterfaceAdditionalPopulationInfo
|
||||
if (reinitSuperfl) {
|
||||
for (int i = 0; i < tmpPop.size(); i++) {
|
||||
AbstractEAIndividual indy = tmpPop.getEAIndividual(i);
|
||||
indy.init(optimizationProblem);
|
||||
indy.initialize(optimizationProblem);
|
||||
indy.resetFitness(Double.MAX_VALUE); // TODO this is not so nice... they should be collected in a reinit-list and inserted at the beginning of the next optimize step
|
||||
ParticleSwarmOptimization.initIndividualDefaults(indy, 0.2);
|
||||
ParticleSwarmOptimization.initIndividualMemory(indy);
|
||||
|
@ -194,7 +194,7 @@ public class ArtificialBeeColony extends AbstractOptimizer implements Serializab
|
||||
*/
|
||||
AbstractEAIndividual oldestIndy = getOldestIndividual();
|
||||
if (oldestIndy.getAge() > this.maxTrials) {
|
||||
oldestIndy.init(this.optimizationProblem);
|
||||
oldestIndy.initialize(this.optimizationProblem);
|
||||
this.optimizationProblem.evaluate(oldestIndy);
|
||||
this.population.incrFunctionCalls();
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class MultiObjectiveCMAES extends AbstractOptimizer implements Serializab
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see eva2.optimization.strategies.InterfaceOptimizer#init()
|
||||
* @see eva2.optimization.strategies.InterfaceOptimizer#initialize()
|
||||
*/
|
||||
@Override
|
||||
public void initialize() {
|
||||
|
@ -146,7 +146,7 @@ public class ParticleFilterOptimization extends AbstractOptimizer implements jav
|
||||
int i;
|
||||
for (i = 0; (i + parents.getTargetSize()) < pop.getTargetSize(); i++) {
|
||||
immi = (AbstractEAIndividual) pop.getEAIndividual(0).clone();
|
||||
immi.init(getProblem());
|
||||
immi.initialize(getProblem());
|
||||
parents.add(immi);
|
||||
}
|
||||
parents.synchSize();
|
||||
|
@ -481,7 +481,7 @@ public class ParticleSubSwarmOptimization extends ParticleSwarmOptimizationGCPSO
|
||||
|
||||
for (int i = 0; i < tmp.getTargetSize(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual) template.clone();
|
||||
tmpIndy.init(prob);
|
||||
tmpIndy.initialize(prob);
|
||||
tmp.add(tmpIndy);
|
||||
}
|
||||
tmp.init();
|
||||
|
@ -954,7 +954,7 @@ v[d] = cmin * v[d];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(InterfaceOptimizationProblem opt) {
|
||||
public void initialize(InterfaceOptimizationProblem opt) {
|
||||
// TODO whats this for?
|
||||
for (int i = 0; i < this.position.x.length; i++) {
|
||||
this.position.x[0] = 0.;
|
||||
@ -983,7 +983,7 @@ v[d] = cmin * v[d];
|
||||
}
|
||||
this.setDoubleGenotype(x);
|
||||
} else {
|
||||
this.init(opt);
|
||||
this.initialize(opt);
|
||||
System.err.println("Initial value for ESIndividualDoubleData is not double[]!");
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class ImpactOfDimensionOnMOEAs {
|
||||
((InterfaceDataTypeDouble) template).setDoubleDataLength(numberOfVariables);
|
||||
for (int i = 0; i < popSize; i++) {
|
||||
tmpIndy = (AbstractEAIndividual) template.clone();
|
||||
tmpIndy.init(null);
|
||||
tmpIndy.initialize(null);
|
||||
pop.add(tmpIndy);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public abstract class AbstractMultiModalProblemKnown extends AbstractProblemDoub
|
||||
((InterfaceDataTypeDouble) this.template).setDoubleRange(makeRange());
|
||||
for (int i = 0; i < population.getTargetSize(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual) this.template.clone();
|
||||
tmpIndy.init(this);
|
||||
tmpIndy.initialize(this);
|
||||
population.add(tmpIndy);
|
||||
}
|
||||
// population initialize must be last
|
||||
|
@ -189,7 +189,7 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
||||
|
||||
for (int i = 0; i < population.getTargetSize(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual) template.clone();
|
||||
tmpIndy.init(prob);
|
||||
tmpIndy.initialize(prob);
|
||||
population.add(tmpIndy);
|
||||
}
|
||||
// population initialize must be last
|
||||
|
@ -160,7 +160,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
|
||||
}
|
||||
|
||||
protected void initIndy(int k, AbstractEAIndividual indy) {
|
||||
indy.init(this);
|
||||
indy.initialize(this);
|
||||
if (RNG.flipCoin(this.problemSpecificInit)) {
|
||||
BitSet tmpSet = new BitSet();
|
||||
tmpSet.clear();
|
||||
|
@ -12,6 +12,7 @@ import eva2.problems.simple.InterfaceSimpleProblem;
|
||||
import eva2.problems.simple.SimpleF1;
|
||||
import eva2.problems.simple.SimpleProblemBinary;
|
||||
import eva2.problems.simple.SimpleProblemDouble;
|
||||
import eva2.util.annotation.Parameter;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
@ -164,6 +165,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
/**
|
||||
* @param simProb the simProb to set
|
||||
*/
|
||||
@Parameter(description = "Set the simple problem class which is to be optimized")
|
||||
public void setSimpleProblem(InterfaceSimpleProblem<?> simProb) {
|
||||
this.simProb = simProb;
|
||||
initTemplate();
|
||||
@ -186,19 +188,13 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String simpleProblemTipText() {
|
||||
return "Set the simple problem class which is to be optimized";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows you to choose how much noise is to be added to the
|
||||
* fitness. This can be used to make the optimization problem more difficult.
|
||||
*
|
||||
* @param noise The sigma for a gaussian random number.
|
||||
*/
|
||||
@Parameter(description = "Gaussian noise level on the fitness value.")
|
||||
public void setNoise(double noise) {
|
||||
if (noise < 0) {
|
||||
noise = 0;
|
||||
@ -210,11 +206,6 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
return this.noise;
|
||||
}
|
||||
|
||||
public String noiseTipText() {
|
||||
return "Gaussian noise level on the fitness value.";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A (symmetric) absolute range limit.
|
||||
*
|
||||
@ -229,15 +220,12 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
*
|
||||
* @param defaultRange
|
||||
*/
|
||||
@Parameter(name = "range", description = "Absolute limit for the symmetric range in any dimension")
|
||||
public void setDefaultRange(double defaultRange) {
|
||||
this.defaultRange = defaultRange;
|
||||
initTemplate();
|
||||
}
|
||||
|
||||
public String defaultRangeTipText() {
|
||||
return "Absolute limit for the symmetric range in any dimension";
|
||||
}
|
||||
|
||||
/**
|
||||
* Take care that all properties which may be hidden (and currently are) send a "hide" message to the Java Bean properties.
|
||||
* This is called by PropertySheetPanel in use with the GenericObjectEditor.
|
||||
@ -246,16 +234,12 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
setSimpleProblem(getSimpleProblem());
|
||||
}
|
||||
|
||||
@Parameter(name = "individual", description = "Set the individual properties for the optimization")
|
||||
public void setIndividualTemplate(AbstractEAIndividual indy) {
|
||||
resetTemplate = false;
|
||||
template = indy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String individualTemplateTipText() {
|
||||
return "Set the individual properties for the optimization";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a string describing the optimization problem.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user