Fix globalInfo/annotations.
This commit is contained in:
parent
0202692844
commit
079715bb24
@ -39,8 +39,10 @@ import java.util.List;
|
||||
/**
|
||||
* <p> The OptimizerFactory allows quickly creating some optimizers without
|
||||
* thinking much about parameters. You can access a runnable Optimization thread
|
||||
* and directly start it, or access its fully prepared GOParameter instance,
|
||||
* change some parameters, and start it then. </p> <p> On the other hand this
|
||||
* and directly start it, or access its fully prepared OptimizationParameter instance,
|
||||
* change some parameters, and start it then.
|
||||
* </p> <p>
|
||||
* On the other hand this
|
||||
* class provides an almost complete list of all currently available
|
||||
* optimization procedures in EvA2. The arguments passed to the methods
|
||||
* initialize the respective optimization procedure. To perform an optimization
|
||||
@ -50,12 +52,6 @@ import java.util.List;
|
||||
* EvaluationTerminator terminator = new EvaluationTerminator(numOfFitnessCalls);
|
||||
* while (!terminator.isTerminated(optimizer.getPopulation())) optimizer.optimize();
|
||||
* </code> </p>
|
||||
*
|
||||
* @author mkron
|
||||
* @author Andreas Dräger
|
||||
* @version 0.1
|
||||
* @date 17.04.2007
|
||||
* @since 2.0
|
||||
*/
|
||||
public class OptimizerFactory {
|
||||
|
||||
|
@ -8,7 +8,7 @@ import eva2.util.annotation.Description;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Description(value = "Boolean combination of two terminators.")
|
||||
@Description("Boolean combination of two terminators.")
|
||||
public class CombinedTerminator implements InterfaceTerminator, Serializable {
|
||||
/**
|
||||
*
|
||||
|
@ -4,6 +4,7 @@ import eva2.optimization.operator.distancemetric.InterfaceDistanceMetric;
|
||||
import eva2.optimization.operator.distancemetric.PhenotypeMetric;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.optimization.population.PopulationInterface;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -14,9 +15,10 @@ import java.io.Serializable;
|
||||
* May be computationally expensive.
|
||||
*
|
||||
* @author mkron
|
||||
* @see Population.getPopulationMeasures()
|
||||
* @see Population#getPopulationMeasures()
|
||||
* @see PhenotypeMetric
|
||||
*/
|
||||
@Description("The diversity terminator uses the distance of individuals in the population as a termination criterion.")
|
||||
public class DiversityTerminator extends PopulationMeasureTerminator implements InterfaceTerminator, Serializable {
|
||||
public enum DiversityCriterion {averageDistance, minimumDistance, maximumDistance}
|
||||
|
||||
@ -35,10 +37,6 @@ public class DiversityTerminator extends PopulationMeasureTerminator implements
|
||||
this.criterion = divCrit;
|
||||
}
|
||||
|
||||
public static String globalInfo() {
|
||||
return "The diversity terminator uses the distance of individuals in the population as a termination criterion.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metric
|
||||
*/
|
||||
|
@ -35,7 +35,7 @@ public class EvaluationTerminator implements InterfaceTerminator,
|
||||
/**
|
||||
* Construct Terminator with a maximum number of fitness calls.
|
||||
*
|
||||
* @param maximum number of fitness calls
|
||||
* @param x number of fitness calls
|
||||
*/
|
||||
public EvaluationTerminator(int x) {
|
||||
maxFitnessCalls = x;
|
||||
@ -68,12 +68,10 @@ public class EvaluationTerminator implements InterfaceTerminator,
|
||||
}
|
||||
|
||||
public void setFitnessCalls(int x) {
|
||||
//System.out.println("setFitnessCalls"+x);
|
||||
maxFitnessCalls = x;
|
||||
}
|
||||
|
||||
public int getFitnessCalls() {
|
||||
//System.out.println("getFitnessCalls"+maxFitnessCalls);
|
||||
return maxFitnessCalls;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package eva2.optimization.operator.terminators;
|
||||
|
||||
import eva2.optimization.population.PopulationInterface;
|
||||
import eva2.tools.math.Mathematics;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -12,6 +13,7 @@ import java.io.Serializable;
|
||||
*
|
||||
* @see PopulationMeasureTerminator
|
||||
*/
|
||||
@Description("Stop if a fitness convergence criterion has been met.")
|
||||
public class FitnessConvergenceTerminator extends PopulationMeasureTerminator
|
||||
implements InterfaceTerminator, Serializable {
|
||||
|
||||
@ -27,10 +29,6 @@ public class FitnessConvergenceTerminator extends PopulationMeasureTerminator
|
||||
super(other);
|
||||
}
|
||||
|
||||
public static String globalInfo() {
|
||||
return "Stop if a fitness convergence criterion has been met.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calcInitialMeasure(PopulationInterface pop) {
|
||||
return Mathematics.norm(pop.getBestFitness());
|
||||
|
@ -4,12 +4,14 @@ import eva2.gui.BeanInspector;
|
||||
import eva2.optimization.population.InterfaceSolutionSet;
|
||||
import eva2.optimization.population.PopulationInterface;
|
||||
import eva2.problems.InterfaceOptimizationProblem;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Description("Terminate if a certain fitness value has been reached.")
|
||||
public class FitnessValueTerminator implements InterfaceTerminator,
|
||||
Serializable {
|
||||
protected double[] fitnessValue;
|
||||
@ -27,13 +29,6 @@ public class FitnessValueTerminator implements InterfaceTerminator,
|
||||
msg = "Not terminated.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static String globalInfo() {
|
||||
return "Terminate if a certain fitness value has been reached.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -6,6 +6,7 @@ import eva2.optimization.population.PopulationInterface;
|
||||
import eva2.problems.InterfaceMultimodalProblemKnown;
|
||||
import eva2.problems.InterfaceOptimizationProblem;
|
||||
import eva2.tools.EVAERROR;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.logging.Level;
|
||||
@ -16,9 +17,8 @@ import java.util.logging.Logger;
|
||||
* implements InterfaceMultimodalProblemKnown. A population is regarded as terminated
|
||||
* if the preset number of optima is identified.
|
||||
* For any other problem types, this terminator will not make sense, so take care.
|
||||
*
|
||||
* @author mkron
|
||||
*/
|
||||
@Description("Terminate if a given number of optima has been found. Works for problems implementing InterfaceMultimodalProblemKnown, e.g. FM0.")
|
||||
public class KnownOptimaFoundTerminator implements InterfaceTerminator, Serializable {
|
||||
private Logger LOGGER = Logger.getLogger(KnownOptimaFoundTerminator.class.getName());
|
||||
private InterfaceMultimodalProblemKnown mProblem = null;
|
||||
@ -90,8 +90,4 @@ public class KnownOptimaFoundTerminator implements InterfaceTerminator, Serializ
|
||||
public String toString() {
|
||||
return "KnownOptimaFoundTerminator requiring " + reqOptima + " optima.";
|
||||
}
|
||||
|
||||
public static String globalInfo() {
|
||||
return "Terminate if a given number of optima has been found. Works for problems implementing InterfaceMultimodalProblemKnown, e.g. FM0.";
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import eva2.optimization.population.PopulationInterface;
|
||||
import eva2.problems.AbstractMultiObjectiveOptimizationProblem;
|
||||
import eva2.problems.InterfaceOptimizationProblem;
|
||||
import eva2.tools.EVAERROR;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -17,9 +18,10 @@ import java.io.Serializable;
|
||||
* on the fitness range.
|
||||
* The metric may be employed on the current population or the current pareto front
|
||||
* maintained by the problem instance.
|
||||
*
|
||||
* @author mkron
|
||||
*/
|
||||
@Description("Terminate if the pareto front of a multi-objective optimization process converges " +
|
||||
"with respect to a certain measure. Note that this only works with " +
|
||||
"AbstractMultiObjectiveOptimizationProblem instances.")
|
||||
public class ParetoMetricTerminator extends PopulationMeasureTerminator implements Serializable {
|
||||
private InterfaceParetoFrontMetric pMetric = new MetricS();
|
||||
AbstractMultiObjectiveOptimizationProblem moProb = null;
|
||||
@ -87,12 +89,6 @@ public class ParetoMetricTerminator extends PopulationMeasureTerminator implemen
|
||||
}
|
||||
}
|
||||
|
||||
public static String globalInfo() {
|
||||
return "Terminate if the pareto front of a multi-objective optimization process converges " +
|
||||
"with respect to a certain measure. Note that this only works with " +
|
||||
"AbstractMultiObjectiveOptimizationProblem instances.";
|
||||
}
|
||||
|
||||
public void setParetoMetric(InterfaceParetoFrontMetric pMetric) {
|
||||
this.pMetric = pMetric;
|
||||
}
|
||||
|
@ -4,11 +4,12 @@ import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.operator.distancemetric.PhenotypeMetric;
|
||||
import eva2.optimization.population.PopulationInterface;
|
||||
import eva2.problems.InterfaceOptimizationProblem;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
@Description("Terminate if the best individual of the current population moved less than a threshold within phenotypic space.")
|
||||
public class PhenotypeConvergenceTerminator extends PopulationMeasureTerminator implements InterfaceTerminator {
|
||||
AbstractEAIndividual oldIndy = null;
|
||||
private PhenotypeMetric pMetric = null;
|
||||
// double oldPhenNorm = 0;
|
||||
|
||||
public PhenotypeConvergenceTerminator() {
|
||||
super();
|
||||
@ -24,20 +25,17 @@ public class PhenotypeConvergenceTerminator extends PopulationMeasureTerminator
|
||||
super(o);
|
||||
oldIndy = (AbstractEAIndividual) o.oldIndy.clone();
|
||||
pMetric = (PhenotypeMetric) o.pMetric.clone();
|
||||
// oldPhenNorm = o.oldPhenNorm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(InterfaceOptimizationProblem prob) {
|
||||
super.initialize(prob);
|
||||
// oldPhenNorm = 0;
|
||||
oldIndy = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calcInitialMeasure(PopulationInterface pop) {
|
||||
oldIndy = (AbstractEAIndividual) ((AbstractEAIndividual) pop.getBestIndividual()).clone();
|
||||
// oldPhenNorm = PhenotypeMetric.norm(oldIndy);
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
@ -50,15 +48,10 @@ public class PhenotypeConvergenceTerminator extends PopulationMeasureTerminator
|
||||
protected void saveState(PopulationInterface Pop) {
|
||||
super.saveState(Pop);
|
||||
oldIndy = (AbstractEAIndividual) ((AbstractEAIndividual) Pop.getBestIndividual()).clone();
|
||||
// oldPhenNorm = PhenotypeMetric.norm(oldIndy);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getMeasureName() {
|
||||
return "Phenotype";
|
||||
}
|
||||
|
||||
public static String globalInfo() {
|
||||
return "Terminate if the best individual of the current population moved less than a threshold within phenotypic space.";
|
||||
}
|
||||
}
|
||||
|
@ -3,20 +3,16 @@ package eva2.optimization.operator.terminators;
|
||||
import eva2.optimization.individuals.IndividualWeightedFitnessComparator;
|
||||
import eva2.optimization.population.Population;
|
||||
import eva2.optimization.population.PopulationInterface;
|
||||
import eva2.util.annotation.Description;
|
||||
|
||||
/**
|
||||
* Terminate if a score based on the archive of the population converges.
|
||||
* Note that this only works if the archive is filled with sensible data.
|
||||
*
|
||||
* @author mkron
|
||||
*/
|
||||
@Description("Stop if a linear recombination of the best fitness stagnates for a certain period.")
|
||||
public class PopulationArchiveTerminator extends PopulationMeasureTerminator {
|
||||
IndividualWeightedFitnessComparator wfComp = new IndividualWeightedFitnessComparator(new double[]{1.});
|
||||
|
||||
public static String globalInfo() {
|
||||
return "Stop if a linear recombination of the best fitness stagnates for a certain period.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double calcInitialMeasure(PopulationInterface pop) {
|
||||
Population archive = ((Population) pop).getArchive();
|
||||
|
Loading…
x
Reference in New Issue
Block a user