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 TypeMethodDescriptionvoidaccept(ModelVisitor visitor) Accepts the given visitor.booleancontains(long v) This method returns whether the value 'v' is in the domain of the
variable.voiddelete()protected voidfinalize()static longintindex()Returns the index of the variable.isDifferent(long constant) isEqual(long constant) IsEqualisGreaterOrEqual(long constant) isLessOrEqual(long constant) booleanisVar()Returns true if the expression is indeed a variable.makeDomainIterator(boolean reversible) Creates a domain iterator.makeHoleIterator(boolean reversible) Creates a hole iterator.longoldMax()Returns the previous max.longoldMin()Returns the previous min.voidremoveInterval(long l, long u) This method removes the interval 'l' ..voidremoveValue(long v) This method removes the value 'v' from the domain of the variable.voidremoveValues(long[] values) This method remove the values from the domain of the variable.voidsetValue(long[] values) This method intersects the current domain with the values in the array.longsize()This method returns the number of values in the domain of the variable.static longswigRelease(IntVar obj) longvalue()This method returns the value of the variable.var()Creates a variable from the expression.intvarType()voidThis method attaches a demon that will be awakened when the
variable is bound.voidThis method attaches a closure that will be awakened when the
variable is bound.voidwhenDomain(Demon d) This method attaches a demon that will watch any domain
modification of the domain of the variable.voidwhenDomain(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, whenRangeMethods 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, unfreezeQueueMethods 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.
-