public abstract class SearchAlgorithm extends java.lang.Object implements AlgorithmScheduleListener, SolutionJudgeListener
Modifier and Type | Field and Description |
---|---|
protected SearchAlgorithmListener |
_eventProxy
the proxy for forwarding messages to registered listeners
|
protected MessageCenter |
_messageCenter
the message center for dispatching messages
|
protected Problem |
_problem
the problem to solve
|
Constructor and Description |
---|
SearchAlgorithm()
Empty constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addSearchAlgorithmListener(SearchAlgorithmListener listener)
Add a search algorithm listener.
|
void |
foundNewOptimalSolution(SolutionJudge source,
java.util.List<Trial> solutions,
Trial solution)
Send a message that a new optimal solution has been found.
|
abstract java.lang.String |
getLabel()
Get the label for this search algorithm.
|
int |
getMaxEvaluationsPerRun()
Get the maximum number of evaluations per run.
|
int |
getMinEvaluationsPerRun()
Get the minimum number of evaluations per run.
|
abstract void |
performRun(AlgorithmRun algorithmRun)
Calculate the next few trial points.
|
void |
removeSearchAlgorithmListener(SearchAlgorithmListener listener)
Remove a search algorithm listener.
|
void |
reset()
Reset this algorithm.
|
void |
setProblem(Problem problem)
Assign a new problem.
|
void |
strategyExecuted(AlgorithmSchedule schedule,
AlgorithmStrategy strategy,
ScoreBoard scoreBoard)
Handle an event where a new algorithm run stack has completed.
|
void |
strategyWillExecute(AlgorithmSchedule schedule,
AlgorithmStrategy strategy,
ScoreBoard scoreBoard)
Handle an event where a new algorithm run stack will start.
|
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.
|
protected Problem _problem
protected MessageCenter _messageCenter
protected SearchAlgorithmListener _eventProxy
public void setProblem(Problem problem)
public void reset()
public void addSearchAlgorithmListener(SearchAlgorithmListener listener)
listener
- The listener to add.public void removeSearchAlgorithmListener(SearchAlgorithmListener listener)
listener
- The listener to remove.public abstract java.lang.String getLabel()
public abstract void performRun(AlgorithmRun algorithmRun)
algorithmRun
- the algorithm run to perform the evaluationpublic int getMinEvaluationsPerRun()
public int getMaxEvaluationsPerRun()
public void trialScored(AlgorithmSchedule schedule, Trial trial)
trialScored
in interface AlgorithmScheduleListener
schedule
- Description of the Parametertrial
- Description of the Parameterpublic void trialVetoed(AlgorithmSchedule schedule, Trial trial)
trialVetoed
in interface AlgorithmScheduleListener
schedule
- Description of the Parametertrial
- Description of the Parameterpublic void strategyWillExecute(AlgorithmSchedule schedule, AlgorithmStrategy strategy, ScoreBoard scoreBoard)
strategyWillExecute
in interface AlgorithmScheduleListener
schedule
- the schedule posting the eventstrategy
- the strategy which will executescoreBoard
- the scoreboardpublic void strategyExecuted(AlgorithmSchedule schedule, AlgorithmStrategy strategy, ScoreBoard scoreBoard)
strategyExecuted
in interface AlgorithmScheduleListener
schedule
- the schedule posting the eventstrategy
- the strategy that has executedscoreBoard
- the scoreboardpublic void foundNewOptimalSolution(SolutionJudge source, java.util.List<Trial> solutions, Trial solution)
foundNewOptimalSolution
in interface SolutionJudgeListener
source
- The source of the new optimal solution.solutions
- The list of solutions.solution
- The new optimal solution.