public class Stagnation extends Object implements TerminationCondition
TerminationCondition
that halts evolution if no improvement in fitness
is observed within a specified number of generations.Constructor and Description |
---|
Stagnation(int generationLimit,
boolean naturalFitness)
Creates a
TerminationCondition that will halt evolution after the
specified number of generations passes without any improvement in the population's
fittest individual. |
Stagnation(int generationLimit,
boolean naturalFitness,
boolean usePopulationAverage)
Creates a
TerminationCondition that will halt evolution after the
specified number of generations passes without any improvement in the population's
fitness (either the fittest individual or the mean fitness of the entire population,
depending on the final parameter). |
Modifier and Type | Method and Description |
---|---|
boolean |
shouldTerminate(PopulationData<?> populationData)
The condition is queried via this method to determine whether or not evolution
should finish at the current point.
|
public Stagnation(int generationLimit, boolean naturalFitness)
TerminationCondition
that will halt evolution after the
specified number of generations passes without any improvement in the population's
fittest individual.generationLimit
- The number of generations without improvement that
will lead to termination.naturalFitness
- True if higher fitness scores are better, false otherwise.public Stagnation(int generationLimit, boolean naturalFitness, boolean usePopulationAverage)
TerminationCondition
that will halt evolution after the
specified number of generations passes without any improvement in the population's
fitness (either the fittest individual or the mean fitness of the entire population,
depending on the final parameter).generationLimit
- The number of generations without improvement that
will lead to termination.naturalFitness
- True if higher fitness scores are better, false otherwise.usePopulationAverage
- If true uses the mean fitness of the population as the
criteria, otherwise uses the fittest individual.public boolean shouldTerminate(PopulationData<?> populationData)
shouldTerminate
in interface TerminationCondition
populationData
- Information about the current state of evolution. This may
be used to determine whether evolution should continue or not.