Class Stagnation

    • Constructor Summary

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

      • Stagnation

        public 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.
        Parameters:
        generationLimit - The number of generations without improvement that will lead to termination.
        naturalFitness - True if higher fitness scores are better, false otherwise.
      • Stagnation

        public 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).
        Parameters:
        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.
    • 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.