Class StagnationTerminator<T>

java.lang.Object
org.cicirello.search.evo.StagnationTerminator<T>
Type Parameters:
T - The type of object under optimization.
All Implemented Interfaces:
TerminationStrategy<T>

public final class StagnationTerminator<T> extends Object implements TerminationStrategy<T>
TerminationStrategy that terminates an evolutionary algorithm when a specified number of generations elapses without further improvement to the fitness of the most-fit solution found.
  • Constructor Details

    • StagnationTerminator

      public StagnationTerminator(int maximumGenerationsWithoutImprovement)
      Initializes the TerminationStrategy
      Parameters:
      maximumGenerationsWithoutImprovement - the maximum numnber of generations to run the evolutionary algorithm (EA) without further improvement to the best found solution. This termination strategy tracks the generation number for each time a solution is found with fitness better than previous found solutions, and will terminate if no improvement occurs for this number of generations.
  • Method Details

    • terminate

      public boolean terminate(TerminationStrategy.ExecutionState<T> state)
      Description copied from interface: TerminationStrategy
      Predicate method to determine whether or not to terminate the current run of the evolutionary algorithm.
      Specified by:
      terminate in interface TerminationStrategy<T>
      Parameters:
      state - the state of the evolutionary algorithm prior to the start of a generation
      Returns:
      true if and only if the evolutionary algorithm should terminate