dlvhex  2.5.0
ExternalAtomEvaluationHeuristicsPeriodic Class Reference

Evaluates in regular intervals. More...

#include <include/dlvhex2/ExternalAtomEvaluationHeuristics.h>

Inheritance diagram for ExternalAtomEvaluationHeuristicsPeriodic:
Collaboration diagram for ExternalAtomEvaluationHeuristicsPeriodic:

Public Member Functions

 ExternalAtomEvaluationHeuristicsPeriodic (RegistryPtr reg)
virtual bool doEvaluate (const ExternalAtom &eatom, InterpretationConstPtr eatomMask, InterpretationConstPtr programMask, InterpretationConstPtr partialAssignment, InterpretationConstPtr assigned, InterpretationConstPtr changed)
 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.

Private Attributes

int counter
 Counts the number of calls to doEvaluate.

Detailed Description

Evaluates in regular intervals.

Definition at line 75 of file ExternalAtomEvaluationHeuristics.h.


Constructor & Destructor Documentation


Member Function Documentation

bool ExternalAtomEvaluationHeuristicsPeriodic::doEvaluate ( const ExternalAtom eatom,
InterpretationConstPtr  eatomMask,
InterpretationConstPtr  programMask,
InterpretationConstPtr  partialAssignment,
InterpretationConstPtr  assigned,
InterpretationConstPtr  changed 
) [virtual]

Decides if the reasoner shall evaluate a given external atom at this point.

Parameters:
eatomThe external atom in question.
eatomMaskMask with all atoms relevant for this external atom.
programMaskAll atoms in the program.
partialAssignmentThe current (partial) interpretation.
assignedThe current set of assigned atoms; if 0, then the interpretation is complete.
changedThe set of atoms with a (possibly) modified truth value since the last call; if NULL then all atoms have (possibly) changed.
Returns:
True if the heuristics suggests to evaluate the external atom, otherwise false.

Implements ExternalAtomEvaluationHeuristics.

Definition at line 74 of file ExternalAtomEvaluationHeuristics.cpp.

References counter.

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.

Returns:
True if the heuristics wants to be called more frequently, otherwise false.

Reimplemented from ExternalAtomEvaluationHeuristics.

Definition at line 89 of file ExternalAtomEvaluationHeuristics.cpp.


Field Documentation

Counts the number of calls to doEvaluate.

Definition at line 79 of file ExternalAtomEvaluationHeuristics.h.

Referenced by doEvaluate().


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