Class MaxElapsedTime

java.lang.Object
org.moeaframework.core.termination.MaxElapsedTime
All Implemented Interfaces:
TerminationCondition

public class MaxElapsedTime extends Object implements TerminationCondition
Terminates a run when the maximum elapsed time is exceeded.
  • Constructor Details

    • MaxElapsedTime

      public MaxElapsedTime(long maxTime)
      Constructs a new termination condition based on the maximum elapsed time.
      Parameters:
      maxTime - the maximum elapsed time in milliseconds
    • MaxElapsedTime

      public MaxElapsedTime(Duration maxTime)
      Constructs a new termination condition based on the maximum elapsed time.
      Parameters:
      maxTime - the maximum elapsed time
  • Method Details

    • initialize

      public void initialize(Algorithm algorithm)
      Description copied from interface: TerminationCondition
      Invoked when the algorithm is created to collect any initial conditions. Note that the algorithm may not have been initialized at this point.
      Specified by:
      initialize in interface TerminationCondition
      Parameters:
      algorithm - the algorithm
    • shouldTerminate

      public boolean shouldTerminate(Algorithm algorithm)
      Description copied from interface: TerminationCondition
      Invoked after every step to check if the algorithm should terminate.
      Specified by:
      shouldTerminate in interface TerminationCondition
      Parameters:
      algorithm - the algorithm
      Returns:
      true if the algorithm should terminate; false otherwise