Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
Base class for all the SAT constraints. More...
#include <sat_base.h>
Public Member Functions | |
SatPropagator (const std::string &name) | |
SatPropagator (const SatPropagator &)=delete | |
This type is neither copyable nor movable. | |
SatPropagator & | operator= (const SatPropagator &)=delete |
virtual | ~SatPropagator ()=default |
void | SetPropagatorId (int id) |
Sets/Gets this propagator unique id. | |
int | PropagatorId () const |
virtual bool | Propagate (Trail *trail)=0 |
virtual void | Untrail (const Trail &, int trail_index) |
virtual absl::Span< const Literal > | Reason (const Trail &, int, int64_t) const |
bool | PropagatePreconditionsAreSatisfied (const Trail &trail) const |
######################## Implementations below ######################## | |
bool | PropagationIsDone (const Trail &trail) const |
Returns true iff all the trail was inspected by this propagator. | |
virtual bool | IsEmpty () const |
Protected Attributes | |
const std::string | name_ |
int | propagator_id_ |
int | propagation_trail_index_ |
Base class for all the SAT constraints.
Definition at line 533 of file sat_base.h.
|
inlineexplicit |
Definition at line 535 of file sat_base.h.
|
delete |
This type is neither copyable nor movable.
|
virtualdefault |
|
inlinevirtual |
Small optimization: If a propagator does not contain any "constraints" there is no point calling propagate on it. Before each propagation, the solver will checks for emptiness, and construct an optimized list of propagator before looping many time over the list.
Reimplemented in operations_research::sat::BinaryImplicationGraph, and operations_research::sat::PbConstraints.
Definition at line 605 of file sat_base.h.
|
delete |
|
pure virtual |
Inspects the trail from propagation_trail_index_ until at least one literal is propagated. Returns false iff a conflict is detected (in which case trail->SetFailingClause() must be called).
This must update propagation_trail_index_ so that all the literals before it have been propagated. In particular, if nothing was propagated, then PropagationIsDone() must return true.
Implemented in operations_research::sat::BinaryImplicationGraph, operations_research::sat::ClauseManager, operations_research::sat::EnforcementPropagator, operations_research::sat::GenericLiteralWatcher, operations_research::sat::IntegerTrail, operations_research::sat::PbConstraints, operations_research::sat::PrecedencesPropagator, and operations_research::sat::SymmetryPropagator.
|
inline |
######################## Implementations below ########################
Returns true if all the preconditions for Propagate() are satisfied. This is just meant to be used in a DCHECK.
Definition at line 617 of file sat_base.h.
|
inline |
Returns true iff all the trail was inspected by this propagator.
Definition at line 597 of file sat_base.h.
|
inline |
Definition at line 545 of file sat_base.h.
|
inlinevirtual |
Explains why the literal at given trail_index was propagated by returning a reason for this propagation. This will only be called for literals that are on the trail and were propagated by this class.
The interpretation is that because all the literals of a reason were assigned to false, we could deduce the assignment of the given variable.
The returned Span has to be valid until the literal is untrailed. A client can use trail_.GetEmptyVectorToStoreReason() if it doesn't have a memory location that already contains the reason.
If conlict id is positive, then this is called during first UIP resolution and we will backtrack over this literal right away, so we don't need to have a span that survive more than once.
Reimplemented in operations_research::sat::BinaryImplicationGraph, operations_research::sat::ClauseManager, operations_research::sat::IntegerTrail, operations_research::sat::PbConstraints, and operations_research::sat::SymmetryPropagator.
Definition at line 585 of file sat_base.h.
|
inline |
Sets/Gets this propagator unique id.
Definition at line 544 of file sat_base.h.
|
inlinevirtual |
Reverts the state so that all the literals with a trail index greater or equal to the given one are not processed for propagation. Note that the trail current decision level is already reverted before this is called.
Reimplemented in operations_research::sat::EnforcementPropagator, operations_research::sat::GenericLiteralWatcher, operations_research::sat::IntegerTrail, operations_research::sat::PbConstraints, operations_research::sat::PrecedencesPropagator, and operations_research::sat::SymmetryPropagator.
Definition at line 567 of file sat_base.h.
|
protected |
Definition at line 608 of file sat_base.h.
|
protected |
Definition at line 610 of file sat_base.h.
|
protected |
Definition at line 609 of file sat_base.h.