Class RandomSearch

java.lang.Object
xal.extension.solver.algorithm.SearchAlgorithm
xal.extension.solver.algorithm.RandomSearch
All Implemented Interfaces:
AlgorithmScheduleListener, SolutionJudgeListener

public class RandomSearch extends SearchAlgorithm
RandomSearch returns a random trial point that lies within the bounds specified by the variables.
Author:
ky6
  • Constructor Details

    • RandomSearch

      public RandomSearch()
      Creates a new instance of RandomSearch
  • Method Details

    • getLabel

      public String getLabel()
      Return the label for a search algorithm.
      Specified by:
      getLabel in class SearchAlgorithm
      Returns:
      The trial point.
    • performRun

      public void performRun(AlgorithmSchedule algorithmSchedule)
      Calculate the next few trial points.
      Specified by:
      performRun in class SearchAlgorithm
    • nextTrialPoint

      public TrialPoint nextTrialPoint()
      Return the next trial point.
      Returns:
      trialPoint
    • globalRating

      public int globalRating()
      Returns the global rating which in an integer between 0 and 10.
      Returns:
      The global rating for this algorithm.
    • localRating

      public int localRating()
      Returns the local rating which is an integer between 0 and 10.
      Returns:
      The local rating for this algorithm.
    • algorithmAvailable

      public void algorithmAvailable(SearchAlgorithm source)
      Handle a message that an algorithm is available.
      Parameters:
      source - The source of the available algorithm.
    • algorithmUnavailable

      public void algorithmUnavailable(SearchAlgorithm source)
      Handle a message that an algorithm is not available.
      Parameters:
      source - The source of the available algorithm.
    • trialScored

      public void trialScored(AlgorithmSchedule schedule, Trial trial)
      Handle a message that a trial has been scored.
      Specified by:
      trialScored in interface AlgorithmScheduleListener
      Overrides:
      trialScored in class SearchAlgorithm
      Parameters:
      trial - The trial that was scored.
      schedule - the schedule providing this event
    • trialVetoed

      public void trialVetoed(AlgorithmSchedule schedule, Trial trial)
      Handle a message that a trial has been vetoed.
      Specified by:
      trialVetoed in interface AlgorithmScheduleListener
      Overrides:
      trialVetoed in class SearchAlgorithm
      Parameters:
      trial - The trial that was vetoed.
      schedule - the schedule providing this event
    • foundNewOptimalSolution

      public void foundNewOptimalSolution(SolutionJudge source, List<Trial> solutions, Trial solution)
      Handle a message that a new optimal solution has been found.
      Specified by:
      foundNewOptimalSolution in interface SolutionJudgeListener
      Overrides:
      foundNewOptimalSolution in class SearchAlgorithm
      Parameters:
      source - The source of the new optimal solution.
      solutions - The list of solutions.
      solution - The new optimal solution.