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 the abort()
method to make
the evolution terminate at the end of the current generation.AbortControl
Constructor and Description |
---|
UserAbort() |
Modifier and Type | Method and 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.
|
public boolean shouldTerminate(PopulationData<?> populationData)
shouldTerminate
in interface TerminationCondition
populationData
- Information about the current state of evolution. This may
be used to determine whether evolution should continue or not.public void abort()
public boolean isAborted()
abort()
method has been invoked, false otherwise.public void reset()