Class 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.
    • Constructor Detail

      • 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
    • Method Detail

      • 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.