V - VariableT - Valuepublic class MaxIdleNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>> extends NeighbourSelectionWithContext<V,T,MaxIdleNeighbourSelection.MaxIdleContext> implements SolutionListener<V,T>
NeighbourSelection that halts the construction
heuristic or the IFS search when the underlying heuristic is unable to improve the
number of assigned variables. When a given number of non-improving iterations is reached,
the MaxIdleNeighbourSelection extension starts returning null. The counter gets
automatically reset every time a solution with more variables assigned is stored as best
solution.NeighbourSelection| Modifier and Type | Class and Description |
|---|---|
class |
MaxIdleNeighbourSelection.MaxIdleContext |
| Modifier and Type | Field and Description |
|---|---|
protected int |
iBestAssigned |
protected int |
iMaxIdle |
protected NeighbourSelection<V,T> |
iParent |
protected ConflictStatistics<V,T> |
iStat |
protected long |
iTimeOut |
iContextOverridesMaxSize| Constructor and Description |
|---|
MaxIdleNeighbourSelection(DataProperties properties,
NeighbourSelection<V,T> parent,
int maxIdle) |
| Modifier and Type | Method and Description |
|---|---|
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. |
MaxIdleNeighbourSelection.MaxIdleContext |
createAssignmentContext(Assignment<V,T> assignment)
Create a new assignment context for the given assignment.
|
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(). |
void |
init(Solver<V,T> solver)
Criterion initialization
|
Neighbour<V,T> |
selectNeighbour(Solution<V,T> solution)
select a neighbour of a given solution
|
void |
solutionUpdated(Solution<V,T> solution)
Called by the solution when it is updated, see
Solution.update(double). |
getAssignmentContextReference, getContext, getContext, hasContextOverride, isSingleContextSolver, setAssignmentContextReferenceprotected int iMaxIdle
protected int iBestAssigned
protected long iTimeOut
public MaxIdleNeighbourSelection(DataProperties properties, NeighbourSelection<V,T> parent, int maxIdle)
public void init(Solver<V,T> solver)
NeighbourSelectionpublic 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 bestSaved(Solution<V,T> solution)
SolutionListenerSolution.saveBest() is called.public 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 solutionpublic Neighbour<V,T> selectNeighbour(Solution<V,T> solution)
NeighbourSelectionselectNeighbour in interface NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>solution - given solutionpublic MaxIdleNeighbourSelection.MaxIdleContext createAssignmentContext(Assignment<V,T> assignment)
HasAssignmentContextcreateAssignmentContext in interface HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,MaxIdleNeighbourSelection.MaxIdleContext>assignment - an assignment for which there needs to be an assignment context