Package xal.extension.solver
Class ScoreBoard
java.lang.Object
xal.extension.solver.ScoreBoard
- All Implemented Interfaces:
AlgorithmScheduleListener
,SolutionJudgeListener
public final class ScoreBoard
extends Object
implements AlgorithmScheduleListener, SolutionJudgeListener
Scoreboard maintains the status of the solver including the clock and the
best solution found so far.
- Author:
- ky6, t6p
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addScoreBoardListener
(ScoreBoardListener listener) Add the specified listener as a receiver of ScoreBoard events from this instance.void
algorithmRunExecuted
(AlgorithmSchedule schedule, SearchAlgorithm algorithm, ScoreBoard scoreBoard) Handle an event where a new algorithm run stack has completed.void
algorithmRunWillExecute
(AlgorithmSchedule schedule, SearchAlgorithm algorithm, ScoreBoard scoreBoard) Handle an event where a new algorithm run stack will start.void
foundNewOptimalSolution
(SolutionJudge source, List<Trial> solutions, Trial solution) Send a message that a new optimal solution has been found.int
Get the number of algorithm executionsGet the new solution.double
Get the elapsed time.int
Get the number of evaluations.get a copy of the evaluations for each algorithm executedint
Get the number of optimal solutions found.double
Get the satisfaction of the best trial pointGet the solution judge.int
Get the number of vetoes.void
Judge the specified trial.void
recordEfficiency
(int evaluationsStep) Turns efficiencyLogger on with parametersvoid
removeScoreBoardListener
(ScoreBoardListener listener) Remove the specified listener from receiving ScoreBoard events from this instance.void
reset()
Reset the start time and the number of evaluations.void
setSolutionJudge
(SolutionJudge solutionJudge) Set the solution judge.toString()
A string for displaying the ScoreBoard.void
trialScored
(AlgorithmSchedule algorithmSchedule, Trial trial) Send a message that a trial has been scored.void
trialVetoed
(AlgorithmSchedule algorithmSchedule, Trial trial) Send a message that a trial has been vetoed.
-
Constructor Details
-
ScoreBoard
Constructor- Parameters:
solutionJudge
- the solution judge
-
-
Method Details
-
addScoreBoardListener
Add the specified listener as a receiver of ScoreBoard events from this instance. -
removeScoreBoardListener
Remove the specified listener from receiving ScoreBoard events from this instance. -
reset
public void reset()Reset the start time and the number of evaluations. -
setSolutionJudge
Set the solution judge.- Parameters:
solutionJudge
- The new solutionJudge value
-
getSolutionJudge
Get the solution judge.- Returns:
- The solution judge.
-
getSatisfaction
public double getSatisfaction()Get the satisfaction of the best trial point -
getAlgorithmExecutions
public int getAlgorithmExecutions()Get the number of algorithm executions- Returns:
- number of algorithm executions
-
getVetoes
public int getVetoes()Get the number of vetoes.- Returns:
- The number of vetoes made.
-
getOptimalSolutionsFound
public int getOptimalSolutionsFound()Get the number of optimal solutions found.- Returns:
- The number of optimal solutions found.
-
getElapsedTime
public double getElapsedTime()Get the elapsed time.- Returns:
- elapsed time in seconds.
-
judge
Judge the specified trial.- Parameters:
trial
- the trial to judge
-
trialScored
Send a message that a trial has been scored.- Specified by:
trialScored
in interfaceAlgorithmScheduleListener
- Parameters:
algorithmSchedule
- The algorithm schedule that holds the trial scored.trial
- The trial that was scored.
-
trialVetoed
Send a message that a trial has been vetoed.- Specified by:
trialVetoed
in interfaceAlgorithmScheduleListener
- Parameters:
algorithmSchedule
- The algorithm schedule that holds the trial vetoed.trial
- The trial that was vetoed.
-
algorithmRunWillExecute
public void algorithmRunWillExecute(AlgorithmSchedule schedule, SearchAlgorithm algorithm, ScoreBoard scoreBoard) Handle an event where a new algorithm run stack will start.- Specified by:
algorithmRunWillExecute
in interfaceAlgorithmScheduleListener
- Parameters:
schedule
- the schedule posting the eventalgorithm
- the algorithm which will executescoreBoard
- the scoreboard
-
algorithmRunExecuted
public void algorithmRunExecuted(AlgorithmSchedule schedule, SearchAlgorithm algorithm, ScoreBoard scoreBoard) Handle an event where a new algorithm run stack has completed.- Specified by:
algorithmRunExecuted
in interfaceAlgorithmScheduleListener
- Parameters:
schedule
- the schedule posting the eventalgorithm
- the algorithm that has executedscoreBoard
- the scoreboard
-
foundNewOptimalSolution
Send a message that a new optimal solution has been found.- Specified by:
foundNewOptimalSolution
in interfaceSolutionJudgeListener
- Parameters:
source
- The source of the new optimal solution.solutions
- The list of solutions.solution
- Description of the Parameter
-
getBestSolution
Get the new solution.- Returns:
- The new solution.
-
toString
A string for displaying the ScoreBoard. -
getEvaluations
public int getEvaluations()Get the number of evaluations.- Returns:
- The number of evaluations.
-
getEvaluationsLog
get a copy of the evaluations for each algorithm executed -
recordEfficiency
public void recordEfficiency(int evaluationsStep) Turns efficiencyLogger on with parameters
-