dlvhex  2.5.0
LazyNogoodGrounder Class Reference

Instantiates nonground nogoods stepwise according to the current interpretation. More...

#include <include/dlvhex2/NogoodGrounder.h>

Inheritance diagram for LazyNogoodGrounder:
Collaboration diagram for LazyNogoodGrounder:

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.

Detailed Description

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.


Constructor & Destructor Documentation

Initializes the nogood grounder for a container of watched nogoods and a destination for resulting ground nogoods.

Parameters:
regRegistryPtr
watchedA container with the nogoods to ground
destinationThe container where the resulting nogoods shall be added (possibly the same as watched)
agpThe ground program for which the nogoods shall be learned

Definition at line 183 of file NogoodGrounder.cpp.


Member Function Documentation

Changes the watched nogood container.

Parameters:
watchedPointer to the new watched nogood container

Reimplemented from NogoodGrounder.

Definition at line 280 of file NogoodGrounder.cpp.

Makes another grounding step.

Parameters:
partialInterpretationThe current (partial) assignment
factWasSetThe atoms which have been assigned so far
changedThe 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.


Field Documentation

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().

Number of currently watched nogoods.

Definition at line 121 of file NogoodGrounder.h.

Referenced by update().


The documentation for this class was generated from the following files: