Java Reference

Java Reference

IntVar

Detailed Description

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.

Definition at line 14 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

Public Member Functions

synchronized void delete ()
 
boolean isVar ()
 Returns true if the expression is indeed a variable. More...
 
IntVar var ()
 Creates a variable from the expression. More...
 
long value ()
 This method returns the value of the variable. More...
 
void removeValue (long v)
 This method removes the value 'v' from the domain of the variable. More...
 
void removeInterval (long l, long u)
 This method removes the interval 'l' . More...
 
void removeValues (long[] values)
 This method remove the values from the domain of the variable. More...
 
void setValue (long[] values)
 This method intersects the current domain with the values in the array. More...
 
void whenBound (Demon d)
 This method attaches a demon that will be awakened when the variable is bound. More...
 
void whenBound (Runnable closure)
 This method attaches a closure that will be awakened when the variable is bound. More...
 
void whenDomain (Demon d)
 This method attaches a demon that will watch any domain modification of the domain of the variable. More...
 
void whenDomain (Runnable closure)
 This method attaches a closure that will watch any domain modification of the domain of the variable. More...
 
long size ()
 This method returns the number of values in the domain of the variable. More...
 
boolean contains (long v)
 This method returns whether the value 'v' is in the domain of the variable. More...
 
IntVarIterator makeHoleIterator (boolean reversible)
 Creates a hole iterator. More...
 
IntVarIterator makeDomainIterator (boolean reversible)
 Creates a domain iterator. More...
 
long oldMin ()
 Returns the previous min. More...
 
long oldMax ()
 Returns the previous max. More...
 
int varType ()
 
void accept (ModelVisitor visitor)
 Accepts the given visitor. More...
 
IntVar isEqual (long constant)
 IsEqual. More...
 
IntVar isDifferent (long constant)
 
IntVar isGreaterOrEqual (long constant)
 
IntVar isLessOrEqual (long constant)
 
int index ()
 Returns the index of the variable. More...
 
long min ()
 
void setMin (long m)
 
long max ()
 
void setMax (long m)
 
void range (int[] l, int[] u)
 By default calls Min() and Max(), but can be redefined when Min and Max code can be factorized. More...
 
void setRange (long l, long u)
 This method sets both the min and the max of the expression. More...
 
void setValue (long v)
 This method sets the value of the expression. More...
 
boolean bound ()
 Returns true if the min and the max of the expression are equal. More...
 
IntVar varWithName (String name)
 Creates a variable from the expression and set the name of the resulting var. More...
 
void whenRange (Demon d)
 Attach a demon that will watch the min or the max of the expression. More...
 
void whenRange (Runnable closure)
 Attach a demon that will watch the min or the max of the expression. More...
 
String toString ()
 
Solver solver ()
 
void freezeQueue ()
 This method freezes the propagation queue. More...
 
void unfreezeQueue ()
 This method unfreezes the propagation queue. More...
 
void enqueueDelayedDemon (Demon d)
 This method pushes the demon onto the propagation queue. More...
 
void enqueueVar (Demon d)
 
void reset_action_on_fail ()
 This method clears the failure callback. More...
 
void set_variable_to_clean_on_fail (IntVar v)
 Shortcut for variable cleaner. More...
 
String name ()
 Object naming. More...
 
void setName (String name)
 
boolean hasName ()
 Returns whether the object has been named or not. More...
 
String baseName ()
 Returns a base name for automatic naming. More...
 

Protected Member Functions

 IntVar (long cPtr, boolean cMemoryOwn)
 

Constructor & Destructor Documentation

◆ IntVar()

IntVar ( long  cPtr,
boolean  cMemoryOwn 
)
inlineprotected

Member Function Documentation

◆ accept()

void accept ( ModelVisitor  visitor)
inline

Accepts the given visitor.

Reimplemented from IntExpr.

Definition at line 165 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ baseName()

String baseName ( )
inlineinherited

Returns a base name for automatic naming.

Reimplemented in BooleanVar.

Definition at line 115 of file PropagationBaseObject.java.

◆ bound()

boolean bound ( )
inlineinherited

Returns true if the min and the max of the expression are equal.

Reimplemented in BooleanVar.

Definition at line 82 of file IntExpr.java.

◆ contains()

boolean contains ( long  v)
inline

This method returns whether the value 'v' is in the domain of the variable.

Reimplemented in BooleanVar.

Definition at line 124 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ delete()

synchronized void delete ( )
inline

Reimplemented from IntExpr.

Reimplemented in BooleanVar.

Definition at line 31 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ enqueueDelayedDemon()

void enqueueDelayedDemon ( Demon  d)
inlineinherited

This method pushes the demon onto the propagation queue.

It will be processed directly if the queue is empty. It will be enqueued according to its priority otherwise.

Definition at line 72 of file PropagationBaseObject.java.

◆ enqueueVar()

void enqueueVar ( Demon  d)
inlineinherited

Definition at line 76 of file PropagationBaseObject.java.

◆ freezeQueue()

void freezeQueue ( )
inlineinherited

This method freezes the propagation queue.

It is useful when you need to apply multiple modifications at once.

Definition at line 58 of file PropagationBaseObject.java.

◆ hasName()

boolean hasName ( )
inlineinherited

Returns whether the object has been named or not.

Definition at line 108 of file PropagationBaseObject.java.

◆ index()

int index ( )
inline

Returns the index of the variable.

Definition at line 195 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ isDifferent()

IntVar isDifferent ( long  constant)
inline

Reimplemented in BooleanVar.

Definition at line 177 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ isEqual()

IntVar isEqual ( long  constant)
inline

IsEqual.

Reimplemented in BooleanVar.

Definition at line 172 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ isGreaterOrEqual()

IntVar isGreaterOrEqual ( long  constant)
inline

Reimplemented in BooleanVar.

Definition at line 182 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ isLessOrEqual()

IntVar isLessOrEqual ( long  constant)
inline

Reimplemented in BooleanVar.

Definition at line 187 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ isVar()

boolean isVar ( )
inline

Returns true if the expression is indeed a variable.

Reimplemented from IntExpr.

Definition at line 42 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ makeDomainIterator()

IntVarIterator makeDomainIterator ( boolean  reversible)
inline

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.

Reimplemented in BooleanVar.

Definition at line 139 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ makeHoleIterator()

IntVarIterator makeHoleIterator ( boolean  reversible)
inline

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.

Reimplemented in BooleanVar.

Definition at line 131 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ max()

long max ( )
inlineinherited

Reimplemented in BooleanVar.

Definition at line 50 of file IntExpr.java.

◆ min()

long min ( )
inlineinherited

Reimplemented in BooleanVar.

Definition at line 42 of file IntExpr.java.

◆ name()

String name ( )
inlineinherited

Object naming.

Definition at line 97 of file PropagationBaseObject.java.

◆ oldMax()

long oldMax ( )
inline

Returns the previous max.

Definition at line 154 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ oldMin()

long oldMin ( )
inline

Returns the previous min.

Definition at line 147 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ range()

void range ( int[]  l,
int[]  u 
)
inlineinherited

By default calls Min() and Max(), but can be redefined when Min and Max code can be factorized.

Definition at line 61 of file IntExpr.java.

◆ removeInterval()

void removeInterval ( long  l,
long  u 
)
inline

This method removes the interval 'l' .

. 'u' from the domain of the variable. It assumes that 'l' <= 'u'.

Reimplemented in BooleanVar.

Definition at line 68 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ removeValue()

void removeValue ( long  v)
inline

This method removes the value 'v' from the domain of the variable.

Reimplemented in BooleanVar.

Definition at line 61 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ removeValues()

void removeValues ( long[]  values)
inline

This method remove the values from the domain of the variable.

Definition at line 75 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ reset_action_on_fail()

void reset_action_on_fail ( )
inlineinherited

This method clears the failure callback.

Definition at line 83 of file PropagationBaseObject.java.

◆ set_variable_to_clean_on_fail()

void set_variable_to_clean_on_fail ( IntVar  v)
inlineinherited

Shortcut for variable cleaner.

Definition at line 90 of file PropagationBaseObject.java.

◆ setMax()

void setMax ( long  m)
inlineinherited

Reimplemented in BooleanVar.

Definition at line 54 of file IntExpr.java.

◆ setMin()

void setMin ( long  m)
inlineinherited

Reimplemented in BooleanVar.

Definition at line 46 of file IntExpr.java.

◆ setName()

void setName ( String  name)
inlineinherited

Definition at line 101 of file PropagationBaseObject.java.

◆ setRange()

void setRange ( long  l,
long  u 
)
inlineinherited

This method sets both the min and the max of the expression.

Reimplemented in BooleanVar.

Definition at line 68 of file IntExpr.java.

◆ setValue() [1/2]

void setValue ( long  v)
inlineinherited

This method sets the value of the expression.

Definition at line 75 of file IntExpr.java.

◆ setValue() [2/2]

void setValue ( long[]  values)
inline

This method intersects the current domain with the values in the array.

Definition at line 82 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ size()

long size ( )
inline

This method returns the number of values in the domain of the variable.

Reimplemented in BooleanVar.

Definition at line 117 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ solver()

Solver solver ( )
inlineinherited

Definition at line 50 of file PropagationBaseObject.java.

◆ toString()

String toString ( )
inlineinherited

Reimplemented from BaseObject.

Reimplemented in Assignment, Pack, BooleanVar, Constraint, GlobalVehicleBreaksConstraint, and SequenceVar.

Definition at line 46 of file PropagationBaseObject.java.

◆ unfreezeQueue()

void unfreezeQueue ( )
inlineinherited

This method unfreezes the propagation queue.

All modifications that happened when the queue was frozen will be processed.

Definition at line 65 of file PropagationBaseObject.java.

◆ value()

long value ( )
inline

This method returns the value of the variable.

This method checks before that the variable is bound.

Reimplemented in BooleanVar.

Definition at line 54 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ var()

IntVar var ( )
inline

Creates a variable from the expression.

Reimplemented from IntExpr.

Definition at line 46 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ varType()

int varType ( )
inline

Reimplemented in BooleanVar.

Definition at line 158 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ varWithName()

IntVar varWithName ( String  name)
inlineinherited

Creates a variable from the expression and set the name of the resulting var.

If the expression is already a variable, then it will set the name of the expression, possibly overwriting it. This is just a shortcut to Var() followed by set_name().

Definition at line 104 of file IntExpr.java.

◆ whenBound() [1/2]

void whenBound ( Demon  d)
inline

This method attaches a demon that will be awakened when the variable is bound.

Reimplemented in BooleanVar.

Definition at line 89 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ whenBound() [2/2]

void whenBound ( Runnable  closure)
inline

This method attaches a closure that will be awakened when the variable is bound.

Definition at line 96 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ whenDomain() [1/2]

void whenDomain ( Demon  d)
inline

This method attaches a demon that will watch any domain modification of the domain of the variable.

Reimplemented in BooleanVar.

Definition at line 103 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ whenDomain() [2/2]

void whenDomain ( Runnable  closure)
inline

This method attaches a closure that will watch any domain modification of the domain of the variable.

Definition at line 110 of file gen/java/com/google/ortools/constraintsolver/IntVar.java.

◆ whenRange() [1/2]

void whenRange ( Demon  d)
inlineinherited

Attach a demon that will watch the min or the max of the expression.

Reimplemented in BooleanVar.

Definition at line 112 of file IntExpr.java.

◆ whenRange() [2/2]

void whenRange ( Runnable  closure)
inlineinherited

Attach a demon that will watch the min or the max of the expression.

Definition at line 119 of file IntExpr.java.


The documentation for this class was generated from the following file: