Overview | Group | Tree | Graph | Deprecated | Index | Concepts |
A constraint is an object in CP Optimizer. Like other CP Optimizer entities, a
constraint is implemented by means of two classes: a handle class and an
implementation class. In other words, an instance of the class
IlcConstraint
(a handle) contains a data member (the handle
pointer) that points to an instance of the class
IlcConstraintI (its implementation object).
Constraints as Boolean Expressions
You might also think of a constraint as a Boolean expression with a value
of either IlcFalse
or IlcTrue
. The value of the
expression depends on the satisfiability of the constraint: if the
constraint cannot be violated, then the expression is fixed to
IlcTrue
; if the constraint cannot be satisfied, then the
expression is fixed to IlcFalse
. We sometimes call a
constraint, a constrained Boolean expression. These expressions can
be constrained themselves, and they can be combined with logical operators:
or, and, and not.
Posting Constraints
When you create a constraint, CP Optimizer does not automatically take it into account. You must explicitly add the constraint to a model and extract the model.
Most member functions in this class contain assert
statements. For an explanation of the macro NDEBUG
(a way to
turn on or turn off these assert
statements), see the concept
Assert and NDEBUG.
Method Summary | |
---|---|
public IlcBool | isFalse() const |
public IlcBool | isTrue() const |
Method Detail |
---|
When this member function returns IlcTrue
, the invoking constraint cannot be
satisfied, no matter what.
For example, consider the constraint x <= y
. If the domain of x
is [0, 10]
and the domain of y
is [10, 20]
, then the constraint
is necessarily satisfied. In contrast, if the domain of x
is [11, 20]
and
the domain of y
is [0, 10]
, then the constraint is necessarily violated
(that is, it cannot be satisfied).
When this member function returns IlcTrue
,
the invoking constraint is necessarily
satisfied, no matter what.