Class IntVarLocalSearchOperator
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.LocalSearchOperator
com.google.ortools.constraintsolver.IntVarLocalSearchOperator
- Direct Known Subclasses:
BaseLns
,ChangeValue
Specialization of LocalSearchOperator built from an array of IntVars
which specifies the scope of the operator.
This class also takes care of storing current variable values in Start(),
keeps track of changes done by the operator and builds the delta.
The Deactivate() method can be used to perform Large Neighborhood Search.
which specifies the scope of the operator.
This class also takes care of storing current variable values in Start(),
keeps track of changes done by the operator and builds the delta.
The Deactivate() method can be used to perform Large Neighborhood Search.
-
Field Summary
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
Constructor Summary
ConstructorsConstructorDescriptionIntVarLocalSearchOperator
(long cPtr, boolean cMemoryOwn) IntVarLocalSearchOperator
(IntVar[] vars) IntVarLocalSearchOperator
(IntVar[] vars, boolean keep_inverse_values) -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(long index) boolean
activated
(long index) void
boolean
ApplyChanges
(Assignment delta, Assignment deltadelta) void
deactivate
(long index) void
delete()
protected void
finalize()
static long
boolean
boolean
long
oldValue
(long index) protected boolean
Creates a new neighbor.void
onStart()
Called by Start() after synchronizing the operator with the current
assignment.long
PrevValue
(long index) void
RevertChanges
(boolean change_was_incremental) void
setValue
(long index, long value) int
size()
boolean
SkipUnchanged
(int arg0) void
start
(Assignment assignment) This method should not be overridden.protected void
static long
void
void
long
value
(long index) Returns the value in the current assignment of the variable of given
index.var
(long index) Returns the variable of given index.Methods inherited from class com.google.ortools.constraintsolver.LocalSearchOperator
EnterSearch, getCPtr, HasFragments, nextNeighbor, reset, swigRelease
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease, toString
-
Constructor Details
-
IntVarLocalSearchOperator
public IntVarLocalSearchOperator(long cPtr, boolean cMemoryOwn) -
IntVarLocalSearchOperator
-
IntVarLocalSearchOperator
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
protected void finalize()- Overrides:
finalize
in classLocalSearchOperator
-
delete
public void delete()- Overrides:
delete
in classLocalSearchOperator
-
swigDirectorDisconnect
protected void swigDirectorDisconnect()- Overrides:
swigDirectorDisconnect
in classLocalSearchOperator
-
swigReleaseOwnership
public void swigReleaseOwnership()- Overrides:
swigReleaseOwnership
in classLocalSearchOperator
-
swigTakeOwnership
public void swigTakeOwnership()- Overrides:
swigTakeOwnership
in classLocalSearchOperator
-
HoldsDelta
public boolean HoldsDelta()- Overrides:
HoldsDelta
in classLocalSearchOperator
-
start
This method should not be overridden. Override OnStart() instead which is
called before exiting this method.- Overrides:
start
in classLocalSearchOperator
-
isIncremental
public boolean isIncremental() -
size
public int size() -
value
public long value(long index) Returns the value in the current assignment of the variable of given
index. -
var
Returns the variable of given index. -
SkipUnchanged
public boolean SkipUnchanged(int arg0) -
oldValue
public long oldValue(long index) -
PrevValue
public long PrevValue(long index) -
setValue
public void setValue(long index, long value) -
activated
public boolean activated(long index) -
activate
public void activate(long index) -
deactivate
public void deactivate(long index) -
ApplyChanges
-
RevertChanges
public void RevertChanges(boolean change_was_incremental) -
addVars
-
onStart
public void onStart()Called by Start() after synchronizing the operator with the current
assignment. Should be overridden instead of Start() to avoid calling
IntVarLocalSearchOperator::Start explicitly. -
oneNeighbor
protected boolean oneNeighbor()Creates a new neighbor. It returns false when the neighborhood is
completely explored.
MakeNextNeighbor() in a subclass of IntVarLocalSearchOperator.
-