Interface TerminationCondition

All Superinterfaces:
Named
All Known Implementing Classes:
CancellationSignal, CompoundTerminationCondition, MaxElapsedTime, MaxFunctionEvaluations, TargetObjectiveTermination, TemperatureBasedTerminationCondition

public interface TerminationCondition extends Named
Interface used to implement conditions for when an algorithm should terminate. The initialize method is invoked when the algorithm is first created to collect any initial conditions, such as the starting time, and shouldTerminate is invoked every step to check if the algorithm should terminate.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Returns the name of this object.
    double
    Returns the percentage that this condition is complete, as a value between 0.0 and 100.0.
    void
    initialize(Algorithm algorithm)
    Invoked when the algorithm is created to collect any initial conditions.
    boolean
    Invoked after every step to check if the algorithm should terminate.
  • Method Details

    • initialize

      void initialize(Algorithm algorithm)
      Invoked when the algorithm is created to collect any initial conditions. Note that the algorithm may not have been initialized at this point.
      Parameters:
      algorithm - the algorithm
    • shouldTerminate

      boolean shouldTerminate(Algorithm algorithm)
      Invoked after every step to check if the algorithm should terminate.
      Parameters:
      algorithm - the algorithm
      Returns:
      true if the algorithm should terminate; false otherwise
    • getPercentComplete

      double getPercentComplete(Algorithm algorithm)
      Returns the percentage that this condition is complete, as a value between 0.0 and 100.0. If the percentage can not be determined, returns 0d/0d.
      Parameters:
      algorithm - the algorithm
      Returns:
      the percentage completion
    • getName

      default String getName()
      Description copied from interface: Named
      Returns the name of this object. The format for the name depends on the specific implementation, but in general we recommend:
      1. Prefer using alphanumeric characters including '_' and '-'.
      2. Avoid whitespace and other control characters.
      3. null can be returned, if allowed by the implementation, to indicate the object is anonymous or has no assigned name.
      Specified by:
      getName in interface Named
      Returns:
      the name