Class IntVar
java.lang.Object
com.google.ortools.constraintsolver.BaseObject
com.google.ortools.constraintsolver.PropagationBaseObject
com.google.ortools.constraintsolver.IntExpr
com.google.ortools.constraintsolver.IntVar
- Direct Known Subclasses:
BooleanVar
The class IntVar is a subset of IntExpr. In addition to the
IntExpr protocol, it offers persistence, removing values from the domains,
and a finer model for events.
IntExpr protocol, it offers persistence, removing values from the domains,
and a finer model for events.
-
Field Summary
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(ModelVisitor visitor) Accepts the given visitor.boolean
contains
(long v) This method returns whether the value 'v' is in the domain of the
variable.void
delete()
protected void
finalize()
static long
int
index()
Returns the index of the variable.isDifferent
(long constant) isEqual
(long constant) IsEqualisGreaterOrEqual
(long constant) isLessOrEqual
(long constant) boolean
isVar()
Returns true if the expression is indeed a variable.makeDomainIterator
(boolean reversible) Creates a domain iterator.makeHoleIterator
(boolean reversible) Creates a hole iterator.long
oldMax()
Returns the previous max.long
oldMin()
Returns the previous min.void
removeInterval
(long l, long u) This method removes the interval 'l' ..void
removeValue
(long v) This method removes the value 'v' from the domain of the variable.void
removeValues
(long[] values) This method remove the values from the domain of the variable.void
setValue
(long[] values) This method intersects the current domain with the values in the array.long
size()
This method returns the number of values in the domain of the variable.static long
swigRelease
(IntVar obj) long
value()
This method returns the value of the variable.var()
Creates a variable from the expression.int
varType()
void
This method attaches a demon that will be awakened when the
variable is bound.void
This method attaches a closure that will be awakened when the
variable is bound.void
whenDomain
(Demon d) This method attaches a demon that will watch any domain
modification of the domain of the variable.void
whenDomain
(Runnable closure) This method attaches a closure that will watch any domain
modification of the domain of the variable.Methods inherited from class com.google.ortools.constraintsolver.IntExpr
bound, getCPtr, max, min, range, setMax, setMin, setRange, setValue, swigRelease, varWithName, whenRange, whenRange
Methods inherited from class com.google.ortools.constraintsolver.PropagationBaseObject
baseName, enqueueDelayedDemon, enqueueVar, freezeQueue, getCPtr, hasName, name, reset_action_on_fail, set_variable_to_clean_on_fail, setName, solver, swigRelease, toString, unfreezeQueue
Methods inherited from class com.google.ortools.constraintsolver.BaseObject
getCPtr, swigRelease
-
Constructor Details
-
IntVar
public IntVar(long cPtr, boolean cMemoryOwn)
-
-
Method Details
-
getCPtr
-
swigRelease
-
finalize
-
delete
-
isVar
-
var
-
value
public long value()This method returns the value of the variable. This method checks
before that the variable is bound. -
removeValue
public void removeValue(long v) This method removes the value 'v' from the domain of the variable. -
removeInterval
public void removeInterval(long l, long u) This method removes the interval 'l' .. 'u' from the domain of
the variable. It assumes that 'l' <= 'u'. -
removeValues
public void removeValues(long[] values) This method remove the values from the domain of the variable. -
setValue
public void setValue(long[] values) This method intersects the current domain with the values in the array. -
whenBound
This method attaches a demon that will be awakened when the
variable is bound. -
whenBound
This method attaches a closure that will be awakened when the
variable is bound. -
whenDomain
This method attaches a demon that will watch any domain
modification of the domain of the variable. -
whenDomain
This method attaches a closure that will watch any domain
modification of the domain of the variable. -
size
public long size()This method returns the number of values in the domain of the variable. -
contains
public boolean contains(long v) This method returns whether the value 'v' is in the domain of the
variable. -
makeHoleIterator
Creates a hole iterator. When 'reversible' is false, the returned
object is created on the normal C++ heap and the solver does NOT
take ownership of the object. -
makeDomainIterator
Creates a domain iterator. When 'reversible' is false, the
returned object is created on the normal C++ heap and the solver
does NOT take ownership of the object. -
oldMin
public long oldMin()Returns the previous min. -
oldMax
public long oldMax()Returns the previous max. -
varType
public int varType() -
accept
Accepts the given visitor. -
isEqual
IsEqual -
isDifferent
-
isGreaterOrEqual
-
isLessOrEqual
-
index
public int index()Returns the index of the variable.
-