public class RandomSearch extends SearchAlgorithm
Modifier and Type | Field and Description |
---|---|
protected java.util.Random |
_randomGenerator
random number generator
|
_eventProxy, _messageCenter, _problem
Constructor and Description |
---|
RandomSearch()
Creates a new instance of RandomSearch
|
Modifier and Type | Method and Description |
---|---|
void |
algorithmAvailable(SearchAlgorithm source)
Handle a message that an algorithm is available.
|
void |
algorithmUnavailable(SearchAlgorithm source)
Handle a message that an algorithm is not available.
|
void |
foundNewOptimalSolution(SolutionJudge source,
java.util.List<Trial> solutions,
Trial solution)
Handle a message that a new optimal solution has been found.
|
java.lang.String |
getLabel()
Return the label for a search algorithm.
|
int |
globalRating()
Returns the global rating which in an integer between 0 and 10.
|
int |
localRating()
Returns the local rating which is an integer between 0 and 10.
|
TrialPoint |
nextTrialPoint()
Return the next trial point.
|
void |
performRun(AlgorithmRun algorithmRun)
Calculate the next few trial points.
|
void |
trialScored(AlgorithmSchedule schedule,
Trial trial)
Handle a message that a trial has been scored.
|
void |
trialVetoed(AlgorithmSchedule schedule,
Trial trial)
Handle a message that a trial has been vetoed.
|
addSearchAlgorithmListener, getMaxEvaluationsPerRun, getMinEvaluationsPerRun, removeSearchAlgorithmListener, reset, setProblem, strategyExecuted, strategyWillExecute
public java.lang.String getLabel()
getLabel
in class SearchAlgorithm
public void performRun(AlgorithmRun algorithmRun)
performRun
in class SearchAlgorithm
algorithmRun
- the algorithm run to perform the evaluationpublic TrialPoint nextTrialPoint()
public int globalRating()
public int localRating()
public void algorithmAvailable(SearchAlgorithm source)
source
- The source of the available algorithm.public void algorithmUnavailable(SearchAlgorithm source)
source
- The source of the available algorithm.public void trialScored(AlgorithmSchedule schedule, Trial trial)
trialScored
in interface AlgorithmScheduleListener
trialScored
in class SearchAlgorithm
trial
- The trial that was scored.schedule
- the schedule providing this eventpublic void trialVetoed(AlgorithmSchedule schedule, Trial trial)
trialVetoed
in interface AlgorithmScheduleListener
trialVetoed
in class SearchAlgorithm
trial
- The trial that was vetoed.schedule
- the schedule providing this eventpublic void foundNewOptimalSolution(SolutionJudge source, java.util.List<Trial> solutions, Trial solution)
foundNewOptimalSolution
in interface SolutionJudgeListener
foundNewOptimalSolution
in class SearchAlgorithm
source
- The source of the new optimal solution.solutions
- The list of solutions.solution
- The new optimal solution.