Class UserAbort
- java.lang.Object
-
- org.uncommons.watchmaker.framework.termination.UserAbort
-
- All Implemented Interfaces:
TerminationCondition
public final class UserAbort extends Object implements TerminationCondition
TerminationCondition
implementation that allows for user-initiated termination of an evolutionary algorithm. This condition can be used, for instance, to provide a button on a GUI that terminates execution. The application should retain a reference to the instance after passing it to the evolution engine and should invoke theabort()
method to make the evolution terminate at the end of the current generation.- See Also:
AbortControl
-
-
Constructor Summary
Constructors Constructor Description UserAbort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
Aborts any evolutionary algorithms that monitor this termination condition instance.boolean
isAborted()
void
reset()
Resets the abort condition to false so that it may be reused.boolean
shouldTerminate(PopulationData<?> populationData)
The condition is queried via this method to determine whether or not evolution should finish at the current point.
-
-
-
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 interfaceTerminationCondition
- 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.
-
abort
public void abort()
Aborts any evolutionary algorithms that monitor this termination condition instance.
-
isAborted
public boolean isAborted()
- Returns:
- true if the
abort()
method has been invoked, false otherwise.
-
reset
public void reset()
Resets the abort condition to false so that it may be reused.
-
-