public abstract class NeighbourSearch.NeighbourSearchContext extends Object implements AssignmentContext, SolutionListener<V,T>
| Constructor and Description |
|---|
NeighbourSearchContext() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
accept(Assignment<V,T> assignment,
Model<V,T> model,
Neighbour<V,T> neighbour,
double value,
boolean lazy)
Acceptance criterion.
|
protected void |
activate(Solution<V,T> solution)
Called just before the neighbourhood search is called for the first time.
|
void |
bestCleared(Solution<V,T> solution)
Called by the solution when method
Solution.clearBest() is
called. |
void |
bestRestored(Solution<V,T> solution)
Called by the solution when method
Solution.restoreBest() is
called. |
void |
bestSaved(Solution<V,T> solution)
Called by the solution when method
Solution.saveBest() is called. |
protected boolean |
canContinue(Solution<V,T> solution)
Return false if the search is to be stopped.
|
protected void |
deactivate(Solution<V,T> solution)
Called when the search cannot continue, just before a null neighbour is returned
|
void |
getInfo(Solution<V,T> solution,
Map<String,String> info)
Called by the solution when it is asked to produce info table, see
Solution.getInfo(). |
void |
getInfo(Solution<V,T> solution,
Map<String,String> info,
Collection<V> variables)
Called by the solution when it is asked to produce info table, see
Solution.getInfo(). |
protected long |
getTimeMillis()
Running time in milliseconds (since the last call of activate)
|
protected void |
incIteration(Solution<V,T> solution)
Increment iteration counters etc.
|
void |
solutionUpdated(Solution<V,T> solution)
Called by the solution when it is updated, see
Solution.update(double). |
public NeighbourSearchContext()
protected void activate(Solution<V,T> solution)
solution - current solutionprotected void deactivate(Solution<V,T> solution)
solution - current solutionprotected void incIteration(Solution<V,T> solution)
solution - current solutionprotected long getTimeMillis()
protected boolean canContinue(Solution<V,T> solution)
solution - current solutionprotected abstract boolean accept(Assignment<V,T> assignment, Model<V,T> model, Neighbour<V,T> neighbour, double value, boolean lazy)
assignment - current assignmentmodel - problem modelneighbour - a generated movevalue - value of the generated move (i.e., its impact on the solution value)lazy - true if lazy movepublic void bestSaved(Solution<V,T> solution)
SolutionListenerSolution.saveBest() is called.public void solutionUpdated(Solution<V,T> solution)
SolutionListenerSolution.update(double).solutionUpdated in interface SolutionListener<V extends Variable<V,T>,T extends Value<V,T>>solution - source solutionpublic void getInfo(Solution<V,T> solution, Map<String,String> info)
SolutionListenerSolution.getInfo(). A listener can also add some its info into
this table.public void getInfo(Solution<V,T> solution, Map<String,String> info, Collection<V> variables)
SolutionListenerSolution.getInfo(). A listener can also add some its info into
this table.public void bestCleared(Solution<V,T> solution)
SolutionListenerSolution.clearBest() is
called.bestCleared in interface SolutionListener<V extends Variable<V,T>,T extends Value<V,T>>solution - source solutionpublic void bestRestored(Solution<V,T> solution)
SolutionListenerSolution.restoreBest() is
called.bestRestored in interface SolutionListener<V extends Variable<V,T>,T extends Value<V,T>>solution - source solution