Package xal.extension.solver.algorithm
Class RandomSearch
java.lang.Object
xal.extension.solver.algorithm.SearchAlgorithm
xal.extension.solver.algorithm.RandomSearch
- All Implemented Interfaces:
AlgorithmScheduleListener,SolutionJudgeListener
RandomSearch returns a random trial point that lies within the bounds
specified by the variables.
- Author:
- ky6
-
Field Summary
Fields inherited from class xal.extension.solver.algorithm.SearchAlgorithm
EFFICIENCY_COMPARATOR, problem -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidalgorithmAvailable(SearchAlgorithm source) Handle a message that an algorithm is available.voidalgorithmUnavailable(SearchAlgorithm source) Handle a message that an algorithm is not available.voidfoundNewOptimalSolution(SolutionJudge source, List<Trial> solutions, Trial solution) Handle a message that a new optimal solution has been found.getLabel()Return the label for a search algorithm.intReturns the global rating which in an integer between 0 and 10.intReturns the local rating which is an integer between 0 and 10.Return the next trial point.voidperformRun(AlgorithmSchedule algorithmSchedule) Calculate the next few trial points.voidtrialScored(AlgorithmSchedule schedule, Trial trial) Handle a message that a trial has been scored.voidtrialVetoed(AlgorithmSchedule schedule, Trial trial) Handle a message that a trial has been vetoed.Methods inherited from class xal.extension.solver.algorithm.SearchAlgorithm
addSearchAlgorithmListener, algorithmRunExecuted, algorithmRunWillExecute, evaluateTrialPoint, executeRun, getEfficiency, getEvaluationsLeft, getMaxEvaluationsPerRun, getMinEvaluationsPerRun, removeSearchAlgorithmListener, reset, setProblem, setProposedEvaluations
-
Constructor Details
-
RandomSearch
public RandomSearch()Creates a new instance of RandomSearch
-
-
Method Details
-
getLabel
Return the label for a search algorithm.- Specified by:
getLabelin classSearchAlgorithm- Returns:
- The trial point.
-
performRun
Calculate the next few trial points.- Specified by:
performRunin classSearchAlgorithm
-
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
Handle a message that an algorithm is available.- Parameters:
source- The source of the available algorithm.
-
trialScored
Handle a message that a trial has been scored.- Specified by:
trialScoredin interfaceAlgorithmScheduleListener- Overrides:
trialScoredin classSearchAlgorithm- Parameters:
trial- The trial that was scored.schedule- the schedule providing this event
-
trialVetoed
Handle a message that a trial has been vetoed.- Specified by:
trialVetoedin interfaceAlgorithmScheduleListener- Overrides:
trialVetoedin classSearchAlgorithm- Parameters:
trial- The trial that was vetoed.schedule- the schedule providing this event
-
foundNewOptimalSolution
Handle a message that a new optimal solution has been found.- Specified by:
foundNewOptimalSolutionin interfaceSolutionJudgeListener- Overrides:
foundNewOptimalSolutionin classSearchAlgorithm- Parameters:
source- The source of the new optimal solution.solutions- The list of solutions.solution- The new optimal solution.
-