C++ Reference: class IntExpr

This documentation is automatically generated.

The class IntExpr is the base of all integer expressions in constraint programming. It contains the basic protocol for an expression:
   - setting and modifying its bound
   - querying if it is bound
   - listening to events modifying its bounds
   - casting it into a variable (instance of IntVar)
Method
Accept

Return type: virtual void

Arguments: ModelVisitor* const visitor

Accepts the given visitor.

Bound

Return type: virtual bool

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

IntExpr

Return type: explicit

Arguments: Solver* const s

~IntExpr

IsVar

Return type: virtual bool

Returns true if the expression is indeed a variable.

Max

Return type: virtual int64

Min

Return type: virtual int64

Range

Return type: virtual void

Arguments: int64* l, int64* u

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

SetMax

Return type: virtual void

Arguments: int64 m

SetMin

Return type: virtual void

Arguments: int64 m

SetRange

Return type: virtual void

Arguments: int64 l, int64 u

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

SetValue

Return type: virtual void

Arguments: int64 v

This method sets the value of the expression.

Var

Return type: virtual IntVar*

Creates a variable from the expression.

VarWithName

Return type: IntVar*

Arguments: const std::string& name

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().

WhenRange

Return type: virtual void

Arguments: Demon* d

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

WhenRange

Return type: void

Arguments: Solver::Closure closure

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

WhenRange

Return type: void

Arguments: Solver::Action action

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