Class SolveStopperFactory

java.lang.Object
xal.extension.solver.SolveStopperFactory

public class SolveStopperFactory extends Object
SolverStopperFactory is an interface which generates a stopper. Stoppers stop the solver after the specified number of evaluations have been performed.
Author:
ky6, t6p
  • Method Details

    • immediateStopper

      public static Stopper immediateStopper()
      Stop the solver immediately.
      Returns:
      The stopper implementation.
    • maxEvaluationsStopper

      public static Stopper maxEvaluationsStopper(int maxEvaluations)
      Stop the solver after the solver reaches max evaluations (or algorithm executions to avoid a possible hang).
      Parameters:
      maxEvaluations - The maximum evaluations or algorithm executions to run the solver.
      Returns:
      The stopper implementation.
    • maxElapsedTimeStopper

      public static Stopper maxElapsedTimeStopper(double maxSeconds)
      Get a stopper after a certain number of seconds.
      Parameters:
      maxSeconds - The maximum number of seconds before getting the stopper.
      Returns:
      A stopper.
    • minSatisfactionStopper

      public static Stopper minSatisfactionStopper(double satisfactionTarget)
      Get a stopper that stops after the minimum satisfaction is achieved. This stopper should not be used alone since it may never stop if the satisfaction is unreachable.
      Parameters:
      satisfactionTarget - The satisfaction that must be reached by all objectives before stopping.
      Returns:
      A stopper.
    • maxEvaluationsSatisfactionStopper

      public static Stopper maxEvaluationsSatisfactionStopper(int maxEvaluations, double satisfactionTarget)
      Stop the solver after the solver reaches max evaluations (or algorithm executions to avoid a possible hang).
      Parameters:
      maxEvaluations - The maximum evaluations or algorithm executions to run the solver.
      satisfactionTarget - The satisfaction that must be reached by all objectives before stopping.
      Returns:
      The stopper implementation.
    • minMaxTimeSatisfactionStopper

      public static Stopper minMaxTimeSatisfactionStopper(double minSeconds, double maxSeconds, double satisfactionTarget)
      Get a stopper that runs between a minimum and maximum time and has a minimum satisfaction that all objectives must reach in order to stop short of the maximum time.
      Parameters:
      minSeconds - The mininum number of seconds before getting stopper.
      maxSeconds - The maximum number of seconds before getting stopper.
      satisfactionTarget - The satisfaction that must be reached by all objectives before stopping.
      Returns:
      A stopper.
    • flatOptimizationStopper

      public static Stopper flatOptimizationStopper(int minRepeatSolutions)
      Get a stopper that stops after the specified number of repeat solutions is found.
      Parameters:
      minRepeatSolutions - the number of repeat solutions to find before stopping
    • maxOptimalSolutionStopper

      public static Stopper maxOptimalSolutionStopper(int minOptimalSolutions)
      Get a stopper after the max number of optimal solutions is reached.
      Parameters:
      minOptimalSolutions - The minimum number of optimal solutions
      Returns:
      The maxOptimalSolutionStopper value
    • orStopper

      public static Stopper orStopper(Stopper stopper1, Stopper stopper2)
      Compound stopper which stops the solver if either stopper1 or stopper2 would stop it.
      Parameters:
      stopper1 - The first stopper to check
      stopper2 - The second stopper to check
      Returns:
      A compound stopper
    • orStoppers

      public static Stopper orStoppers(Stopper... stoppers)
      Compound stopper which stops the solver if any of the stoppers stop it.
      Parameters:
      stoppers - The stoppers to check
      Returns:
      A compound stopper
    • andStopper

      public static Stopper andStopper(Stopper stopper1, Stopper stopper2)
      Compound stopper which stops the solver if both stopper1 and stopper2 would stop it.
      Parameters:
      stopper1 - The first stopper to check
      stopper2 - The second stopper to check
      Returns:
      A compound stopper