Tests for MaximumTimeTerminator

refs #61
This commit is contained in:
2015-12-21 12:43:40 +01:00
parent 469e2033d6
commit 327a95b037
3 changed files with 55 additions and 5 deletions

View File

@@ -29,12 +29,12 @@ public class KnownOptimaFoundTerminator implements InterfaceTerminator, Serializ
}
@Override
public void initialize(InterfaceOptimizationProblem prob) {
public void initialize(InterfaceOptimizationProblem prob) throws IllegalArgumentException {
if (prob != null) {
if (prob instanceof InterfaceMultimodalProblemKnown) {
mProblem = (InterfaceMultimodalProblemKnown) prob;
} else {
LOGGER.log(Level.WARNING, "KnownOptimaFoundTerminator only works with InterfaceMultimodalProblemKnown instances!");
throw new IllegalArgumentException("KnownOptimaFoundTerminator only works with InterfaceMultimodalProblemKnown instances!");
}
} else {
LOGGER.log(Level.WARNING, "KnownOptimaFoundTerminator wont work with null problem!");

View File

@@ -722,9 +722,7 @@ public class Population extends ArrayList<AbstractEAIndividual> implements Popul
this.historyList.add((AbstractEAIndividual) this.getBestEAIndividual().clone());
}
if (isAutoAging()) {
for (AbstractEAIndividual individual : this) {
individual.incrAge();
}
this.forEach(AbstractEAIndividual::incrAge);
}
this.generationCount++;
firePropertyChangedEvent(NEXT_GENERATION_PERFORMED);