dlvhex
2.5.0
|
Stores an external atom of form &<predicate>[<inputs>](<outputs>). More...
#include <include/dlvhex2/Atoms.h>
Public Types | |
typedef std::vector< std::list < unsigned > > | AuxInputMapping |
Public Member Functions | |
ExternalAtom (IDKind kind, ID predicate, const Tuple &inputs, const Tuple &outputs) | |
Constructor. | |
ExternalAtom (IDKind kind) | |
Constructor. | |
~ExternalAtom () | |
ExternalAtom (const ExternalAtom &ea) | |
Copy constructor. | |
void | operator= (const ExternalAtom &ea) |
Assignment operator. | |
const ExtSourceProperties & | getExtSourceProperties () const |
std::ostream & | print (std::ostream &o) const |
void | updatePredicateInputMask () const |
Updates inputMask (creates mask with registry if it does not exist). | |
InterpretationConstPtr | getPredicateInputMask () const |
Returns the predicate input mask. | |
InterpretationConstPtr | getAuxInputMask () const |
Returns the auxiliary input mask. | |
Data Fields | |
ID | predicate |
External atom name (constant term). | |
Tuple | inputs |
Input terms (in squared brackets). | |
PluginAtom * | pluginAtom |
POD-style pointer to plugin atom. | |
ID | auxInputPredicate |
Auxiliary input predicate for this occurance in this rule, ID_FAIL if no input here. | |
AuxInputMapping | auxInputMapping |
This mapping stores for each argument of auxInputPredicate a list of positions in the input tuple where this argument applies. | |
boost::shared_ptr< PredicateMask > | inputMask |
inputMask stores a bitmask to project interpretations to relevant predicate inputs. | |
boost::shared_ptr< PredicateMask > | auxInputMask |
Similarly we store a bitmask for all ogatoms with predicate auxInputPredicate. | |
ExtSourceProperties | prop |
Properties of this external atom. |
Stores an external atom of form &<predicate>[<inputs>](<outputs>).
This is one concrete atom in one rule. The general external atom functionality provided by the user is PluginAtom.
typedef std::vector<std::list<unsigned> > ExternalAtom::AuxInputMapping |
ExternalAtom::ExternalAtom | ( | IDKind | kind, |
ID | predicate, | ||
const Tuple & | inputs, | ||
const Tuple & | outputs | ||
) | [inline] |
Constructor.
kind | See Atom::kind. |
predicate | See ExternalAtom::predicate. |
inputs | See ExternalAtom::inputs. |
outputs | Output elements of the external atom, stored in Atom::tuple. |
ExternalAtom::ExternalAtom | ( | IDKind | kind | ) | [inline] |
ExternalAtom::ExternalAtom | ( | const ExternalAtom & | ea | ) | [inline] |
Copy constructor.
ea | External atom to copy. |
Definition at line 405 of file Atoms.h.
References auxInputMapping, auxInputMask, auxInputPredicate, ExtSourceProperties::ea, inputMask, inputs, pluginAtom, predicate, and prop.
InterpretationConstPtr ExternalAtom::getAuxInputMask | ( | ) | const [inline] |
Returns the auxiliary input mask.
Definition at line 452 of file Atoms.h.
Referenced by BaseModelGenerator::buildEAtomInputTuples(), ExternalAtomEvaluationHeuristicsInputComplete::doEvaluate(), and BaseModelGenerator::learnSupportSetsForExternalAtom().
const ExtSourceProperties & ExternalAtom::getExtSourceProperties | ( | ) | const |
Definition at line 406 of file Atoms.cpp.
References prop.
Referenced by LiberalSafetyChecker::addBoundedVariable(), ComponentGraph::calculateStratificationInfo(), AnnotatedGroundProgram::computeAdditionalDependencies(), AnnotatedGroundProgram::computeAtomDependencyGraph(), ComponentGraph::computeCollapsedComponentInfos(), BaseModelGenerator::computeExtensionOfDomainPredicates(), DependencyGraph::createExternalPredicateInputDependencies(), DependencyGraph::createNodesAndIntraRuleDependenciesForBody(), GenuineGuessAndCheckModelGenerator::initializeHeuristics(), GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), UnfoundedSetChecker::isUnfoundedSet(), GenuineGuessAndCheckModelGenerator::learnSupportSets(), BaseModelGenerator::learnSupportSetsForExternalAtom(), DLVHEX_NAMESPACE_BEGIN::FinitenessChecker::run(), DLVHEX_NAMESPACE_BEGIN::FiniteFiberChecker::run(), GenuineGuessAndCheckModelGenerator::verifyExternalAtom(), GenuineGuessAndCheckModelGenerator::verifyExternalAtoms(), and AnnotatedGroundProgram::verifyExternalAtomsUsingCompleteSupportSets().
InterpretationConstPtr ExternalAtom::getPredicateInputMask | ( | ) | const [inline] |
Returns the predicate input mask.
Definition at line 448 of file Atoms.h.
Referenced by AnnotatedGroundProgram::computeAtomDependencyGraph(), BaseModelGenerator::computeExtensionOfDomainPredicates(), AssumptionBasedUnfoundedSetChecker::constructUFSDetectionProblemBasicEABehavior(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemOptimizationPartBasicEAKnowledge(), ExternalAtomEvaluationHeuristicsInputComplete::doEvaluate(), BaseModelGenerator::evaluateExternalAtom(), BaseModelGenerator::learnSupportSetsForExternalAtom(), BaseModelGenerator::projectEAtomInputInterpretation(), and PluginAtom::splitQuery().
void ExternalAtom::operator= | ( | const ExternalAtom & | ea | ) | [inline] |
Assignment operator.
ea | External atom to copy. |
Definition at line 421 of file Atoms.h.
References auxInputMapping, auxInputMask, auxInputPredicate, ExtSourceProperties::ea, inputMask, inputs, pluginAtom, predicate, and prop.
std::ostream & ExternalAtom::print | ( | std::ostream & | o | ) | const |
Definition at line 412 of file Atoms.cpp.
References auxInputPredicate, PluginAtom::getPredicate(), PluginAtom::getRegistry(), ID_FAIL(), inputs, pluginAtom, predicate, printptr(), printvector(), and Atom::tuple.
void ExternalAtom::updatePredicateInputMask | ( | ) | const |
Updates inputMask (creates mask with registry if it does not exist).
Needs a non-expired pluginAtom pointer (this is only asserted). Uses pluginAtom pointer to get the registry. We make this const so that we can call it on eatoms in ExternalAtomTable. TODO rename this method to updateMasks().
Definition at line 447 of file Atoms.cpp.
References auxInputMask, auxInputPredicate, DBGLOG_VSCOPE, PluginAtom::getRegistry(), ID_FAIL(), inputMask, and pluginAtom.
Referenced by AnnotatedGroundProgram::computeAdditionalDependencies(), AnnotatedGroundProgram::computeAtomDependencyGraph(), BaseModelGenerator::computeExtensionOfDomainPredicates(), AssumptionBasedUnfoundedSetChecker::constructUFSDetectionProblemBasicEABehavior(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemOptimizationPartBasicEAKnowledge(), ExternalAtomEvaluationHeuristicsInputComplete::doEvaluate(), BaseModelGenerator::evaluateExternalAtom(), and BaseModelGenerator::learnSupportSetsForExternalAtom().
This mapping stores for each argument of auxInputPredicate a list of positions in the input tuple where this argument applies.
E.g., for &foo[a,C,d,X,C]() we have
Definition at line 340 of file Atoms.h.
Referenced by BaseModelGenerator::buildEAtomInputTuples(), DependencyGraph::createAuxiliaryRuleIfRequired(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), ExternalAtom(), ExternalAtomMask::matchOutputAtom(), and operator=().
boost::shared_ptr<PredicateMask> ExternalAtom::auxInputMask [mutable] |
Similarly we store a bitmask for all ogatoms with predicate auxInputPredicate.
Definition at line 359 of file Atoms.h.
Referenced by DependencyGraph::createAuxiliaryRuleIfRequired(), ExternalAtom(), operator=(), and updatePredicateInputMask().
Auxiliary input predicate for this occurance in this rule, ID_FAIL if no input here.
Definition at line 324 of file Atoms.h.
Referenced by BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), BaseModelGenerator::buildEAtomInputTuples(), ComponentGraph::computeCollapsedComponentInfos(), BaseModelGeneratorFactory::convertRuleBody(), DependencyGraph::createAuxiliaryRuleIfRequired(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), ExternalAtomEvaluationHeuristicsInputComplete::doEvaluate(), BaseModelGenerator::evaluateExternalAtom(), BaseModelGenerator::evaluateExternalAtomQuery(), ExternalAtom(), BaseModelGenerator::learnSupportSetsForExternalAtom(), ExternalAtomMask::matchOutputAtom(), operator=(), print(), ExternalAtomMask::updateMask(), and updatePredicateInputMask().
boost::shared_ptr<PredicateMask> ExternalAtom::inputMask [mutable] |
inputMask stores a bitmask to project interpretations to relevant predicate inputs.
Kind of a cache: interpretation with all ground atoms set that must be passed to the pluginAtom for subsequent calls this must be extended (new values may have been invented), but this extension need only look to the bits not yet covered by predicateInputMask.
updatePredicateInputMask may update this while this object is stored in an ExternalAtomTable (where only const refs can be retrieved) we should be fine "as long as we don't use predicateInputMask in an index of the multi_index_container"
Definition at line 357 of file Atoms.h.
Referenced by DependencyGraph::createExternalPredicateInputDependencies(), ExternalAtom(), operator=(), and updatePredicateInputMask().
Input terms (in squared brackets).
Definition at line 309 of file Atoms.h.
Referenced by LiberalSafetyChecker::addBoundedVariable(), LiberalSafetyChecker::addDomainExpansionSafeAttribute(), BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), BaseModelGenerator::buildEAtomInputTuples(), ComponentGraph::calculatePredicatesOfComponent(), ComponentGraph::calculateStratificationInfo(), FunctionRewriter::composeTerm(), AnnotatedGroundProgram::computeAdditionalDependencies(), AnnotatedGroundProgram::computeAtomDependencyGraph(), ComponentGraph::computeCollapsedComponentInfos(), BaseModelGenerator::computeExtensionOfDomainPredicates(), ComponentGraph::computeRecursiveAggregatesInComponent(), BaseModelGeneratorFactory::convertRuleBody(), DependencyGraph::createAuxiliaryRuleIfRequired(), LiberalSafetyChecker::createDependencyGraph(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), DependencyGraph::createExternalPredicateInputDependencies(), DependencyGraph::createNodesAndIntraRuleDependenciesForBody(), LiberalSafetyChecker::createPreconditionsAndLocationIndices(), FunctionRewriter::decomposeTerm(), BaseModelGenerator::evaluateExternalAtom(), BaseModelGenerator::evaluateExternalAtomQuery(), ExternalAtom(), Registry::getVariablesInID(), ExtSourceProperties::interpretProperties(), BaseModelGenerator::learnSupportSetsForExternalAtom(), ExternalAtomMask::matchOutputAtom(), sem< HexGrammarSemantics::externalAtom >::operator()(), sem< FunctionParserModuleTermSemantics::functionTermConstruct >::operator()(), sem< FunctionParserModuleAtomSemantics::functionTermEval >::operator()(), operator=(), InternalGrounder::preprocessRule(), RawPrinter::print(), print(), FunctionRewriter::rewrite(), DLVHEX_NAMESPACE_BEGIN::FinitenessChecker::run(), and DLVHEX_NAMESPACE_BEGIN::FiniteFiberChecker::run().
PluginAtom* ExternalAtom::pluginAtom [mutable] |
POD-style pointer to plugin atom.
(cannot be indexed in multi_index_container as it is mutable)
This is a POD-style pointer as the target object is dynamically loaded shared library code, which cannot be weak_ptr- or shared_ptr-managed. (TODO use a weak ptr here with an empty deleter and adjust everything accordingly, then the shared library problem disappears and there is transparent and correct memory management)
Definition at line 321 of file Atoms.h.
Referenced by ComponentGraph::calculatePredicatesOfComponent(), ComponentGraph::calculateStratificationInfo(), AnnotatedGroundProgram::computeAdditionalDependencies(), ComponentGraph::computeCollapsedComponentInfos(), BaseModelGenerator::computeExtensionOfDomainPredicates(), ComponentGraph::computeRecursiveAggregatesInComponent(), BaseModelGeneratorFactory::convertRuleBody(), LiberalSafetyChecker::createDependencyGraph(), DependencyGraph::createExternalPredicateInputDependencies(), DependencyGraph::createNodesAndIntraRuleDependenciesForBody(), LiberalSafetyChecker::createPreconditionsAndLocationIndices(), BaseModelGenerator::evaluateExternalAtom(), BaseModelGenerator::evaluateExternalAtomQuery(), ExternalAtom(), GenuineGuessAndCheckModelGenerator::initializeHeuristics(), ExtSourceProperties::isAntimonotonic(), ExtSourceProperties::isMonotonic(), BaseModelGenerator::learnSupportSetsForExternalAtom(), ExternalAtomMask::matchOutputAtom(), operator=(), print(), DLVHEX_NAMESPACE_BEGIN::FinitenessChecker::run(), ExternalAtomMask::updateMask(), updatePredicateInputMask(), BaseModelGenerator::verifyEAtomAnswerTuple(), and BaseModelGenerator::VerifyExternalAtomCB::VerifyExternalAtomCB().
External atom name (constant term).
Definition at line 306 of file Atoms.h.
Referenced by LiberalSafetyChecker::addBoundedVariable(), LiberalSafetyChecker::addDomainExpansionSafeAttribute(), BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), ExternalAtomMask::addOutputAtoms(), FunctionRewriter::composeTerm(), BaseModelGenerator::computeExtensionOfDomainPredicates(), LiberalSafetyChecker::createDependencyGraph(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), LiberalSafetyChecker::createPreconditionsAndLocationIndices(), FunctionRewriter::decomposeTerm(), BaseModelGenerator::VerifyExternalAnswerAgainstPosNegGuessInterpretationCB::eatom(), BaseModelGenerator::IntegrateExternalAnswerIntoInterpretationCB::eatom(), BaseModelGenerator::evaluateExternalAtom(), ExternalAtom(), Registry::getPredicateOfAtom(), BaseModelGenerator::learnSupportSetsForExternalAtom(), ExternalAtomMask::matchOutputAtom(), sem< HexGrammarSemantics::externalAtom >::operator()(), sem< FunctionParserModuleTermSemantics::functionTermConstruct >::operator()(), sem< FunctionParserModuleAtomSemantics::functionTermEval >::operator()(), operator=(), RawPrinter::print(), print(), FunctionRewriter::rewrite(), and BaseModelGenerator::VerifyExternalAtomCB::VerifyExternalAtomCB().
ExtSourceProperties ExternalAtom::prop [mutable] |
Properties of this external atom.
These properties hold only for this particular external atom and not necessarily for other external atoms over the same predicate.
Definition at line 367 of file Atoms.h.
Referenced by ExternalAtom(), getExtSourceProperties(), sem< HexGrammarSemantics::externalAtom >::operator()(), sem< FunctionParserModuleAtomSemantics::functionTermEval >::operator()(), and operator=().