Package xal.extension.solver
Class SolveStopperFactory
java.lang.Object
xal.extension.solver.SolveStopperFactory
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 Summary
Modifier and TypeMethodDescriptionstatic Stopper
andStopper
(Stopper stopper1, Stopper stopper2) Compound stopper which stops the solver if both stopper1 and stopper2 would stop it.static Stopper
flatOptimizationStopper
(int minRepeatSolutions) Get a stopper that stops after the specified number of repeat solutions is found.static Stopper
Stop the solver immediately.static Stopper
maxElapsedTimeStopper
(double maxSeconds) Get a stopper after a certain number of seconds.static Stopper
maxEvaluationsSatisfactionStopper
(int maxEvaluations, double satisfactionTarget) Stop the solver after the solver reaches max evaluations (or algorithm executions to avoid a possible hang).static Stopper
maxEvaluationsStopper
(int maxEvaluations) Stop the solver after the solver reaches max evaluations (or algorithm executions to avoid a possible hang).static Stopper
maxOptimalSolutionStopper
(int minOptimalSolutions) Get a stopper after the max number of optimal solutions is reached.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.static Stopper
minSatisfactionStopper
(double satisfactionTarget) Get a stopper that stops after the minimum satisfaction is achieved.static Stopper
Compound stopper which stops the solver if either stopper1 or stopper2 would stop it.static Stopper
orStoppers
(Stopper... stoppers) Compound stopper which stops the solver if any of the stoppers stop it.
-
Method Details
-
immediateStopper
Stop the solver immediately.- Returns:
- The stopper implementation.
-
maxEvaluationsStopper
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
Get a stopper after a certain number of seconds.- Parameters:
maxSeconds
- The maximum number of seconds before getting the stopper.- Returns:
- A stopper.
-
minSatisfactionStopper
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
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
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
Compound stopper which stops the solver if either stopper1 or stopper2 would stop it.- Parameters:
stopper1
- The first stopper to checkstopper2
- The second stopper to check- Returns:
- A compound stopper
-
orStoppers
Compound stopper which stops the solver if any of the stoppers stop it.- Parameters:
stoppers
- The stoppers to check- Returns:
- A compound stopper
-
andStopper
Compound stopper which stops the solver if both stopper1 and stopper2 would stop it.- Parameters:
stopper1
- The first stopper to checkstopper2
- The second stopper to check- Returns:
- A compound stopper
-