Class TargetFitnessTerminator<T>

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

public final class TargetFitnessTerminator<T> extends Object implements TerminationStrategy<T>
TerminationStrategy that terminates an evolutionary algorithm if a solution with a target fitness value (or better) is found.
  • Constructor Details

    • TargetFitnessTerminator

      public TargetFitnessTerminator(double targetFitness)
      Initializes the TerminationStrategy
      Parameters:
      targetFitness - the target fitness. Note that this is the target fitness value and not a target for the objective function you are optimizing, which may or may not be the same thing depending upon how you have configured the evolutionary algorithm
  • 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