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 |
iContextOverride
sMaxSize
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, setAssignmentContextReference
protected 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)
NeighbourSelection
public void solutionUpdated(Solution<V,T> solution)
SolutionListener
Solution.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)
SolutionListener
Solution.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)
SolutionListener
Solution.getInfo()
. A listener can also add some its info into
this table.public void bestCleared(Solution<V,T> solution)
SolutionListener
Solution.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)
SolutionListener
Solution.saveBest()
is called.public void bestRestored(Solution<V,T> solution)
SolutionListener
Solution.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)
NeighbourSelection
selectNeighbour
in interface NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
solution
- given solutionpublic MaxIdleNeighbourSelection.MaxIdleContext createAssignmentContext(Assignment<V,T> assignment)
HasAssignmentContext
createAssignmentContext
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