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>
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface TerminationStrategy
TerminationStrategy.ExecutionState<T> -
Constructor Summary
ConstructorsConstructorDescriptionStagnationTerminator(int maximumGenerationsWithoutImprovement) 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
-
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
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
-