- java.lang.Object
-
- org.chocosolver.solver.search.loop.lns.neighbors.IntNeighbor
-
- Direct Known Subclasses:
PropagationGuidedNeighborhood
,RandomNeighborhood
public abstract class IntNeighbor extends Object implements INeighbor
An abstract class that defines services required for the LNS to select some IntVar to freeze-unfreeze.- Since:
- 18/06/13
- Author:
- Charles Prud'homme
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IntNeighbor(IntVar[] variables)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
forEachIntVar(Consumer<IntVar> action)
Apply an action on each variable declared on the scope of this cause, if any.void
freeze(int i)
Freeze variable at position 'i' to its value in that recorded solution.void
loadFromSolution(Solution solution)
Load a solution and record itvoid
recordSolution()
Record values of decision variables to freeze some ones during the next LNS run-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.chocosolver.solver.search.loop.lns.neighbors.INeighbor
fixSomeVariables, init, isSearchComplete, restrictLess
-
-
-
-
Field Detail
-
variables
protected final IntVar[] variables
-
values
protected final int[] values
-
-
Constructor Detail
-
IntNeighbor
protected IntNeighbor(IntVar[] variables)
-
-
Method Detail
-
recordSolution
public void recordSolution()
Record values of decision variables to freeze some ones during the next LNS run- Specified by:
recordSolution
in interfaceINeighbor
-
freeze
public void freeze(int i) throws ContradictionException
Freeze variable at position 'i' to its value in that recorded solution.- Parameters:
i
- position of the variable to instantiate- Throws:
ContradictionException
- if a contradiction occurs
-
loadFromSolution
public void loadFromSolution(Solution solution)
Load a solution and record it- Specified by:
loadFromSolution
in interfaceINeighbor
- Parameters:
solution
- a solution to record
-
forEachIntVar
public void forEachIntVar(Consumer<IntVar> action)
Description copied from interface:ICause
Apply an action on each variable declared on the scope of this cause, if any.- Specified by:
forEachIntVar
in interfaceICause
- Parameters:
action
- action to perform on each variable declared in this cause.
-
-