This class is used to incrementally maintain an assignment and the feasibility of the constraints of a given LinearBooleanProblem.
The current assignment is initialized using a feasible reference solution, i.e. the reference solution satisfies all the constraints of the problem. The current assignment is updated using the Assign() method.
- Note
- the current assignment is not a solution in the sense that it might not be feasible, ie. violates some constraints.
The assignment can be accessed at any time using Assignment(). The set of infeasible constraints can be accessed at any time using PossiblyInfeasibleConstraints().
- Note
- this class is reversible, i.e. it is possible to backtrack to previously added backtracking levels. levels. Consider for instance variable a, b, c, and d. Method called Assigned after method call 1- Assign({a, b}) a b 2- AddBacktrackingLevel() a b | 3- Assign({c}) a b | c 4- Assign({d}) a b | c d 5- BacktrackOneLevel() a b 6- Assign({c}) a b c 7- BacktrackOneLevel()
Definition at line 282 of file bop_ls.h.
| operations_research::bop::AssignmentAndConstraintFeasibilityMaintainer::AssignmentAndConstraintFeasibilityMaintainer |
( |
const sat::LinearBooleanProblem & | problem, |
|
|
absl::BitGenRef | random ) |
|
explicit |
- Note
- the constraint indices used in this class are not the same as the one used in the given LinearBooleanProblem here.
AssignmentAndConstraintFeasibilityMaintainer
Add the objective constraint as the first constraint.
Add each constraint.
Infeasible binary constraints are automatically repaired by propagation (when possible). Then there are no needs to consider the binary constraints here, the propagation is delegated to the SAT propagator.
Initialize infeasible_constraint_set_;
Definition at line 211 of file bop_ls.cc.
| const std::vector< sat::Literal > & operations_research::bop::AssignmentAndConstraintFeasibilityMaintainer::PotentialOneFlipRepairs |
( |
| ) |
|
This returns the list of literal that appear in exactly all the current infeasible constraints (ignoring the objective) and correspond to a flip in a good direction for all the infeasible constraint. Performing this flip may repair the problem without any propagations.
Important: The returned reference is only valid until the next PotentialOneFlipRepairs() call.
First, we compute the hash that a Literal should have in order to repair all the infeasible constraint (ignoring the objective).
- Todo
- (user): If this starts to show-up in a performance profile, we can easily maintain this hash incrementally.
We only returns the flips.
Definition at line 380 of file bop_ls.cc.