public class ScoreBoard extends java.lang.Object implements AlgorithmScheduleListener, SolutionJudgeListener
Modifier and Type | Field and Description |
---|---|
protected Trial |
_bestSolution
the best solution found
|
protected int |
_evaluations
the number of evaluations performed
|
protected ScoreBoardListener |
_eventProxy
proxy which forwards events to registerd listeners
|
protected MessageCenter |
_messageCenter
center for broadcasting events
|
protected int |
_optimalSolutionsFound
the number of times an optimal soluition was found
|
protected SolutionJudge |
_solutionJudge
the solution judge
|
protected java.util.Date |
_startTime
time when the solver started
|
protected int |
_vetoes
the number of evaluations that have been vetoed
|
Constructor and Description |
---|
ScoreBoard(SolutionJudge solutionJudge)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addScoreBoardListener(ScoreBoardListener listener)
Add the specified listener as a receiver of ScoreBoard events from this instance.
|
void |
foundNewOptimalSolution(SolutionJudge source,
java.util.List<Trial> solutions,
Trial solution)
Send a message that a new optimal solution has been found.
|
Trial |
getBestSolution()
Get the new solution.
|
double |
getElapsedTime()
Get the elapsed time.
|
int |
getEvaluations()
Get the number of evaluations.
|
int |
getOptimalSolutionsFound()
Get the number of optimal solutions found.
|
SolutionJudge |
getSolutionJudge()
Get the solution judge.
|
int |
getStrategyExecutions()
Get the number of strategy executions
|
int |
getVetoes()
Get the number of vetoes.
|
void |
judge(Trial trial)
Judge the specified trial.
|
void |
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.
|
void |
strategyExecuted(AlgorithmSchedule schedule,
AlgorithmStrategy strategy,
ScoreBoard scoreBoard)
Handle an event where a new algorithm run stack has completed.
|
void |
strategyWillExecute(AlgorithmSchedule schedule,
AlgorithmStrategy strategy,
ScoreBoard scoreBoard)
Handle an event where a new algorithm run stack will start.
|
java.lang.String |
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.
|
protected final MessageCenter _messageCenter
protected final ScoreBoardListener _eventProxy
protected java.util.Date _startTime
protected Trial _bestSolution
protected SolutionJudge _solutionJudge
protected int _evaluations
protected int _vetoes
protected int _optimalSolutionsFound
public ScoreBoard(SolutionJudge solutionJudge)
solutionJudge
- the solution judgepublic void addScoreBoardListener(ScoreBoardListener listener)
public void removeScoreBoardListener(ScoreBoardListener listener)
public void reset()
public void setSolutionJudge(SolutionJudge solutionJudge)
solutionJudge
- The new solutionJudge valuepublic SolutionJudge getSolutionJudge()
public int getEvaluations()
public int getStrategyExecutions()
public int getVetoes()
public int getOptimalSolutionsFound()
public double getElapsedTime()
public void judge(Trial trial)
trial
- the trial to judgepublic void trialScored(AlgorithmSchedule algorithmSchedule, Trial trial)
trialScored
in interface AlgorithmScheduleListener
algorithmSchedule
- The algorithm schedule that holds the trial scored.trial
- The trial that was scored.public void trialVetoed(AlgorithmSchedule algorithmSchedule, Trial trial)
trialVetoed
in interface AlgorithmScheduleListener
algorithmSchedule
- The algorithm schedule that holds the trial vetoed.trial
- The trial that was vetoed.public void strategyWillExecute(AlgorithmSchedule schedule, AlgorithmStrategy strategy, ScoreBoard scoreBoard)
strategyWillExecute
in interface AlgorithmScheduleListener
schedule
- the schedule posting the eventstrategy
- the strategy which will executescoreBoard
- the scoreboardpublic void strategyExecuted(AlgorithmSchedule schedule, AlgorithmStrategy strategy, ScoreBoard scoreBoard)
strategyExecuted
in interface AlgorithmScheduleListener
schedule
- the schedule posting the eventstrategy
- the strategy that has executedscoreBoard
- the scoreboardpublic void foundNewOptimalSolution(SolutionJudge source, java.util.List<Trial> solutions, Trial solution)
foundNewOptimalSolution
in interface SolutionJudgeListener
source
- The source of the new optimal solution.solutions
- The list of solutions.solution
- Description of the Parameterpublic Trial getBestSolution()
public java.lang.String toString()
toString
in class java.lang.Object