org.uncommons.watchmaker.framework.termination
Class TargetFitness
java.lang.Object
org.uncommons.watchmaker.framework.termination.TargetFitness
- All Implemented Interfaces:
- TerminationCondition
public class TargetFitness
- extends Object
- implements TerminationCondition
Terminates evolution once at least one candidate in the population has equalled
or bettered a pre-determined fitness score.
- Author:
- Daniel Dyer
Constructor Summary |
TargetFitness(double targetFitness,
boolean natural)
|
Method Summary |
boolean |
shouldTerminate(PopulationData<?> populationData)
The condition is queried via this method to determine whether or not evolution
should finish at the current point. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TargetFitness
public TargetFitness(double targetFitness,
boolean natural)
- Parameters:
targetFitness
- The fitness score that must be achieved by at least
one individual in the population in order for this condition to be satisfied.natural
- Whether fitness scores are natural or non-natural. If fitness
is natural, the condition will be satisfied if any individual has a fitness
that is greater than or equal to the target fitness. If fitness is non-natural,
the condition will be satisified in any individual has a fitness that is less
than or equal to the target fitness.- See Also:
FitnessEvaluator
shouldTerminate
public boolean shouldTerminate(PopulationData<?> populationData)
- The condition is queried via this method to determine whether or not evolution
should finish at the current point.
- Specified by:
shouldTerminate
in interface TerminationCondition
- Parameters:
populationData
- Information about the current state of evolution. This may
be used to determine whether evolution should continue or not.
- Returns:
- true if evolution should be terminated, false otherwise.