Clingo
|
State to capture a set of conditional literals. More...
#include <condlit.hh>
Public Member Functions | |
StateCondLit (std::pmr::monotonic_buffer_resource &mbr, VariableVec local, VariableVec global, size_t index, bool has_conclusion, bool sp_premise, bool domain) | |
Construct an empty state. | |
void | vars (VariableSet &res, bool all) const |
Get the variables occurring in the conditional literal. | |
auto | vars (bool all) const -> VariableSet |
Get the variables occurring in the conditional literal. | |
auto | vars_global () const -> VariableVec const & |
Get the global variables of the literal. | |
auto | vars_local () const -> VariableVec const & |
Get the local variables of the literal. | |
auto | index () const -> size_t |
Get the update index of the conditional literal. | |
auto | add_empty (Assignment const &ass) -> std::pair< MapAtomCondLit::iterator, bool > |
Add a new cond lit atom. | |
auto | add_premise (EvalContext const &ctx, ULitVec const &premise) -> bool |
Add a new cond lit element with the given premise. | |
void | add_conclusion (Assignment const &ass, MapAtomCondLit::iterator it, size_t conclusion, bool fact) |
Add a conclusion to an element. | |
auto | propagate () -> bool |
Propagate enqueued conditional literals whose elements are not blocked. | |
auto | domain () const -> bool |
Return true if all contained literals are domain. | |
auto | base_empty () -> BaseCondLitEmpty & |
Get the base containing all conditional literals encountered during grounding. | |
auto | base_premise () -> BaseCondLitPremise & |
Get the base containing all premises of conditional literals. | |
auto | base_lit () -> BaseCondLit & |
Get the base containing all conditional literals that have been derived. | |
auto | atom_find (Assignment const &ass) -> MapAtomCondLit::iterator |
Find an atom given an assignment and return an iterator to it. | |
auto | atom_index (Assignment const &ass) -> std::optional< size_t > |
Find an atom given an assignment and return its index. | |
auto | atom_index (MapAtomCondLit::const_iterator it) const -> size_t |
Turn an iterator into an atom index. | |
auto | atom_nth (size_t index) -> MapAtomCondLit::iterator |
Turn an atom index into an iterator. | |
auto | atom_is_fact (MapAtomCondLit::iterator it) -> bool |
Check if the given atom is a fact. | |
auto | elem_find (Assignment const &ass, MapAtomCondLit::iterator it) -> MapElemCondLit::iterator |
Get an iterator to an element given an assignment. | |
auto | elem_index (MapElemCondLit::const_iterator it) const -> size_t |
Turn an iterator into an element index. | |
void | output (Logger &log, SymbolStore &store, OutputStm &out) override |
Output the now complete conditional literal. | |
![]() | |
virtual | ~State ()=default |
Destructor. | |
State to capture a set of conditional literals.
auto CppClingo::Ground::StateCondLit::add_premise | ( | EvalContext const & | ctx, |
ULitVec const & | premise | ||
) | -> bool |
Add a new cond lit element with the given premise.
If the function returns false the corresponding conditional literal is false.
auto CppClingo::Ground::StateCondLit::atom_find | ( | Assignment const & | ass | ) | -> MapAtomCondLit::iterator |
Find an atom given an assignment and return an iterator to it.
Assumes that all global variables are bound. Returns an end iterator if the atom does not exist.
auto CppClingo::Ground::StateCondLit::atom_index | ( | Assignment const & | ass | ) | -> std::optional< size_t > |
Find an atom given an assignment and return its index.
Assumes that all global variables are bound.
auto CppClingo::Ground::StateCondLit::atom_is_fact | ( | MapAtomCondLit::iterator | it | ) | -> bool |
Check if the given atom is a fact.
Note that it is not sufficient to check the fact state of the atom.
auto CppClingo::Ground::StateCondLit::base_lit | ( | ) | -> BaseCondLit & |
Get the base containing all conditional literals that have been derived.
This is a subset of the empty base.
auto CppClingo::Ground::StateCondLit::elem_find | ( | Assignment const & | ass, |
MapAtomCondLit::iterator | it | ||
) | -> MapElemCondLit::iterator |
Get an iterator to an element given an assignment.
Assumes that the given atom iterator points to a valid atom and all local and global variables are bound. Returns an end iterator if the atom does not exist.
|
overridevirtual |
Output the now complete conditional literal.
Implements CppClingo::Ground::State.