Package xal.extension.solver
Class Solver
java.lang.Object
xal.extension.solver.Solver
- All Implemented Interfaces:
AlgorithmPoolListener
,AlgorithmMarketListener
Solver is the primary class for setting up and running an optimization.
- Author:
- ky6, t6p
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Problem
The problem to solveprotected AlgorithmSchedule
The schedule of algorithms to runprotected ScoreBoard
The score board for keeping track of the solver status -
Constructor Summary
ConstructorsConstructorDescriptionSolver
(SearchAlgorithm algorithm, Stopper stopper) Constructor using the specified stopper and only the specified algorithm.Solver
(SearchAlgorithm algorithm, Stopper stopper, SolutionJudge solutionJudge) Constructor using the specified stopper, solution judge and only the specified algorithm.Solver
(AlgorithmMarket market, Stopper stopper, SolutionJudge solutionJudge) Primary ConstructorConstructor using the default solution judge and the specified stopper.Solver
(Stopper stopper, SolutionJudge solutionJudge) Constructor using the specified stopper and solution judge. -
Method Summary
Modifier and TypeMethodDescriptionvoid
algorithmAdded
(AlgorithmPool source, SearchAlgorithm algorithm) Send a message that an algorithm. was added to the pool.void
algorithmAvailable
(AlgorithmPool source, SearchAlgorithm algorithm) Send a message that an algorithm is available.void
algorithmRemoved
(AlgorithmPool source, SearchAlgorithm algorithm) Send a message that an algorithm was removed from the pool.void
algorithmUnavailable
(AlgorithmPool source, SearchAlgorithm algorithm) Send a message that an algorithm is unavailable.Get the algorithm market.Get the algorithm pool.Get the algorithm schedule.Get the problem.Get the scoreboard that shows the present state of solving.Get the solution judge.protected void
Judge the specified trial.void
poolChanged
(AlgorithmMarket market, AlgorithmPool oldPool, AlgorithmPool newPool) Event indicating that the algorithm pool changed.void
recordEfficiency
(int evaluations) void
reset()
Reset the solver.void
setAlgorithmPool
(AlgorithmPool anAlgorithmPool) Set the algorithm pool.void
setProblem
(Problem problem) Set the problem.void
setSolutionJudge
(SolutionJudge solutionJudge) Set the solution judge.void
setStopper
(Stopper stopper) Set the stopper.void
Solve the problem.void
Stop the solver immediately.
-
Field Details
-
problem
The problem to solve -
scoreboard
The score board for keeping track of the solver status -
schedule
The schedule of algorithms to run
-
-
Constructor Details
-
Solver
Primary Constructor- Parameters:
stopper
- Determines when the solving is finishedsolutionJudge
- Decides if a solution is optimal.market
- The market of algorithms to use
-
Solver
Constructor using the specified stopper, solution judge and only the specified algorithm.- Parameters:
stopper
- Determines when the solving is finishedsolutionJudge
- Decides if a solution is optimal.algorithm
- The algorithm to use.
-
Solver
Constructor using the specified stopper and only the specified algorithm.- Parameters:
stopper
- Determines when the solving is finishedalgorithm
- The algorithm to use.
-
Solver
Constructor using the specified stopper and solution judge.- Parameters:
stopper
- Determines when the solving is finishedsolutionJudge
- Decides if a solution is optimal
-
Solver
Constructor using the default solution judge and the specified stopper.- Parameters:
stopper
- Determines when the solving is finished
-
-
Method Details
-
reset
public void reset()Reset the solver. -
solve
Solve the problem.- Parameters:
problem
- Description of the Parameter- Throws:
InvalidConfigurationException
- if the problem is ill defined
-
setProblem
Set the problem.- Parameters:
problem
- The new problem value
-
getProblem
Get the problem.- Returns:
- The problem.
-
stopSolving
public void stopSolving()Stop the solver immediately. -
setStopper
Set the stopper.- Parameters:
stopper
- The new stopper value
-
getSolutionJudge
Get the solution judge.- Returns:
- The solutionJudge value
-
setSolutionJudge
Set the solution judge.- Parameters:
solutionJudge
- The new solutionJudge value
-
getScoreBoard
Get the scoreboard that shows the present state of solving. It shows the best solution found so far and the time elapsed since solving started.- Returns:
- The scoreboard that shows the present state of solving.
-
judge
Judge the specified trial.- Parameters:
trial
- the trial to judge
-
getAlgorithmSchedule
Get the algorithm schedule.- Returns:
- The algorithm schedule.
-
setAlgorithmPool
Set the algorithm pool.- Parameters:
anAlgorithmPool
- The pool used to set the pool.
-
getAlgorithmPool
Get the algorithm pool.- Returns:
- The algorithm pool.
-
getAlgorithmMarket
Get the algorithm market.- Returns:
- The algorithm market.
-
algorithmAdded
Send a message that an algorithm. was added to the pool.- Specified by:
algorithmAdded
in interfaceAlgorithmPoolListener
- Parameters:
source
- The source of the added algorithm.algorithm
- Description of the Parameter
-
algorithmRemoved
Send a message that an algorithm was removed from the pool.- Specified by:
algorithmRemoved
in interfaceAlgorithmPoolListener
- Parameters:
source
- The source of the removed algorithm.algorithm
- Description of the Parameter
-
algorithmAvailable
Send a message that an algorithm is available.- Specified by:
algorithmAvailable
in interfaceAlgorithmPoolListener
- Parameters:
source
- The source of the available algorithm.algorithm
- Description of the Parameter
-
poolChanged
Event indicating that the algorithm pool changed.- Specified by:
poolChanged
in interfaceAlgorithmMarketListener
- Parameters:
market
- The market whose pool has changed.oldPool
- Description of the ParameternewPool
- Description of the Parameter
-
recordEfficiency
public void recordEfficiency(int evaluations)
-