Class MaximumFitnessEvaluationsTerminator<T>
java.lang.Object
org.cicirello.search.evo.MaximumFitnessEvaluationsTerminator<T>
- Type Parameters:
T- The type of object under optimization.
- All Implemented Interfaces:
TerminationStrategy<T>
public final class MaximumFitnessEvaluationsTerminator<T>
extends Object
implements TerminationStrategy<T>
TerminationStrategy that terminates an evolutionary algorithm once the total number of fitness
evaluations exceeds a threshold. Note that the TerminationStrategy is evaluated once per
generation, so this MaximumFitnessEvaluationsTerminator may result in more fitness evaluations
than the target threshold (e.g., it won't cause termination in the middle of a generation, such
as while evaluating the children that result from crossing or mutating parents).
-
Nested Class Summary
Nested classes/interfaces inherited from interface TerminationStrategy
TerminationStrategy.ExecutionState<T> -
Constructor Summary
ConstructorsConstructorDescriptionMaximumFitnessEvaluationsTerminator(long maximumNumberOfFitnessEvaluations) Initializes the TerminationStrategy -
Method Summary
Modifier and TypeMethodDescriptionbooleanPredicate method to determine whether or not to terminate the current run of the evolutionary algorithm.
-
Constructor Details
-
MaximumFitnessEvaluationsTerminator
public MaximumFitnessEvaluationsTerminator(long maximumNumberOfFitnessEvaluations) Initializes the TerminationStrategy- Parameters:
maximumNumberOfFitnessEvaluations- the target maximum number of fitness evaluations. The evolutionary algorithm will terminate once this maximum is reached and detected at the start of a generation
-
-
Method Details
-
terminate
Description copied from interface:TerminationStrategyPredicate method to determine whether or not to terminate the current run of the evolutionary algorithm.- Specified by:
terminatein interfaceTerminationStrategy<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
-