public class AlgorithmPool extends java.lang.Object implements SearchAlgorithmListener, SolutionJudgeListener, AlgorithmScheduleListener
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Collection<SearchAlgorithm> |
_algorithms
The list of all algorithms
|
protected java.util.Collection<SearchAlgorithm> |
_availableAlgorithms
The list of algorithms available for scheduling
|
protected MessageCenter |
_messageCenter
Message center for dispatching events to registerd listeners
|
protected AlgorithmPoolListener |
_proxy
Proxy which forwards events to registered listeners
|
| Constructor and Description |
|---|
AlgorithmPool()
Empty constructor which populates the pool of all algorithms
|
AlgorithmPool(java.util.Collection<SearchAlgorithm> algorithms)
Creates a new AlgorithmPool instance Constructor that takes a list of algorithms
|
AlgorithmPool(SearchAlgorithm algorithm)
Creates a new AlgorithmPool instance Constructor that takes a list of algorithms
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAlgorithm(SearchAlgorithm algorithm)
Add an algorithm to the pool.
|
void |
addAlgorithmPoolListener(AlgorithmPoolListener listener)
Add an algorithm pool listener.
|
void |
addAlgorithms(java.util.Collection<SearchAlgorithm> algorithms)
Add existing algorithms to the algorithm list.
|
void |
algorithmAvailable(SearchAlgorithm source)
Send a message that an algorithm is available.
|
void |
algorithmUnavailable(SearchAlgorithm source)
Send a message that an algorithm is not available.
|
void |
foundNewOptimalSolution(SolutionJudge source,
java.util.List<Trial> solutions,
Trial solution)
Event indicating that a new optimal solution has been found.
|
static java.util.Collection<SearchAlgorithm> |
generateDefaultAlgorithms()
Get all the algorithms.
|
java.util.Collection<SearchAlgorithm> |
getAlgorithms()
Get the algorithm list.
|
java.util.Collection<SearchAlgorithm> |
getAvailableAlgorithms()
Get the available algorithms.
|
void |
removeAlgorithm(SearchAlgorithm algorithm)
Remove an algorithm from the pool.
|
void |
removeAlgorithmPoolListener(AlgorithmPoolListener listener)
Remove a algorithm pool listener.
|
void |
removeAlgorithms(java.util.Collection<SearchAlgorithm> algorithms)
Remove the specified algorithms.
|
void |
removeAllAlgorithms()
Remove all algorithms.
|
void |
reset()
Reset the algorithm pool by resetting all the algorithms.
|
void |
setAlgorithm(SearchAlgorithm algorithm)
Set the algorithm as the sole algorithm in the pool.
|
void |
setProblem(Problem problem)
Assign the problem to each algorithm in the pool.
|
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 algorithmSchedule,
Trial trial)
Send a message that a trial has been scored.
|
void |
trialVetoed(AlgorithmSchedule algorithmSchedule,
Trial trial)
Send a message that a trial has been vetoed.
|
protected java.util.Collection<SearchAlgorithm> _algorithms
protected java.util.Collection<SearchAlgorithm> _availableAlgorithms
protected MessageCenter _messageCenter
protected AlgorithmPoolListener _proxy
public AlgorithmPool(java.util.Collection<SearchAlgorithm> algorithms)
algorithms - the collection of algorithms to populate the poolpublic AlgorithmPool()
public AlgorithmPool(SearchAlgorithm algorithm)
algorithm - Description of the Parameterpublic static java.util.Collection<SearchAlgorithm> generateDefaultAlgorithms()
public void reset()
public void setProblem(Problem problem)
problem - the problem to solvepublic void addAlgorithmPoolListener(AlgorithmPoolListener listener)
listener - The listerner to add.public void removeAlgorithmPoolListener(AlgorithmPoolListener listener)
listener - The listener to remove.public void setAlgorithm(SearchAlgorithm algorithm)
algorithm - the algorithm to set as the only item in the poolpublic void addAlgorithms(java.util.Collection<SearchAlgorithm> algorithms)
algorithms - The feature to be added to the Algorithms attributepublic void addAlgorithm(SearchAlgorithm algorithm)
algorithm - The feature to be added to the Algorithm attributepublic void removeAlgorithm(SearchAlgorithm algorithm)
algorithm - the algorithm to remove from the poolpublic void removeAlgorithms(java.util.Collection<SearchAlgorithm> algorithms)
algorithms - the algorithms to removepublic void removeAllAlgorithms()
public java.util.Collection<SearchAlgorithm> getAlgorithms()
public java.util.Collection<SearchAlgorithm> getAvailableAlgorithms()
public void trialScored(AlgorithmSchedule algorithmSchedule, Trial trial)
trialScored in interface AlgorithmScheduleListeneralgorithmSchedule - The algorithm schedule that holds the trial scored.trial - The trial that was scored.public void trialVetoed(AlgorithmSchedule algorithmSchedule, Trial trial)
trialVetoed in interface AlgorithmScheduleListeneralgorithmSchedule - The algorithm schedule that holds the trial vetoed.trial - The trial that was vetoed.public void strategyWillExecute(AlgorithmSchedule schedule, AlgorithmStrategy strategy, ScoreBoard scoreBoard)
strategyWillExecute in interface AlgorithmScheduleListenerschedule - the schedule posting the eventstrategy - the strategy which will executescoreBoard - the scoreboardpublic void strategyExecuted(AlgorithmSchedule schedule, AlgorithmStrategy strategy, ScoreBoard scoreBoard)
strategyExecuted in interface AlgorithmScheduleListenerschedule - the schedule posting the eventstrategy - the strategy that has executedscoreBoard - the scoreboardpublic void algorithmAvailable(SearchAlgorithm source)
algorithmAvailable in interface SearchAlgorithmListenersource - The source of the available algorithm.public void algorithmUnavailable(SearchAlgorithm source)
algorithmUnavailable in interface SearchAlgorithmListenersource - The source of the available algorithm.public void foundNewOptimalSolution(SolutionJudge source, java.util.List<Trial> solutions, Trial solution)
foundNewOptimalSolution in interface SolutionJudgeListenersource - The source of the new optimal solution.solutions - The list of solutions.solution - The new optimal solution.