public class Solver extends java.lang.Object implements AlgorithmPoolListener, AlgorithmMarketListener
Modifier and Type | Field and Description |
---|---|
protected Problem |
_problem
The problem to solve
|
protected AlgorithmSchedule |
_schedule
The schedule of algorithms to run
|
protected ScoreBoard |
_scoreboard
The score board for keeping track of the solver status
|
Constructor and Description |
---|
Solver(AlgorithmMarket market,
Stopper stopper,
SolutionJudge solutionJudge)
Primary Constructor
|
Solver(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(Stopper stopper)
Constructor using the default solution judge and the specified stopper.
|
Solver(Stopper stopper,
SolutionJudge solutionJudge)
Constructor using the specified stopper and solution judge.
|
Modifier and Type | Method and Description |
---|---|
void |
algorithmAdded(AlgorithmPool source,
SearchAlgorithm algorithm)
Send a message that an algorithm.
|
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 unvavailable.
|
AlgorithmMarket |
getAlgorithmMarket()
Get the algorithm market.
|
AlgorithmPool |
getAlgorithmPool()
Get the algorithm pool.
|
AlgorithmSchedule |
getAlgorithmSchedule()
Get the algorithm schedule.
|
Problem |
getProblem()
Get the problem.
|
ScoreBoard |
getScoreBoard()
Get the scoreboard that shows the present state of solving.
|
SolutionJudge |
getSolutionJudge()
Get the solution judge.
|
protected void |
judge(Trial trial)
Judge the specified trial.
|
void |
poolChanged(AlgorithmMarket market,
AlgorithmPool oldPool,
AlgorithmPool newPool)
Event indicating that the algorithm pool changed.
|
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(Problem problem)
Solve the problem.
|
void |
stopSolving()
Stop the solver immediately.
|
protected Problem _problem
protected ScoreBoard _scoreboard
protected AlgorithmSchedule _schedule
public Solver(AlgorithmMarket market, Stopper stopper, SolutionJudge solutionJudge)
stopper
- Determines when the solving is finishedsolutionJudge
- Decides if a solution is optimal.market
- The market of algorithms and strategies to use.public Solver(SearchAlgorithm algorithm, Stopper stopper, SolutionJudge solutionJudge)
stopper
- Determines when the solving is finishedsolutionJudge
- Decides if a solution is optimal.algorithm
- The algorithm to use.public Solver(SearchAlgorithm algorithm, Stopper stopper)
stopper
- Determines when the solving is finishedalgorithm
- The algorithm to use.public Solver(Stopper stopper, SolutionJudge solutionJudge)
stopper
- Determines when the solving is finishedsolutionJudge
- Decides if a solution is optimalpublic Solver(Stopper stopper)
stopper
- Determines when the solving is finishedpublic void reset()
public void solve(Problem problem) throws InvalidConfigurationException
problem
- Description of the ParameterInvalidConfigurationException
- if the problem is ill definedpublic void setProblem(Problem problem)
problem
- The new problem valuepublic Problem getProblem()
public void stopSolving()
public void setStopper(Stopper stopper)
stopper
- The new stopper valuepublic SolutionJudge getSolutionJudge()
public void setSolutionJudge(SolutionJudge solutionJudge)
solutionJudge
- The new solutionJudge valuepublic ScoreBoard getScoreBoard()
protected void judge(Trial trial)
trial
- the trial to judgepublic AlgorithmSchedule getAlgorithmSchedule()
public void setAlgorithmPool(AlgorithmPool anAlgorithmPool)
anAlgorithmPool
- The pool used to set the pool.public AlgorithmPool getAlgorithmPool()
public AlgorithmMarket getAlgorithmMarket()
public void algorithmAdded(AlgorithmPool source, SearchAlgorithm algorithm)
algorithmAdded
in interface AlgorithmPoolListener
source
- The source of the added algorithm.algorithm
- Description of the Parameterpublic void algorithmRemoved(AlgorithmPool source, SearchAlgorithm algorithm)
algorithmRemoved
in interface AlgorithmPoolListener
source
- The source of the removed algorithm.algorithm
- Description of the Parameterpublic void algorithmAvailable(AlgorithmPool source, SearchAlgorithm algorithm)
algorithmAvailable
in interface AlgorithmPoolListener
source
- The source of the available algorithm.algorithm
- Description of the Parameterpublic void algorithmUnavailable(AlgorithmPool source, SearchAlgorithm algorithm)
algorithmUnavailable
in interface AlgorithmPoolListener
source
- The source of the unavailable algorithm.algorithm
- Description of the Parameterpublic void poolChanged(AlgorithmMarket market, AlgorithmPool oldPool, AlgorithmPool newPool)
poolChanged
in interface AlgorithmMarketListener
market
- The market whose pool has changed.oldPool
- Description of the ParameternewPool
- Description of the Parameter