Package xal.extension.solver
Class AlgorithmSchedule
java.lang.Object
xal.extension.solver.AlgorithmSchedule
AlgorithmSchedule keeps track of and executes the next algorithm based on its
score. Schedule also sets a trial and a stopper.
- Author:
- ky6, t6p
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmSchedule
(Solver solver, AlgorithmMarket market, Stopper stopper) Creates a new instance of Schedule. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an algorithm schedule listener.evaluateTrialPoint
(SearchAlgorithm searchAlgorithm, TrialPoint trialPoint) Evaluate the specified trial point or return null if the run has been terminated.void
execute()
Execute the search schedule.Get the algorithm market.get the score boardGet the stopper.void
Remove an algorithm schedule listener.void
reset()
Reset the algorithm run stack.void
setProblem
(Problem problem) Assign a new problem.void
setStopper
(Stopper stopper) Assign a new stopper.boolean
Determine whether to continue executing the schedule.boolean
Allows the algorithms to check when they should stop executing their code
-
Field Details
-
stopper
determines when to stop the trials -
problem
the problem to solve -
market
the market of algorithm runs -
solver
the solver running the schedule
-
-
Constructor Details
-
AlgorithmSchedule
Creates a new instance of Schedule.- Parameters:
solver
- The solvermarket
- The market providing runs.stopper
- The stopper which can terminate the schedule.
-
-
Method Details
-
reset
public void reset()Reset the algorithm run stack. -
addAlgorithmScheduleListener
Add an algorithm schedule listener.- Parameters:
aListener
- The listener to add.
-
removeAlgorithmScheduleListener
Remove an algorithm schedule listener.- Parameters:
aListener
- The listener to remove.
-
getMarket
Get the algorithm market.- Returns:
- the algorithm market
-
getScoreBoard
get the score board -
setProblem
Assign a new problem.- Parameters:
problem
- the new problem
-
getStopper
Get the stopper.- Returns:
- the stopper
-
setStopper
Assign a new stopper.- Parameters:
stopper
- the new stopper
-
shouldExecute
public boolean shouldExecute()Determine whether to continue executing the schedule.- Returns:
- true if the stopper allows us to continue executing the schedule and false if not
-
shouldStop
public boolean shouldStop()Allows the algorithms to check when they should stop executing their code -
execute
public void execute()Execute the search schedule. -
evaluateTrialPoint
Evaluate the specified trial point or return null if the run has been terminated.- Parameters:
trialPoint
- the trial point to evaluate- Returns:
- a scored trial corresponding to the specified trial point
- Throws:
RunTerminationException
- if the run has been terminated
-