dlvhex
2.5.0
|
Stores a rule of a HEX-program. More...
#include <include/dlvhex2/Rule.h>
Public Member Functions | |
Rule (IDKind kind) | |
Constructor. | |
Rule (IDKind kind, const Tuple &head, const Tuple &body) | |
Constructor. | |
Rule (IDKind kind, const Tuple &head, const Tuple &body, const Tuple &headGuard) | |
Constructor. | |
Rule (IDKind kind, const Tuple &head, const Tuple &body, ID weight, ID level, Tuple weakconstraintVector) | |
Constructor. | |
Rule (IDKind kind, const Tuple &head, const Tuple &body, const Tuple &headGuard, ID weight, ID level, Tuple weakconstraintVector) | |
Constructor. | |
Rule (IDKind kind, ID weight, ID level, Tuple weakconstraintVector) | |
Constructor. | |
Rule (IDKind kind, const Tuple &head, const Tuple &body, const Tuple &bodyWeightVector, ID bound) | |
Constructor. | |
Rule (IDKind kind, const Tuple &head, const Tuple &body, const Tuple &headGuard, const Tuple &bodyWeightVector, ID bound) | |
Constructor. | |
bool | isEAGuessingRule () const |
Checks if this is an external atom guessing rule (ground or nonground). | |
bool | isEAAuxInputRule () const |
Checks if this is an external atom input guessing rule (ground or nonground). | |
std::ostream & | print (std::ostream &o) const |
Prints this rule in form Rule(head <- body [weight:level]; weightvector >= bound). | |
Data Fields | |
IDKind | kind |
The kind part of the ID of this rule. | |
Tuple | head |
The IDs of ordinary atoms in the head of this rule. | |
Tuple | body |
The IDs of literals in the body of this rule. | |
Tuple | headGuard |
The IDs of literals used as guards for the head of this rule (for disjunctions with variable length). | |
Tuple | bodyWeightVector |
Vector of weights of the body literals; only for lparse weight rules (not to be confused with weak constraints!). | |
ID | bound |
Integer bound value of lparse weight rules (not to be confused with weak constraints!). | |
ID | weight |
Integer weight value for weak constraints (ID_FAIL if unused). | |
ID | level |
Integer level value for weak constraints (ID_FAIL if unused). | |
Tuple | weakconstraintVector |
Vector of terms in the weak constraint vector according to ASP-Core-2 standard. |
Rule::Rule | ( | IDKind | kind | ) | [inline] |
Rule::Rule | ( | IDKind | kind, |
const Tuple & | head, | ||
const Tuple & | body | ||
) | [inline] |
Rule::Rule | ( | IDKind | kind, |
const Tuple & | head, | ||
const Tuple & | body, | ||
const Tuple & | headGuard | ||
) | [inline] |
Constructor.
kind | Specifies the type of the rule. |
head | Vector of the IDs of atoms in the rule head. |
body | Vector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom! |
headGuard | Vector of IDs of atoms or literals in the head guard (for disjunctions of arbitrary length). |
Rule::Rule | ( | IDKind | kind, |
const Tuple & | head, | ||
const Tuple & | body, | ||
ID | weight, | ||
ID | level, | ||
Tuple | weakconstraintVector | ||
) | [inline] |
Constructor.
kind | Specifies the type of the rule. |
head | Vector of the IDs of atoms in the rule head. |
body | Vector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom! |
weight | For weight rules. |
level | For weight rules. |
weakconstraintVector | Vector of terms in the weak constraint according to ASP-Core-2 standard; ID_FAIL as single element denotes a DLV-style weak constraint. |
Rule::Rule | ( | IDKind | kind, |
const Tuple & | head, | ||
const Tuple & | body, | ||
const Tuple & | headGuard, | ||
ID | weight, | ||
ID | level, | ||
Tuple | weakconstraintVector | ||
) | [inline] |
Constructor.
kind | Specifies the type of the rule. |
head | Vector of the IDs of atoms in the rule head. |
body | Vector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom! |
headGuard | Vector of IDs of atoms or literals in the head guard (for disjunctions of arbitrary length). |
weight | For weak constraints. |
level | For weak constraints. |
weakconstraintVector | Vector of terms in the weak constraint according to ASP-Core-2 standard; ID_FAIL as single element denotes a DLV-style weak constraint. |
Rule::Rule | ( | IDKind | kind, |
ID | weight, | ||
ID | level, | ||
Tuple | weakconstraintVector | ||
) | [inline] |
Constructor.
kind | Specifies the type of the rule. |
weight | For weak constraints. |
level | For weak constraints. |
weakconstraintVector | Vector of terms in the weak constraint according to ASP-Core-2 standard; ID_FAIL as single element denotes a DLV-style weak constraint. |
Rule::Rule | ( | IDKind | kind, |
const Tuple & | head, | ||
const Tuple & | body, | ||
const Tuple & | bodyWeightVector, | ||
ID | bound | ||
) | [inline] |
Constructor.
kind | Specifies the type of the rule. |
head | Vector of the IDs of atoms in the rule head. |
body | Vector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom! |
bodyWeightVector | Weights of body literals for weight rules (lparse). |
bound | Integer bound value for weight rules (lparse). |
Rule::Rule | ( | IDKind | kind, |
const Tuple & | head, | ||
const Tuple & | body, | ||
const Tuple & | headGuard, | ||
const Tuple & | bodyWeightVector, | ||
ID | bound | ||
) | [inline] |
Constructor.
kind | Specifies the type of the rule. |
head | Vector of the IDs of atoms in the rule head. |
body | Vector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom! |
headGuard | Vector of IDs of atoms or literals in the head guard (for disjunctions of arbitrary length). |
bodyWeightVector | Weights of body literals for weight rules (lparse). |
bound | Integer bound value for weight rules (lparse). |
bool Rule::isEAAuxInputRule | ( | ) | const [inline] |
Checks if this is an external atom input guessing rule (ground or nonground).
This is the case if the head consists of exactly one atom, which is an external atom input auxiliary atom.
Definition at line 184 of file Rule.h.
References head.
Referenced by FLPModelGeneratorFactoryBase::createFLPRules().
bool Rule::isEAGuessingRule | ( | ) | const [inline] |
Checks if this is an external atom guessing rule (ground or nonground).
This is the case if the head consists of exactly two atoms, which are both external atom auxiliary atoms.
Definition at line 175 of file Rule.h.
References head.
Referenced by AssumptionBasedUnfoundedSetChecker::constructDomain(), AssumptionBasedUnfoundedSetChecker::constructUFSDetectionProblemRule(), UnfoundedSetChecker::getUFSNogoodUFSBased(), EncodingBasedUnfoundedSetChecker::getUnfoundedSet(), GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), UnfoundedSetCheckHeuristics::UnfoundedSetCheckHeuristics(), and UnfoundedSetCheckHeuristics::updateSkipProgram().
std::ostream& Rule::print | ( | std::ostream & | o | ) | const [inline] |
Prints this rule in form Rule(head <- body [weight:level]; weightvector >= bound).
o | Stream to print. |
o
. Definition at line 193 of file Rule.h.
References ID::address, body, bodyWeightVector, bound, head, ID_FAIL(), kind, level, printvector(), and weight.
The IDs of literals in the body of this rule.
Definition at line 56 of file Rule.h.
Referenced by InternalGrounder::addDerivableAtom(), BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), ProgramCtx::associateExtAtomsWithPluginAtoms(), InternalGrounder::backtrack(), BOOST_AUTO_TEST_CASE(), InternalGrounder::buildGroundInstance(), InternalGrounder::buildPredicateIndex(), ComponentGraph::calculateComponents(), ComponentGraph::calculateFixedDomain(), ComponentGraph::calculatePredicatesOfComponent(), ComponentGraph::calculateStratificationInfo(), SafetyChecker::checkSafety(), FunctionRewriter::composeTerm(), AnnotatedGroundProgram::computeAdditionalDependencies(), AnnotatedGroundProgram::computeAtomDependencyGraph(), LiberalSafetyChecker::computeBuiltinInformationFlow(), InternalGrounder::computeDepGraph(), InternalGroundASPSolver::computeDepGraph(), BaseModelGenerator::computeExtensionOfDomainPredicates(), InternalGrounder::computeGloballyNewAtom(), ComponentGraph::computeRecursiveAggregatesInComponent(), FLPModelGeneratorBase::computeShadowAndUnfoundedPredicates(), AssumptionBasedUnfoundedSetChecker::constructDomain(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemOptimizationPartEAEnforement(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemOptimizationPartRestrictToCompatibleSet(), AssumptionBasedUnfoundedSetChecker::constructUFSDetectionProblemRule(), BaseModelGeneratorFactory::convertRule(), DependencyGraph::createAuxiliaryRule(), LiberalSafetyChecker::createDependencyGraph(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), FLPModelGeneratorFactoryBase::createEatomGuessingRules(), FLPModelGeneratorFactoryBase::createFLPRules(), FLPModelGeneratorBase::createFoundingRules(), FLPModelGeneratorBase::createMinimalityRules(), DependencyGraph::createNodesAndIntraRuleDependenciesForRule(), InternalGroundASPSolver::createNogoodsForRule(), LiberalSafetyChecker::createPreconditionsAndLocationIndices(), AnnotatedGroundProgram::createProgramMask(), InternalGroundASPSolver::createShiftedProgram(), InternalGroundASPSolver::createSingularLoopNogoods(), FunctionRewriter::decomposeTerm(), InternalGroundASPSolver::doesRuleExternallySupportLiteral(), LiberalSafetyChecker::ensureOrdinarySafety(), GenuinePlainModelGenerator::GenuinePlainModelGenerator(), FLPModelGeneratorBase::getFLPNogood(), ExternalLearningHelper::getIDOfLearningRule(), InternalGrounder::getOutputVariables(), InternalGrounder::getStratumOfRule(), UnfoundedSetChecker::getUFSNogoodReductBased(), UnfoundedSetChecker::getUFSNogoodUFSBased(), InternalGroundASPSolver::getUnfoundedSet(), InternalGroundASPSolver::initializeLists(), GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), InternalGrounder::isGroundRule(), ExternalLearningHelper::learnFromGroundRule(), ExternalLearningHelper::learnFromRule(), HexGrammarSemantics::markExternalPropertyIfExternalBody(), HexGrammarSemantics::markModulePropertyIfModuleBody(), StrongSafetyChecker::operator()(), sem< ChoiceParserModuleSemantics::choiceRule >::operator()(), sem< ChoiceParserModuleSemantics::choiceHead >::operator()(), sem< ChoiceParserModuleSemantics::choiceElement >::operator()(), sem< HexGrammarSemantics::constraint >::operator()(), sem< HexGrammarSemantics::weakconstraint >::operator()(), sem< HexGrammarSemantics::weakconstraintaspcore2 >::operator()(), InternalGrounder::preprocessRule(), RawPrinter::print(), print(), InternalGrounder::reorderRuleBody(), TestASPQueryAtom::retrieveOrLearnSupportSets(), FunctionRewriter::rewrite(), DLVHEX_NAMESPACE_BEGIN::FinitenessChecker::run(), DLVHEX_NAMESPACE_BEGIN::FiniteFiberChecker::run(), DLVHEX_NAMESPACE_BEGIN::AggregateAndBuildinChecker::run(), ExternalAtomMask::setEAtom(), Registry::storeRule(), UnfoundedSetCheckHeuristics::UnfoundedSetCheckHeuristics(), and UnfoundedSetCheckHeuristics::updateSkipProgram().
Vector of weights of the body literals; only for lparse weight rules (not to be confused with weak constraints!).
Definition at line 62 of file Rule.h.
Referenced by RawPrinter::print(), and print().
Integer bound value of lparse weight rules (not to be confused with weak constraints!).
Definition at line 65 of file Rule.h.
Referenced by RawPrinter::print(), and print().
The IDs of ordinary atoms in the head of this rule.
Definition at line 53 of file Rule.h.
Referenced by BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), BOOST_AUTO_TEST_CASE(), DLVHEX_NAMESPACE_BEGIN::EvalHeuristicFromHEXSourcecode::build(), InternalGrounder::buildGroundInstance(), ComponentGraph::calculateFixedDomain(), ComponentGraph::calculatePredicatesOfComponent(), ComponentGraph::calculateStratificationInfo(), SafetyChecker::checkSafety(), AnnotatedGroundProgram::computeAdditionalDependencies(), AnnotatedGroundProgram::computeAtomDependencyGraph(), InternalGrounder::computeDepGraph(), InternalGroundASPSolver::computeDepGraph(), BaseModelGenerator::computeExtensionOfDomainPredicates(), InternalGrounder::computeGloballyNewAtom(), AnnotatedGroundProgram::computeHeadCycles(), ComponentGraph::computeRecursiveAggregatesInComponent(), FLPModelGeneratorBase::computeShadowAndUnfoundedPredicates(), AnnotatedGroundProgram::computeStronglyConnectedComponents(), AssumptionBasedUnfoundedSetChecker::constructDomain(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemNecessaryPart(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemOptimizationPartEAEnforement(), EncodingBasedUnfoundedSetChecker::constructUFSDetectionProblemOptimizationPartRestrictToCompatibleSet(), AssumptionBasedUnfoundedSetChecker::constructUFSDetectionProblemRule(), DependencyGraph::createAuxiliaryRule(), LiberalSafetyChecker::createDependencyGraph(), FLPModelGeneratorFactoryBase::createEatomGuessingRule(), FLPModelGeneratorFactoryBase::createFLPRules(), FLPModelGeneratorBase::createFoundingRules(), FLPModelGeneratorBase::createMinimalityRules(), DependencyGraph::createNodesAndIntraRuleDependenciesForRule(), DependencyGraph::createNodesAndIntraRuleDependenciesForRuleAddHead(), InternalGroundASPSolver::createNogoodsForRule(), LiberalSafetyChecker::createPreconditionsAndLocationIndices(), AnnotatedGroundProgram::createProgramMask(), InternalGroundASPSolver::createShiftedProgram(), InternalGroundASPSolver::createSingularLoopNogoods(), InternalGroundASPSolver::doesRuleExternallySupportLiteral(), LiberalSafetyChecker::ensureOrdinarySafety(), ExternalLearningHelper::getIDOfLearningRule(), InternalGroundASPSolver::getInitialNewlyUnfoundedAtomsAfterSetFact(), InternalGrounder::getOutputVariables(), InternalGrounder::getStratumOfRule(), UnfoundedSetChecker::getUFSNogoodUFSBased(), InternalGroundASPSolver::getUnfoundedSet(), InternalGroundASPSolver::initializeLists(), GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), isEAAuxInputRule(), isEAGuessingRule(), ExternalLearningHelper::learnFromGroundRule(), ExternalLearningHelper::learnFromRule(), StrongSafetyChecker::operator()(), sem< ChoiceParserModuleSemantics::choiceElement >::operator()(), sem< HexGrammarSemantics::rule >::operator()(), sem< HexGrammarSemantics::ruleVariableDisjunction >::operator()(), InternalGrounder::preprocessRule(), RawPrinter::print(), print(), TestASPQueryAtom::retrieveOrLearnSupportSets(), FunctionRewriter::rewrite(), InternalGroundASPSolver::satisfiesIndependently(), AssumptionBasedUnfoundedSetChecker::setAssumptions(), ExternalAtomMask::setEAtom(), Registry::storeRule(), UnfoundedSetCheckHeuristics::UnfoundedSetCheckHeuristics(), UnfoundedSetCheckHeuristics::updateSkipProgram(), and InternalGroundASPSolver::useAsNewSourceForHeadAtom().
The IDs of literals used as guards for the head of this rule (for disjunctions with variable length).
Definition at line 59 of file Rule.h.
Referenced by SafetyChecker::checkSafety(), LiberalSafetyChecker::ensureOrdinarySafety(), and sem< HexGrammarSemantics::ruleVariableDisjunction >::operator()().
The kind part of the ID of this rule.
Definition at line 50 of file Rule.h.
Referenced by BaseModelGeneratorFactory::addDomainPredicatesAndCreateDomainExplorationProgram(), BOOST_AUTO_TEST_CASE(), SafetyChecker::checkSafety(), FunctionRewriter::composeTerm(), BaseModelGeneratorFactory::convertRule(), DependencyGraph::createAuxiliaryRule(), FLPModelGeneratorFactoryBase::createFLPRules(), FunctionRewriter::decomposeTerm(), LiberalSafetyChecker::ensureOrdinarySafety(), HexGrammarSemantics::markExternalPropertyIfExternalBody(), HexGrammarSemantics::markModulePropertyIfModuleBody(), sem< ChoiceParserModuleSemantics::choiceRule >::operator()(), sem< HexGrammarSemantics::rule >::operator()(), sem< HexGrammarSemantics::ruleVariableDisjunction >::operator()(), print(), FunctionRewriter::rewrite(), and Registry::storeRule().
Integer level value for weak constraints (ID_FAIL if unused).
Definition at line 71 of file Rule.h.
Referenced by BOOST_AUTO_TEST_CASE(), InternalGrounder::buildGroundInstance(), sem< HexGrammarSemantics::weakconstraint >::operator()(), sem< HexGrammarSemantics::weakconstraintaspcore2 >::operator()(), RawPrinter::print(), and print().
Vector of terms in the weak constraint vector according to ASP-Core-2 standard.
Might contain ID_FAIL as single element to denote DLV semantics.
Definition at line 77 of file Rule.h.
Referenced by sem< HexGrammarSemantics::weakconstraint >::operator()(), and sem< HexGrammarSemantics::weakconstraintaspcore2 >::operator()().
Integer weight value for weak constraints (ID_FAIL if unused).
Definition at line 68 of file Rule.h.
Referenced by BOOST_AUTO_TEST_CASE(), InternalGrounder::buildGroundInstance(), sem< HexGrammarSemantics::weakconstraint >::operator()(), sem< HexGrammarSemantics::weakconstraintaspcore2 >::operator()(), RawPrinter::print(), and print().