Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <integer_expr.h>
Public Member Functions | |
MinPropagator (const std::vector< IntegerVariable > &vars, IntegerVariable min_var, IntegerTrail *integer_trail) | |
MinPropagator (const MinPropagator &)=delete | |
This type is neither copyable nor movable. | |
MinPropagator & | operator= (const MinPropagator &)=delete |
bool | Propagate () final |
void | RegisterWith (GenericLiteralWatcher *watcher) |
Public Member Functions inherited from operations_research::sat::PropagatorInterface | |
PropagatorInterface ()=default | |
virtual | ~PropagatorInterface ()=default |
virtual bool | IncrementalPropagate (const std::vector< int > &) |
A min (resp max) constraint of the form min == MIN(vars) can be decomposed into two inequalities: 1/ min <= MIN(vars), which is the same as for all v in vars, "min <= v". This can be taken care of by the LowerOrEqual(min, v) constraint. 2/ min >= MIN(vars).
And in turn, 2/ can be decomposed in: a) lb(min) >= lb(MIN(vars)) = MIN(lb(var)); b) ub(min) >= ub(MIN(vars)) and we can't propagate anything here unless there is just one possible variable 'v' that can be the min: for all u != v, lb(u) > ub(min); In this case, ub(min) >= ub(v).
This constraint take care of a) and b). That is:
Complexity: This is a basic implementation in O(num_vars) on each call to Propagate(), which will happen each time one or more variables in vars_ changed.
Definition at line 220 of file integer_expr.h.
operations_research::sat::MinPropagator::MinPropagator | ( | const std::vector< IntegerVariable > & | vars, |
IntegerVariable | min_var, | ||
IntegerTrail * | integer_trail ) |
Definition at line 556 of file integer_expr.cc.
|
delete |
This type is neither copyable nor movable.
|
delete |
|
finalvirtual |
This will be called after one or more literals that are watched by this propagator changed. It will also always be called on the first propagation cycle after registration.
Count the number of interval that are possible candidate for the min. Only the intervals for which lb > current_min_ub cannot.
Propagation a)
Propagation b)
The reason is that all the other interval start after current_min_ub. And that min_ub has its current value.
Conflict.
Almost the same as propagation b).
Implements operations_research::sat::PropagatorInterface.
Definition at line 561 of file integer_expr.cc.
void operations_research::sat::MinPropagator::RegisterWith | ( | GenericLiteralWatcher * | watcher | ) |
Definition at line 639 of file integer_expr.cc.