Stay organized with collections
Save and categorize content based on your preferences.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["The `Constraint` class is the primary building block for modeling optimization problems in Google OR-Tools."],["It uses two main methods: `Post()` for creating and attaching demons to manage propagation, and `InitialPropagate()` for performing the first round of constraint propagation."],["`Post()` sets up the constraint's internal mechanisms, while `InitialPropagate()` enforces the constraint's logic for the first time."],["Subsequent constraint enforcement is handled by the demons established during the `Post()` phase."]]],["The `Constraint` class in C++ is a core modeling object with key methods for constraint handling. `Post()` attaches demons to variables, triggering actions, while `InitialPropagate()` performs the first propagation after `Post()`. Subsequent propagations are driven by the posted demons. `PostAndPropagate()` calls both `Post()` and propagation to set up constraints initially. Other methods include: `Accept` to receive a visitor, `DebugString` for a string representation, and `Var` to make a boolean variable for the constraint.\n"]]