Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <cp_model.h>
Public Member Functions | |
Constraint | OnlyEnforceIf (absl::Span< const BoolVar > literals) |
Constraint | OnlyEnforceIf (BoolVar literal) |
See OnlyEnforceIf(absl::Span<const BoolVar> literals). | |
Constraint | WithName (absl::string_view name) |
Sets the name of the constraint. | |
absl::string_view | Name () const |
Returns the name of the constraint (or the empty string if not set). | |
const ConstraintProto & | Proto () const |
Returns the underlying protobuf object (useful for testing). | |
ConstraintProto * | MutableProto () const |
Returns the mutable underlying protobuf object (useful for model edition). | |
Protected Member Functions | |
Constraint (ConstraintProto *proto) | |
Protected Attributes | |
ConstraintProto * | proto_ = nullptr |
Friends | |
class | CpModelBuilder |
A constraint.
This class enables you to modify the constraint that was previously added to the model.
The constraint must be built using the different CpModelBuilder::AddXXX
methods.
Definition at line 533 of file cp_model.h.
|
explicitprotected |
Definition at line 493 of file cp_model.cc.
|
inline |
Returns the mutable underlying protobuf object (useful for model edition).
Definition at line 567 of file cp_model.h.
absl::string_view operations_research::sat::Constraint::Name | ( | ) | const |
Returns the name of the constraint (or the empty string if not set).
Definition at line 500 of file cp_model.cc.
Constraint operations_research::sat::Constraint::OnlyEnforceIf | ( | absl::Span< const BoolVar > | literals | ) |
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:
Definition at line 502 of file cp_model.cc.
Constraint operations_research::sat::Constraint::OnlyEnforceIf | ( | BoolVar | literal | ) |
See OnlyEnforceIf(absl::Span<const BoolVar> literals).
Definition at line 509 of file cp_model.cc.
|
inline |
Returns the underlying protobuf object (useful for testing).
Definition at line 564 of file cp_model.h.
Constraint operations_research::sat::Constraint::WithName | ( | absl::string_view | name | ) |
Sets the name of the constraint.
Definition at line 495 of file cp_model.cc.
|
friend |
Definition at line 570 of file cp_model.h.
|
protected |
Definition at line 574 of file cp_model.h.