Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <precedences.h>
Public Member Functions | |
void | Add (Literal lit, LinearTerm a, LinearTerm b, IntegerValue lhs, IntegerValue rhs) |
Adds a relation lit => a + b \in [lhs, rhs]. | |
int | AddGreaterThanAtLeastOneOfConstraints (Model *model, bool auto_detect_clauses=false) |
This collect all enforced linear of size 2 or 1 and detect if at least one of a subset touching the same variable must be true. When this is the case we add a new propagator to propagate that fact.
Definition at line 475 of file precedences.h.
void operations_research::sat::GreaterThanAtLeastOneOfDetector::Add | ( | Literal | lit, |
LinearTerm | a, | ||
LinearTerm | b, | ||
IntegerValue | lhs, | ||
IntegerValue | rhs ) |
Adds a relation lit => a + b \in [lhs, rhs].
We shall only consider positive variable here.
Definition at line 1102 of file precedences.cc.
int operations_research::sat::GreaterThanAtLeastOneOfDetector::AddGreaterThanAtLeastOneOfConstraints | ( | Model * | model, |
bool | auto_detect_clauses = false ) |
Advanced usage. To be called once all the constraints have been added to the model. This will detect GreaterThanAtLeastOneOfConstraint(). Returns the number of added constraint.
Initialize lit_to_relations_.
We have two possible approaches. For now, we prefer the first one except if there is too many clauses in the problem.
It is common that there is only two alternatives to push a variable. In this case, our presolve most likely made sure that the two are controlled by a single Boolean. This allows to detect this and add the appropriate greater than at least one of.
Release the memory, it is not longer needed.
Definition at line 1312 of file precedences.cc.