Clingo
|
Represents a (partial) assignment of a particular solver. More...
#include <propagate.hh>
Public Types | |
using | value_type = SolverLiteral |
The value type, which is a solver literal. | |
using | size_type = std::size_t |
The size type. | |
using | difference_type = std::ptrdiff_t |
The difference type. | |
using | reference = value_type |
The reference type, which simply refers to the value type. | |
using | pointer = Detail::ArrowProxy< value_type > |
The pointer type, which is a proxy to the value type. | |
using | iterator = Detail::RandomAccessIterator< Assignment > |
The iterator type, which is a random access iterator over the assignment. | |
Public Member Functions | |
Assignment (clingo_assignment_t const *assignment) | |
Construct an assignment from the underlying C representation. | |
auto | size () const -> size_type |
Get the size of the assignment. | |
auto | at (size_type size) const -> value_type |
Get the literal at the given index in the assignment. | |
auto | operator[] (size_type size) const -> value_type |
Get the literal at the given index in the assignment. | |
auto | decision (ProgramId level) const -> SolverLiteral |
Get the decision literal for the given decision level. | |
auto | decision_level () const -> ProgramId |
Get the current decision level. | |
auto | has_conflict () const -> bool |
Check if the assignment is conflicting. | |
auto | contains (SolverLiteral lit) const -> bool |
Check whether the assignment contains the given literal. | |
auto | is_false (SolverLiteral lit) const -> bool |
Check if the given literal is false. | |
auto | is_fixed (SolverLiteral lit) const -> bool |
Check if the truth value of the given literal is fixed. | |
auto | is_free (SolverLiteral lit) const -> bool |
Check if the truth value of the given literal is free. | |
auto | is_true (SolverLiteral lit) const -> bool |
Check if the given literal is true. | |
auto | is_total () const -> bool |
Check whether the assignment is total. | |
auto | level (SolverLiteral lit) const -> ProgramId |
Get the level on which the given literal was assigned. | |
auto | value (SolverLiteral lit) const -> std::optional< bool > |
Get the truth value of the given literal. | |
auto | root_level () const -> ProgramId |
Get the root level of the assignment. | |
auto | trail () const -> Trail |
Get the trail of the assignment. | |
auto | begin () const -> iterator |
Get an iterator to the beginning of the assignment. | |
auto | end () const -> iterator |
Get an iterator to the end of the assignment. | |
Represents a (partial) assignment of a particular solver.
An assignment assigns truth values to a set of literals. A literal is assigned to either true or false, or is unassigned. Furthermore, each assigned literal is associated with a decision level. There is exactly one decision literal for each decision level greater than zero. Assignments to all other literals on the same level are consequences implied by the current and possibly previous decisions. Assignments on level zero are immediate consequences of the current program. Decision levels are consecutive numbers starting with zero up to and including the current decision level.
|
inline |
Get the literal at the given index in the assignment.
size | the index of the literal |
Get an iterator to the beginning of the assignment.
|
inline |
Check whether the assignment contains the given literal.
|
inline |
Get the decision literal for the given decision level.
level | the decision level to get the decision literal for |
Get the current decision level.
Get an iterator to the end of the assignment.
Check if the assignment is conflicting.
|
inline |
Check if the given literal is false.
lit | the literal to check |
|
inline |
Check if the truth value of the given literal is fixed.
lit | the literal to check |
|
inline |
Check if the truth value of the given literal is free.
lit | the literal to check |
Check whether the assignment is total.
An assignment is total if all literals are assigned a truth value,
|
inline |
Check if the given literal is true.
lit | the literal to check |
|
inline |
Get the level on which the given literal was assigned.
lit | the literal to get the level for |
|
inline |
Get the literal at the given index in the assignment.
size | the index of the literal |
Get the root level of the assignment.
Decisions levels smaller or equal to the root level are not backtracked during solving.
Get the size of the assignment.
This is the number af all positive problem literals including unassigned literals.
Get the trail of the assignment.
|
inline |
Get the truth value of the given literal.
The optional returned is empty if the literal is unassigned and, otherwise, contains the truth value of the literal.
lit | the literal to get the truth value for |