Minor changes.
This commit is contained in:
parent
c4ebba116f
commit
ab6b7f2794
@ -80,7 +80,8 @@ public class ParetoMetricTerminator extends PopulationMeasureTerminator implemen
|
|||||||
|
|
||||||
public static String globalInfo() {
|
public static String globalInfo() {
|
||||||
return "Terminate if the pareto front of a multi-objective optimization process converges " +
|
return "Terminate if the pareto front of a multi-objective optimization process converges " +
|
||||||
"with respect to a certain measure.";
|
"with respect to a certain measure. Note that this only works with " +
|
||||||
|
"AbstractMultiObjectiveOptimizationProblem instances.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParetoMetric(InterfaceParetoFrontMetric pMetric) {
|
public void setParetoMetric(InterfaceParetoFrontMetric pMetric) {
|
||||||
|
@ -12,26 +12,11 @@ import eva2.server.go.populations.Population;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PopulationArchiveTerminator extends PopulationMeasureTerminator {
|
public class PopulationArchiveTerminator extends PopulationMeasureTerminator {
|
||||||
IndividualWeightedFitnessComparator wfComp = new IndividualWeightedFitnessComparator(null);
|
IndividualWeightedFitnessComparator wfComp = new IndividualWeightedFitnessComparator(new double[]{1.});
|
||||||
|
|
||||||
// private boolean isStillConverged(PopulationInterface pop) {
|
public static String globalInfo() {
|
||||||
// Population archive = ((Population)pop).getArchive();
|
return "Stop if a linear recombination of the best fitness stagnates for a certain period.";
|
||||||
// if (archive==null || (archive.size()<1)) {
|
}
|
||||||
// System.err.println("Error, population had no archive in " + this.getClass());
|
|
||||||
// return false;
|
|
||||||
// } else {
|
|
||||||
// double bestScore = Population.getScore(archive.getEAIndividual(0), fitWeights);
|
|
||||||
// for (int i=1; i<archive.size(); i++) {
|
|
||||||
// double tmpScore = Population.getScore(archive.getEAIndividual(i), fitWeights);
|
|
||||||
// if (tmpScore<bestScore) bestScore=tmpScore;
|
|
||||||
// }
|
|
||||||
// if (bestScore>=oldScore) return true;
|
|
||||||
// else {
|
|
||||||
// oldScore=bestScore;
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected double calcInitialMeasure(PopulationInterface pop) {
|
protected double calcInitialMeasure(PopulationInterface pop) {
|
||||||
|
@ -28,7 +28,7 @@ import eva2.tools.SelectedTag;
|
|||||||
public abstract class PopulationMeasureTerminator implements InterfaceTerminator,
|
public abstract class PopulationMeasureTerminator implements InterfaceTerminator,
|
||||||
Serializable {
|
Serializable {
|
||||||
public enum ChangeTypeEnum {relativeChange, absoluteChange, absoluteValue};
|
public enum ChangeTypeEnum {relativeChange, absoluteChange, absoluteValue};
|
||||||
public enum DirectionTypeEnum {decreaseImprovement, bidirectional};
|
public enum DirectionTypeEnum {decrease, bidirectional};
|
||||||
public enum StagnationTypeEnum {fitnessCallBased, generationBased};
|
public enum StagnationTypeEnum {fitnessCallBased, generationBased};
|
||||||
|
|
||||||
protected static boolean TRACE = false;
|
protected static boolean TRACE = false;
|
||||||
@ -41,7 +41,7 @@ Serializable {
|
|||||||
private StagnationTypeEnum stagnationMeasure = StagnationTypeEnum.fitnessCallBased;
|
private StagnationTypeEnum stagnationMeasure = StagnationTypeEnum.fitnessCallBased;
|
||||||
// private SelectedTag convCondition = new SelectedTag("Relative change", "Absolute change", "Absolute value");
|
// private SelectedTag convCondition = new SelectedTag("Relative change", "Absolute change", "Absolute value");
|
||||||
private ChangeTypeEnum changeType = ChangeTypeEnum.relativeChange;
|
private ChangeTypeEnum changeType = ChangeTypeEnum.relativeChange;
|
||||||
private DirectionTypeEnum condDirection = DirectionTypeEnum.decreaseImprovement;
|
private DirectionTypeEnum condDirection = DirectionTypeEnum.decrease;
|
||||||
// private SelectedTag condImprovementOrChange = new SelectedTag("Decrease", "Improvement and Deterioration");
|
// private SelectedTag condImprovementOrChange = new SelectedTag("Decrease", "Improvement and Deterioration");
|
||||||
protected String msg="Not terminated.";
|
protected String msg="Not terminated.";
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean doCheckImprovement() {
|
public boolean doCheckImprovement() {
|
||||||
return (condDirection==DirectionTypeEnum.decreaseImprovement);
|
return (condDirection==DirectionTypeEnum.decrease);
|
||||||
// return condImprovementOrChange.isSelectedString("Improvement");
|
// return condImprovementOrChange.isSelectedString("Improvement");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ Serializable {
|
|||||||
return stagTime;
|
return stagTime;
|
||||||
}
|
}
|
||||||
public String stagnationTimeTipText() {
|
public String stagnationTimeTipText() {
|
||||||
return "Terminate if the population has not improved for this time";
|
return "Terminate if the population has not improved/changed for this time";
|
||||||
}
|
}
|
||||||
|
|
||||||
public StagnationTypeEnum getStagnationMeasure() {
|
public StagnationTypeEnum getStagnationMeasure() {
|
||||||
@ -305,7 +305,7 @@ Serializable {
|
|||||||
this.stagnationMeasure = stagnationTimeIn;
|
this.stagnationMeasure = stagnationTimeIn;
|
||||||
}
|
}
|
||||||
public String stagnationMeasureTipText() {
|
public String stagnationMeasureTipText() {
|
||||||
return "Stagnation time is measured in fitness calls or generations.";
|
return "Stagnation time is measured in fitness calls or generations";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChangeTypeEnum getConvergenceCondition() {
|
public ChangeTypeEnum getConvergenceCondition() {
|
||||||
@ -313,21 +313,18 @@ Serializable {
|
|||||||
}
|
}
|
||||||
public void setConvergenceCondition(ChangeTypeEnum convergenceCondition) {
|
public void setConvergenceCondition(ChangeTypeEnum convergenceCondition) {
|
||||||
this.changeType = convergenceCondition;
|
this.changeType = convergenceCondition;
|
||||||
// GenericObjectEditor.setHideProperty(this.getClass(), "convergenceThresholdUpper", isRelativeConvergence() || doCheckImprovement());
|
|
||||||
}
|
}
|
||||||
public String convergenceConditionTipText() {
|
public String convergenceConditionTipText() {
|
||||||
return "Select between absolute and relative convergence condition";
|
return "Select absolute or relative convergence condition";
|
||||||
}
|
}
|
||||||
|
|
||||||
public DirectionTypeEnum getCheckType() {
|
public DirectionTypeEnum getCheckType() {
|
||||||
return condDirection;
|
return condDirection;
|
||||||
// return condImprovementOrChange;
|
|
||||||
}
|
}
|
||||||
public void setCheckType(DirectionTypeEnum dt) {
|
public void setCheckType(DirectionTypeEnum dt) {
|
||||||
this.condDirection = dt;
|
this.condDirection = dt;
|
||||||
// GenericObjectEditor.setHideProperty(this.getClass(), "convergenceThresholdUpper", isRelativeConvergence() || doCheckImprovement());
|
|
||||||
}
|
}
|
||||||
public String checkTypeTipText() {
|
public String checkTypeTipText() {
|
||||||
return "Detect improvement only (decreasing measure) or change in both directions (de- and increase).";
|
return "Detect improvement only (decreasing measure) or change in both directions (decrease and increase)";
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -486,7 +486,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
|||||||
Population pop = new Population(1);
|
Population pop = new Population(1);
|
||||||
pop.add(orig);
|
pop.add(orig);
|
||||||
InterfaceTerminator term = new EvaluationTerminator(maxEvaluations);
|
InterfaceTerminator term = new EvaluationTerminator(maxEvaluations);
|
||||||
if (epsilonFitConv > 0) term = new CombinedTerminator(new PhenotypeConvergenceTerminator(epsilonFitConv, 100*dim, StagnationTypeEnum.fitnessCallBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decreaseImprovement), term, false);
|
if (epsilonFitConv > 0) term = new CombinedTerminator(new PhenotypeConvergenceTerminator(epsilonFitConv, 100*dim, StagnationTypeEnum.fitnessCallBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decrease), term, false);
|
||||||
int evalsPerf = PostProcess.processSingleCandidatesNMCMA(PostProcessMethod.nelderMead, pop, term, initRelPerturb, prob);
|
int evalsPerf = PostProcess.processSingleCandidatesNMCMA(PostProcessMethod.nelderMead, pop, term, initRelPerturb, prob);
|
||||||
overallDist = metric.distance(indy, pop.getBestEAIndividual());
|
overallDist = metric.distance(indy, pop.getBestEAIndividual());
|
||||||
//System.out.println(System.currentTimeMillis() + " in " + evalsPerf + " evals moved by "+ overallDist);
|
//System.out.println(System.currentTimeMillis() + " in " + evalsPerf + " evals moved by "+ overallDist);
|
||||||
|
@ -399,7 +399,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
|||||||
tmpIndy.SetDoubleGenotype(pos);
|
tmpIndy.SetDoubleGenotype(pos);
|
||||||
((AbstractEAIndividual)tmpIndy).SetFitness(prob.eval(pos));
|
((AbstractEAIndividual)tmpIndy).SetFitness(prob.eval(pos));
|
||||||
pop.add(tmpIndy);
|
pop.add(tmpIndy);
|
||||||
FitnessConvergenceTerminator convTerm = new FitnessConvergenceTerminator(1e-25, 10, StagnationTypeEnum.generationBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decreaseImprovement);
|
FitnessConvergenceTerminator convTerm = new FitnessConvergenceTerminator(1e-25, 10, StagnationTypeEnum.generationBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decrease);
|
||||||
int calls = PostProcess.processSingleCandidatesNMCMA(PostProcessMethod.nelderMead, pop, convTerm, 0.001, prob);
|
int calls = PostProcess.processSingleCandidatesNMCMA(PostProcessMethod.nelderMead, pop, convTerm, 0.001, prob);
|
||||||
return ((InterfaceDataTypeDouble)pop.getBestEAIndividual()).getDoubleData();
|
return ((InterfaceDataTypeDouble)pop.getBestEAIndividual()).getDoubleData();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf
|
|||||||
bestList = new LinkedList<AbstractEAIndividual>();
|
bestList = new LinkedList<AbstractEAIndividual>();
|
||||||
best = getPopulation().getBestEAIndividual();
|
best = getPopulation().getBestEAIndividual();
|
||||||
dim = AbstractEAIndividual.getDoublePositionShallow(getPopulation().getEAIndividual(0)).length;
|
dim = AbstractEAIndividual.getDoublePositionShallow(getPopulation().getEAIndividual(0)).length;
|
||||||
fitConvTerm = new FitnessConvergenceTerminator(stagThreshold, (isStagnationTimeUserDef()) ? stagTimeArbitrary : calcDefaultStagnationTime(), StagnationTypeEnum.generationBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decreaseImprovement); // gen. based, absolute
|
fitConvTerm = new FitnessConvergenceTerminator(stagThreshold, (isStagnationTimeUserDef()) ? stagTimeArbitrary : calcDefaultStagnationTime(), StagnationTypeEnum.generationBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decrease); // gen. based, absolute
|
||||||
getPopulation().addPopulationChangedEventListener(this);
|
getPopulation().addPopulationChangedEventListener(this);
|
||||||
getPopulation().setNotifyEvalInterval(initialLambda);
|
getPopulation().setNotifyEvalInterval(initialLambda);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user