Class 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 the abort() method to make the evolution terminate at the end of the current generation.
    See Also:
    AbortControl
    • Constructor Detail

      • UserAbort

        public UserAbort()
    • 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 interface TerminationCondition
        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.