dlvhex
2.5.0
|
Instantiates nonground nogoods stepwise according to the current interpretation. More...
#include <include/dlvhex2/NogoodGrounder.h>
Public Member Functions | |
LazyNogoodGrounder (RegistryPtr reg, SimpleNogoodContainerPtr watched, SimpleNogoodContainerPtr destination, AnnotatedGroundProgram &agp) | |
Initializes the nogood grounder for a container of watched nogoods and a destination for resulting ground nogoods. | |
virtual void | update (InterpretationConstPtr partialInterpretation=InterpretationConstPtr(), InterpretationConstPtr factWasSet=InterpretationConstPtr(), InterpretationConstPtr changed=InterpretationConstPtr()) |
Makes another grounding step. | |
virtual void | resetWatched (SimpleNogoodContainerPtr watched) |
Changes the watched nogood container. | |
Private Attributes | |
int | watchedNogoodsCount |
Number of currently watched nogoods. | |
std::vector< std::pair< ID, int > > | watchedLiterals |
Stores for all literals the indexes of nogoods which watch it. | |
std::set< std::pair< IDAddress, int > > | alreadyCompared |
Stores which atom was already compared to which nonground nogood. |
Instantiates nonground nogoods stepwise according to the current interpretation.
That is, a nogood is instantiated if one of its atoms unifies with the current partial interpretation.
Definition at line 117 of file NogoodGrounder.h.
LazyNogoodGrounder::LazyNogoodGrounder | ( | RegistryPtr | reg, |
SimpleNogoodContainerPtr | watched, | ||
SimpleNogoodContainerPtr | destination, | ||
AnnotatedGroundProgram & | agp | ||
) |
Initializes the nogood grounder for a container of watched nogoods and a destination for resulting ground nogoods.
reg | RegistryPtr |
watched | A container with the nogoods to ground |
destination | The container where the resulting nogoods shall be added (possibly the same as watched) |
agp | The ground program for which the nogoods shall be learned |
Definition at line 183 of file NogoodGrounder.cpp.
void LazyNogoodGrounder::resetWatched | ( | SimpleNogoodContainerPtr | watched | ) | [virtual] |
Changes the watched nogood container.
watched | Pointer to the new watched nogood container |
Reimplemented from NogoodGrounder.
Definition at line 280 of file NogoodGrounder.cpp.
void LazyNogoodGrounder::update | ( | InterpretationConstPtr | partialInterpretation = InterpretationConstPtr() , |
InterpretationConstPtr | factWasSet = InterpretationConstPtr() , |
||
InterpretationConstPtr | changed = InterpretationConstPtr() |
||
) | [virtual] |
Makes another grounding step.
partialInterpretation | The current (partial) assignment |
factWasSet | The atoms which have been assigned so far |
changed | The changes in partialInterpretation since the last call (possibly helps the grounder to find relevant ground instances) |
Implements NogoodGrounder.
Definition at line 189 of file NogoodGrounder.cpp.
References ID::address, alreadyCompared, DBGLOG, NogoodGrounder::destination, Nogood::getStringRepresentation(), ID_FAIL(), Nogood::isGround(), ID::isOrdinaryGroundAtom(), ID::isVariableTerm(), NogoodGrounder::reg, Atom::tuple, OrdinaryAtom::unifiesWith(), NogoodGrounder::watched, watchedLiterals, and watchedNogoodsCount.
std::set<std::pair<IDAddress, int> > LazyNogoodGrounder::alreadyCompared [private] |
Stores which atom was already compared to which nonground nogood.
Definition at line 125 of file NogoodGrounder.h.
Referenced by update().
std::vector<std::pair<ID, int> > LazyNogoodGrounder::watchedLiterals [private] |
Stores for all literals the indexes of nogoods which watch it.
Definition at line 123 of file NogoodGrounder.h.
Referenced by update().
int LazyNogoodGrounder::watchedNogoodsCount [private] |
Number of currently watched nogoods.
Definition at line 121 of file NogoodGrounder.h.
Referenced by update().