Clingo
|
An instantiator implementing the basic grounding algorithm. More...
#include <instantiator.hh>
Public Types | |
using | DependVec = std::vector< size_t > |
A vector of Matcher indices. | |
Public Member Functions | |
Instantiator (InstanceCallback &icb, size_t vars, size_t n) | |
Construct an instantiator with the given instance callback and number of variables. | |
void | init (InstantiationContext const &ctx, size_t gen) |
Prepare the instantiator for the first grounding step (with generation 0). | |
void | add (UMatcher matcher, DependVec depends) |
Finalize the instantiator. | |
void | finalize (DependVec depends) |
Finalize the instantiator. | |
auto | enqueue () -> bool |
Mark enqueued for instantiation. | |
auto | instantiate (Logger &log, SymbolStore &store, OutputStm &out) -> bool |
Find all assignments for the added matchers. | |
void | propagate (SymbolStore &store, OutputStm &out, Queue &queue) |
Add instantiators that need grounding to queue. | |
void | print (std::ostream &out) const |
Print the instantiator. | |
auto | priority () const |
The priority of the instantiator. | |
Friends | |
auto | operator<< (std::ostream &out, Instantiator const &inst) -> std::ostream & |
Print the instantiator. | |
An instantiator implementing the basic grounding algorithm.
Finalize the instantiator.
The depend vector must point to matchers that bind relevant variables for the matcher. For example, if the given matcher depends on variables X and Y, then we can backjump to the closest matcher that provides a binding for X or Y.
auto CppClingo::Ground::Instantiator::enqueue | ( | ) | -> bool |
Mark enqueued for instantiation.
This returns true if the instantiator was previously not enqueued. The enqueued flag is rest when calling instantiate.
void CppClingo::Ground::Instantiator::finalize | ( | DependVec | depends | ) |
Finalize the instantiator.
The depend vector must point to matchers that bind relevant variables. Relevant variables are variables in rule heads but also variables bound by non-domain predicates.
void CppClingo::Ground::Instantiator::init | ( | InstantiationContext const & | ctx, |
size_t | gen | ||
) |
Prepare the instantiator for the first grounding step (with generation 0).
This resets all involved domains.
auto CppClingo::Ground::Instantiator::instantiate | ( | Logger & | log, |
SymbolStore & | store, | ||
OutputStm & | out | ||
) | -> bool |
Find all assignments for the added matchers.
Assignments are reported via the InstanceCallback.