dlvhex
2.5.0
|
Decides when to evaluate an external atom. More...
#include <include/dlvhex2/ExternalAtomEvaluationHeuristicsInterface.h>
Public Member Functions | |
ExternalAtomEvaluationHeuristics (RegistryPtr reg) | |
virtual | ~ExternalAtomEvaluationHeuristics () |
virtual bool | doEvaluate (const ExternalAtom &eatom, InterpretationConstPtr eatomMask, InterpretationConstPtr programMask, InterpretationConstPtr partialAssignment, InterpretationConstPtr assigned, InterpretationConstPtr changed)=0 |
Decides if the reasoner shall evaluate a given external atom at this point. | |
virtual bool | frequent () |
Decides if the heuristics is called more or less frequently. | |
Protected Attributes | |
RegistryPtr | reg |
Pointer to the registry. |
Decides when to evaluate an external atom.
The implementers of this interface decide for a given (partial) assignment and an external atom if it should be evaluated at this point. Note that this is only for optimization purposes as the reasoner will automatically evaluate external atoms whenever this is necessary. However, heuristics may initiate additional calls which might trigger learning methods to add nogoods in order to guide the search.
Definition at line 57 of file ExternalAtomEvaluationHeuristicsInterface.h.
Definition at line 64 of file ExternalAtomEvaluationHeuristicsInterface.h.
virtual ExternalAtomEvaluationHeuristics::~ExternalAtomEvaluationHeuristics | ( | ) | [inline, virtual] |
Definition at line 65 of file ExternalAtomEvaluationHeuristicsInterface.h.
virtual bool ExternalAtomEvaluationHeuristics::doEvaluate | ( | const ExternalAtom & | eatom, |
InterpretationConstPtr | eatomMask, | ||
InterpretationConstPtr | programMask, | ||
InterpretationConstPtr | partialAssignment, | ||
InterpretationConstPtr | assigned, | ||
InterpretationConstPtr | changed | ||
) | [pure virtual] |
Decides if the reasoner shall evaluate a given external atom at this point.
eatom | The external atom in question. |
eatomMask | Mask with all atoms relevant for this external atom. |
programMask | All atoms in the program. |
partialAssignment | The current (partial) interpretation. |
assigned | The current set of assigned atoms; if 0, then the interpretation is complete. |
changed | The set of atoms with a (possibly) modified truth value since the last call; if NULL then all atoms have (possibly) changed. |
Implemented in TestSetMinusAtom::EAHeuristics, ExternalAtomEvaluationHeuristicsNever, ExternalAtomEvaluationHeuristicsEAComplete, ExternalAtomEvaluationHeuristicsInputComplete, ExternalAtomEvaluationHeuristicsPeriodic, and ExternalAtomEvaluationHeuristicsAlways.
virtual bool ExternalAtomEvaluationHeuristics::frequent | ( | ) | [inline, virtual] |
Decides if the heuristics is called more or less frequently.
External atom evaluation heuristics are called only when at least one relevant atom has changed since the last call. To this end, external atoms hold watches on the atoms. The number of such watches is controlled by this method. If it returns false (default), then each external atom randomly adds a watch exactly to one of the relevant atoms. If it returns true, then each external atom watches all relevant atoms. In the former case, the heuristics is only called if a particular relevant atom changes, while in the latter case it is called whenever any relevant atom changes. This might allow for earlier propagation (by nogood learning), but causes more overhead.
As a rule of thumb, heuristics which mostly decide to evaluate external atoms might want to further increase the evaluation frequency by returning true, while heuristics which mostly decide not to evaluate external atoms usually return false to avoid overhead.
Reimplemented in ExternalAtomEvaluationHeuristicsPeriodic, and ExternalAtomEvaluationHeuristicsAlways.
Definition at line 95 of file ExternalAtomEvaluationHeuristicsInterface.h.
RegistryPtr ExternalAtomEvaluationHeuristics::reg [protected] |
Pointer to the registry.
Definition at line 61 of file ExternalAtomEvaluationHeuristicsInterface.h.