Class RandomShrinkSearch

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

public class RandomShrinkSearch extends SearchAlgorithm
RandomSearchAlgorithm looks for points bounded by the specified variable limits. Every iteration a subset of variables are randomly chosen to be changed. The value chosen for each variable is randomly selected from a uniform distribution within a window for that variable. The window begins as the full limit range allowed by the variable. Whenever a better solution is found, the window changes so that it is three times wider than the distance between the last best point and the new best point. The window gets centered around the new best points. Then the window gets clipped as necessary to satisfy the variable limits. Note that the window may grow or shrink depending on the distance between successive top points. As the optimal solution is approached, the window should tend to shrink around the optimal point. Note that each variable has its own window and the window automatically adjusts to the variable according to the progress.
Author:
t6p
  • Field Details

    • bestPoint

      protected TrialPoint bestPoint
      The current best point.
    • searcher

      protected RandomShrinkSearch.Searcher searcher
      The active search technique (random or shrink).
    • bestSatisfaction

      protected double bestSatisfaction
      keeps track of internal best Satisfaction
    • isLastEvaluation

      protected boolean isLastEvaluation
      keeps track if the last run is being executed
  • Constructor Details

    • RandomShrinkSearch

      public RandomShrinkSearch()
  • Method Details

    • getLabel

      public String getLabel()
      Get the label for this search algorithm.
      Specified by:
      getLabel in class SearchAlgorithm
      Returns:
      The label for this algorithm
    • reset

      public void reset()
      reset for searching from scratch; forget history
      Overrides:
      reset in class SearchAlgorithm
    • resetBestPoint

      protected void resetBestPoint()
      Reset the trial point's variables to their starting values.
    • performRun

      public void performRun(AlgorithmSchedule algorithmSchedule)
      Calculate the next few trial points.
      Specified by:
      performRun in class SearchAlgorithm
      Parameters:
      algorithmSchedule - the algorithm run to perform the evaluation
    • nextTrialPoint

      public TrialPoint nextTrialPoint()
      Calculate and get the next trial point to evaluate.
      Returns:
      The next trial point to evaluate.
    • globalRating

      public int globalRating()
      Get the rating for this algorithm which in an integer between 0 and 10 and indicates how well this algorithm performs on global searches.
      Returns:
      The global search rating for this algorithm.
    • localRating

      public int localRating()
      Get the rating for this algorithm which in an integer between 0 and 10 and indicates how well this algorithm performs on local searches.
      Returns:
      The local search 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:
      schedule - Description of the Parameter
      trial - Description of the Parameter This is for operating this algorithm completely independently of any other algorithm
    • 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.