Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <clause.h>
Public Member Functions | |
void | operator delete (void *p) |
Non-sized delete because this is a tail-padded class. | |
int | size () const |
Number of literals in the clause. | |
int | IsRemoved () const |
const Literal * | begin () const |
Allows for range based iteration: for (Literal literal : clause) {}. | |
const Literal * | end () const |
Literal | FirstLiteral () const |
Literal | SecondLiteral () const |
Literal | PropagatedLiteral () const |
absl::Span< const Literal > | PropagationReason () const |
absl::Span< const Literal > | AsSpan () const |
Returns a Span<> representation of the clause. | |
bool | RemoveFixedLiteralsAndTestIfTrue (const VariablesAssignment &assignment) |
bool | IsSatisfied (const VariablesAssignment &assignment) const |
std::string | DebugString () const |
Static Public Member Functions | |
static SatClause * | Create (absl::Span< const Literal > literals) |
--— SatClause --— | |
Friends | |
class | ClauseManager |
This is how the SatSolver stores a clause. A clause is just a disjunction of literals. In many places, we just use vector<literal> to encode one. But in the critical propagation code, we use this class to remove one memory indirection.
|
inline |
|
inline |
|
static |
--— SatClause --—
Creates a sat clause. There must be at least 2 literals. Clause with one literal fix variable directly and are never constructed.
static
std::string operations_research::sat::SatClause::DebugString | ( | ) | const |
|
inline |
|
inline |
|
inline |
We re-use the size to lazily remove clause and notify that they need to be deleted. It is why this is not called empty() to emphasis that fact. Note that we never create an initially empty clause, so there is no confusion with an infeasible model with an empty clause inside.
bool operations_research::sat::SatClause::IsSatisfied | ( | const VariablesAssignment & | assignment | ) | const |
|
inline |
|
inline |
|
inline |
Returns the reason for the last unit propagation of this clause. The preconditions are the same as for PropagatedLiteral(). Note that we don't need to include the propagated literal.
bool operations_research::sat::SatClause::RemoveFixedLiteralsAndTestIfTrue | ( | const VariablesAssignment & | assignment | ) |
Removes literals that are fixed. This should only be called at level 0 where a literal is fixed iff it is assigned. Aborts and returns true if they are not all false.
|
inline |
|
inline |
|
friend |