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 Details

    • ScoreBoard

      public ScoreBoard(SolutionJudge solutionJudge)
      Constructor
      Parameters:
      solutionJudge - the solution judge
  • Method Details

    • addScoreBoardListener

      public void addScoreBoardListener(ScoreBoardListener listener)
      Add the specified listener as a receiver of ScoreBoard events from this instance.
    • removeScoreBoardListener

      public void removeScoreBoardListener(ScoreBoardListener listener)
      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

      public void setSolutionJudge(SolutionJudge solutionJudge)
      Set the solution judge.
      Parameters:
      solutionJudge - The new solutionJudge value
    • getSolutionJudge

      public SolutionJudge 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

      public void judge(Trial trial)
      Judge the specified trial.
      Parameters:
      trial - the trial to judge
    • trialScored

      public void trialScored(AlgorithmSchedule algorithmSchedule, Trial trial)
      Send a message that a trial has been scored.
      Specified by:
      trialScored in interface AlgorithmScheduleListener
      Parameters:
      algorithmSchedule - The algorithm schedule that holds the trial scored.
      trial - The trial that was scored.
    • trialVetoed

      public void trialVetoed(AlgorithmSchedule algorithmSchedule, Trial trial)
      Send a message that a trial has been vetoed.
      Specified by:
      trialVetoed in interface AlgorithmScheduleListener
      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 interface AlgorithmScheduleListener
      Parameters:
      schedule - the schedule posting the event
      algorithm - the algorithm which will execute
      scoreBoard - 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 interface AlgorithmScheduleListener
      Parameters:
      schedule - the schedule posting the event
      algorithm - the algorithm that has executed
      scoreBoard - the scoreboard
    • foundNewOptimalSolution

      public void foundNewOptimalSolution(SolutionJudge source, List<Trial> solutions, Trial solution)
      Send a message that a new optimal solution has been found.
      Specified by:
      foundNewOptimalSolution in interface SolutionJudgeListener
      Parameters:
      source - The source of the new optimal solution.
      solutions - The list of solutions.
      solution - Description of the Parameter
    • getBestSolution

      public Trial getBestSolution()
      Get the new solution.
      Returns:
      The new solution.
    • toString

      public String toString()
      A string for displaying the ScoreBoard.
      Overrides:
      toString in class Object
      Returns:
      The string representation of the ScoreBoard.
    • getEvaluations

      public int getEvaluations()
      Get the number of evaluations.
      Returns:
      The number of evaluations.
    • getEvaluationsLog

      public Map<String,Integer> getEvaluationsLog()
      get a copy of the evaluations for each algorithm executed
    • recordEfficiency

      public void recordEfficiency(int evaluationsStep)
      Turns efficiencyLogger on with parameters