C++ Reference: class Constraint

Note: This documentation is automatically generated.

A constraint is the main modeling object. It provides two methods:
   - Post() is responsible for creating the demons and attaching them to immediate demons().
   - InitialPropagate() is called once just after Post and performs the initial propagation. The subsequent propagations will be performed by the demons Posted during the post() method.

Return type: virtual void

Arguments: ModelVisitor* const visitor

Accepts the given visitor.


Return type: explicit

Arguments: Solver* const solver



Return type: std::string


Return type: virtual void

This method performs the initial propagation of the constraint. It is called just after the post.


Return type: bool

Is the constraint created by a cast from expression to integer variable?


Return type: virtual void

This method is called when the constraint is processed by the solver. Its main usage is to attach demons to variables.


Return type: void

Calls Post and then Propagate to initialize the constraints. This is usually done in the root node.


Return type: virtual IntVar*

Creates a Boolean variable representing the status of the constraint (false = constraint is violated, true = constraint is satisfied). It returns nullptr if the constraint does not support this API.