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 TypeMethodDescriptionvoidaddScoreBoardListener(ScoreBoardListener listener) Add the specified listener as a receiver of ScoreBoard events from this instance.voidalgorithmRunExecuted(AlgorithmSchedule schedule, SearchAlgorithm algorithm, ScoreBoard scoreBoard) Handle an event where a new algorithm run stack has completed.voidalgorithmRunWillExecute(AlgorithmSchedule schedule, SearchAlgorithm algorithm, ScoreBoard scoreBoard) Handle an event where a new algorithm run stack will start.voidfoundNewOptimalSolution(SolutionJudge source, List<Trial> solutions, Trial solution) Send a message that a new optimal solution has been found.intGet the number of algorithm executionsGet the new solution.doubleGet the elapsed time.intGet the number of evaluations.get a copy of the evaluations for each algorithm executedintGet the number of optimal solutions found.doubleGet the satisfaction of the best trial pointGet the solution judge.intGet the number of vetoes.voidJudge the specified trial.voidrecordEfficiency(int evaluationsStep) Turns efficiencyLogger on with parametersvoidremoveScoreBoardListener(ScoreBoardListener listener) Remove the specified listener from receiving ScoreBoard events from this instance.voidreset()Reset the start time and the number of evaluations.voidsetSolutionJudge(SolutionJudge solutionJudge) Set the solution judge.toString()A string for displaying the ScoreBoard.voidtrialScored(AlgorithmSchedule algorithmSchedule, Trial trial) Send a message that a trial has been scored.voidtrialVetoed(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:
trialScoredin 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:
trialVetoedin 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:
algorithmRunWillExecutein 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:
algorithmRunExecutedin 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:
foundNewOptimalSolutionin 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
-