C++ Reference
C++ Reference: CP-SAT
Detailed Description
Specialized assignment constraint.
This constraint allows adding tuples to the allowed/forbidden assignment constraint incrementally.
Definition at line 623 of file cp_model.h.
Public Member Functions | |
| void | AddTuple (absl::Span< const int64_t > tuple) |
| Adds a tuple of possible values to the constraint. More... | |
| Constraint | OnlyEnforceIf (absl::Span< const BoolVar > literals) |
| The constraint will be enforced iff all literals listed here are true. More... | |
| Constraint | OnlyEnforceIf (BoolVar literal) |
| See OnlyEnforceIf(absl::Span<const BoolVar> literals). More... | |
| Constraint | WithName (const std::string &name) |
| Sets the name of the constraint. More... | |
| const std::string & | Name () const |
| Returns the name of the constraint (or the empty string if not set). More... | |
| const ConstraintProto & | Proto () const |
| Returns the underlying protobuf object (useful for testing). More... | |
| ConstraintProto * | MutableProto () const |
| Returns the mutable underlying protobuf object (useful for model edition). More... | |
Protected Attributes | |
| ConstraintProto * | proto_ = nullptr |
Member Function Documentation
◆ AddTuple()
| void AddTuple | ( | absl::Span< const int64_t > | tuple | ) |
Adds a tuple of possible values to the constraint.
◆ MutableProto()
|
inlineinherited |
Returns the mutable underlying protobuf object (useful for model edition).
Definition at line 562 of file cp_model.h.
◆ Name()
|
inherited |
Returns the name of the constraint (or the empty string if not set).
◆ OnlyEnforceIf() [1/2]
|
inherited |
The constraint will be enforced iff all literals listed here are true.
If this is empty, then the constraint will always be enforced. An enforced constraint must be satisfied, and an un-enforced one will simply be ignored.
This is also called half-reification. To have an equivalence between a literal and a constraint (full reification), one must add both a constraint (controlled by a literal l) and its negation (controlled by the negation of l).
[Important] currently, only a few constraints support enforcement:
- bool_or, bool_and, linear: fully supported.
- interval: only support a single enforcement literal.
- other: no support (but can be added on a per-demand basis).
◆ OnlyEnforceIf() [2/2]
|
inherited |
◆ Proto()
|
inlineinherited |
Returns the underlying protobuf object (useful for testing).
Definition at line 559 of file cp_model.h.
◆ WithName()
|
inherited |
Sets the name of the constraint.
Member Data Documentation
◆ proto_
|
protectedinherited |
Definition at line 569 of file cp_model.h.
The documentation for this class was generated from the following file: