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
public class IntVar extends IntExpr
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.
-
-
Field Summary
-
Fields inherited from class com.google.ortools.constraintsolver.BaseObject
swigCMemOwn
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedIntVar(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(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()protected static longgetCPtr(IntVar obj)intindex()Returns the index of the variable.IntVarisDifferent(long constant)IntVarisEqual(long constant)IsEqualIntVarisGreaterOrEqual(long constant)IntVarisLessOrEqual(long constant)booleanisVar()Returns true if the expression is indeed a variable.IntVarIteratormakeDomainIterator(boolean reversible)Creates a domain iterator.IntVarIteratormakeHoleIterator(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.java.math.BigIntegersize()This method returns the number of values in the domain of the variable.protected static longswigRelease(IntVar obj)longvalue()This method returns the value of the variable.IntVarvar()Creates a variable from the expression.intvarType()voidwhenBound(Demon d)This method attaches a demon that will be awakened when the
variable is bound.voidwhenBound(java.lang.Runnable closure)This 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(java.lang.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
-
-
-
-
Method Detail
-
getCPtr
protected static long getCPtr(IntVar obj)
-
swigRelease
protected static long swigRelease(IntVar obj)
-
isVar
public boolean isVar()
Description copied from class:IntExprReturns true if the expression is indeed a variable.
-
var
public IntVar var()
Description copied from class:IntExprCreates a variable from the expression.
-
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
public void whenBound(Demon d)
This method attaches a demon that will be awakened when the
variable is bound.
-
whenBound
public void whenBound(java.lang.Runnable closure)
This method attaches a closure that will be awakened when the
variable is bound.
-
whenDomain
public void whenDomain(Demon d)
This method attaches a demon that will watch any domain
modification of the domain of the variable.
-
whenDomain
public void whenDomain(java.lang.Runnable closure)
This method attaches a closure that will watch any domain
modification of the domain of the variable.
-
size
public java.math.BigInteger 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
public IntVarIterator makeHoleIterator(boolean reversible)
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
public IntVarIterator makeDomainIterator(boolean reversible)
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
public void accept(ModelVisitor visitor)
Accepts the given visitor.
-
isEqual
public IntVar isEqual(long constant)
IsEqual
-
isDifferent
public IntVar isDifferent(long constant)
-
isGreaterOrEqual
public IntVar isGreaterOrEqual(long constant)
-
isLessOrEqual
public IntVar isLessOrEqual(long constant)
-
index
public int index()
Returns the index of the variable.
-
-