dlvhex  2.5.0
UnfoundedSetCheckHeuristics Class Reference

Decides when to do an unfounded set check (over partial interpretations) More...

#include <include/dlvhex2/UnfoundedSetCheckHeuristicsInterface.h>

Inheritance diagram for UnfoundedSetCheckHeuristics:
Collaboration diagram for UnfoundedSetCheckHeuristics:

Public Member Functions

 UnfoundedSetCheckHeuristics (const AnnotatedGroundProgram &groundProgram, RegistryPtr reg)
virtual bool doUFSCheck (InterpretationConstPtr verifiedAuxes, InterpretationConstPtr partialAssignment, InterpretationConstPtr assigned, InterpretationConstPtr changed)=0
 Decides if the reasoner shall do an unfounded set check at this point.
virtual void notify (InterpretationConstPtr verifiedAuxes, InterpretationConstPtr partialAssignment, InterpretationConstPtr assigned, InterpretationConstPtr changed)
 Notifies the heuristic about changes in the assignment, although the caller is not going to perform an UFS check at this point.
void updateSkipProgram (InterpretationConstPtr verifiedAuxes, InterpretationConstPtr partialAssignment, InterpretationConstPtr assigned, InterpretationConstPtr changed)
 Updates the skip program according to a new partial assignment.
const std::set< ID > & getSkipProgram () const
 Returns a reference to the current skip program.

Protected Attributes

RegistryPtr reg
 Pointer to the registry.
const AnnotatedGroundProgramgroundProgram
 Reference to the ground program for which the initation of unfounded set checks shall be decided.
InterpretationPtr previouslyAssignedAndVerifiedAtoms
 stores the atoms which were assigned and verified when the skipProgram was updated last time.
InterpretationPtr notYetVerifiedExternalAtoms
 Remembers external atom replacement atoms which have already been assigned but could not be verified yet.
std::map< IDAddress, std::set
< int > > 
rulesOfAtom
 Stores for each atom in which rule (identified by its index in the ground program) it occurs (positively or negatively).
std::vector< int > atomsInRule
 Stores for each rule (address) the number of total and of currently assigned and verified atoms.
std::vector< int > assignedAndVerifiedAtomsInRule
std::set< IDskipProgram
 See UnfoundedSetCheckHeuristics::updateSkipProgram and UnfoundedSetCheckHeuristics::getSkipProgram.

Detailed Description

Decides when to do an unfounded set check (over partial interpretations)

The implementers of this interface decide for a given (partial) assignment if a minimality check shall be performed at this point. Note that this is only for optimization purposes as the reasoner will automatically do such a check whenever it is necessary. However, heuristics may initiate additional checks to possibly detect unfounded atoms earlier. Base class for all unfounded set check heuristics.

Definition at line 63 of file UnfoundedSetCheckHeuristicsInterface.h.


Constructor & Destructor Documentation


Member Function Documentation

virtual bool UnfoundedSetCheckHeuristics::doUFSCheck ( InterpretationConstPtr  verifiedAuxes,
InterpretationConstPtr  partialAssignment,
InterpretationConstPtr  assigned,
InterpretationConstPtr  changed 
) [pure virtual]

Decides if the reasoner shall do an unfounded set check at this point.

Parameters:
verifiedAuxesThe set of verified external atom auxiliaries wrt. the current partial interpretation
partialAssignmentThe current (partial) interpretation
assignedThe current set of assigned atoms; if NULL, then the interpretation is complete
changedThe set of atoms with a (possibly) modified truth value since the last call of this method; if NULL, then all atoms have changed
Returns:
True if the heuristics decides to do an unfounded set check now, and false otherwise.

Implemented in UnfoundedSetCheckHeuristicsPeriodic, UnfoundedSetCheckHeuristicsMax, and UnfoundedSetCheckHeuristicsPost.

const std::set<ID>& UnfoundedSetCheckHeuristics::getSkipProgram ( ) const [inline]

Returns a reference to the current skip program.

The method UnfoundedSetCheckHeuristics::updateSkipProgram should be called before this method is used.

Returns:
The current set of rules which are not fully assigned and thus have to be excluded from UFS checks.

Definition at line 129 of file UnfoundedSetCheckHeuristicsInterface.h.

void UnfoundedSetCheckHeuristics::notify ( InterpretationConstPtr  verifiedAuxes,
InterpretationConstPtr  partialAssignment,
InterpretationConstPtr  assigned,
InterpretationConstPtr  changed 
) [virtual]

Notifies the heuristic about changes in the assignment, although the caller is not going to perform an UFS check at this point.

This allows the heuristic to update internal data structures.

Parameters:
partialAssignmentThe current (partial) interpretation
assignedThe current set of assigned atoms; if NULL, then the interpretation is complete
changedThe set of atoms with a (possibly) modified truth value since the last call of this method; if NULL, then all atoms have changed

Definition at line 102 of file UnfoundedSetCheckHeuristicsInterface.cpp.

Updates the skip program according to a new partial assignment.

The skip program is the set of rules which are currently not (fully) assignment and thus have to be excluded from UFS checks.

Parameters:
partialAssignmentThe current (partial) interpretation
assignedThe current set of assigned atoms; if NULL, then the interpretation is complete
changedThe set of atoms with a (possibly) modified truth value since the last call of this method; if NULL, then all atoms have changed

Definition at line 107 of file UnfoundedSetCheckHeuristicsInterface.cpp.

References ID::address, assignedAndVerifiedAtomsInRule, atomsInRule, Rule::body, DBGLOG, AnnotatedGroundProgram::getGroundProgram(), groundProgram, Rule::head, OrdinaryASPProgram::idb, Rule::isEAGuessingRule(), ID::isExternalAuxiliary(), notYetVerifiedExternalAtoms, previouslyAssignedAndVerifiedAtoms, RawPrinter::print(), reg, rulesOfAtom, skipProgram, and RawPrinter::toString().


Field Documentation

std::vector<int> UnfoundedSetCheckHeuristics::atomsInRule [protected]

Stores for each rule (address) the number of total and of currently assigned and verified atoms.

Definition at line 84 of file UnfoundedSetCheckHeuristicsInterface.h.

Referenced by UnfoundedSetCheckHeuristics(), and updateSkipProgram().

Reference to the ground program for which the initation of unfounded set checks shall be decided.

Definition at line 72 of file UnfoundedSetCheckHeuristicsInterface.h.

Referenced by updateSkipProgram().

Remembers external atom replacement atoms which have already been assigned but could not be verified yet.

Definition at line 78 of file UnfoundedSetCheckHeuristicsInterface.h.

Referenced by UnfoundedSetCheckHeuristics(), and updateSkipProgram().

stores the atoms which were assigned and verified when the skipProgram was updated last time.

Definition at line 75 of file UnfoundedSetCheckHeuristicsInterface.h.

Referenced by UnfoundedSetCheckHeuristics(), and updateSkipProgram().

Pointer to the registry.

Definition at line 69 of file UnfoundedSetCheckHeuristicsInterface.h.

Referenced by updateSkipProgram().

std::map<IDAddress, std::set<int> > UnfoundedSetCheckHeuristics::rulesOfAtom [protected]

Stores for each atom in which rule (identified by its index in the ground program) it occurs (positively or negatively).

Definition at line 81 of file UnfoundedSetCheckHeuristicsInterface.h.

Referenced by UnfoundedSetCheckHeuristics(), and updateSkipProgram().


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