dlvhex  2.5.0
Rule Struct Reference

Stores a rule of a HEX-program. More...

#include <include/dlvhex2/Rule.h>

Inheritance diagram for Rule:
Collaboration diagram for Rule:

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.

Detailed Description

Stores a rule of a HEX-program.

Definition at line 46 of file Rule.h.


Constructor & Destructor Documentation

Rule::Rule ( IDKind  kind) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.

Definition at line 81 of file Rule.h.

Rule::Rule ( IDKind  kind,
const Tuple head,
const Tuple body 
) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.
headVector of the IDs of atoms in the rule head.
bodyVector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom!

Definition at line 91 of file Rule.h.

Rule::Rule ( IDKind  kind,
const Tuple head,
const Tuple body,
const Tuple headGuard 
) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.
headVector of the IDs of atoms in the rule head.
bodyVector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom!
headGuardVector of IDs of atoms or literals in the head guard (for disjunctions of arbitrary length).

Definition at line 102 of file Rule.h.

Rule::Rule ( IDKind  kind,
const Tuple head,
const Tuple body,
ID  weight,
ID  level,
Tuple  weakconstraintVector 
) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.
headVector of the IDs of atoms in the rule head.
bodyVector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom!
weightFor weight rules.
levelFor weight rules.
weakconstraintVectorVector of terms in the weak constraint according to ASP-Core-2 standard; ID_FAIL as single element denotes a DLV-style weak constraint.

Definition at line 115 of file Rule.h.

Rule::Rule ( IDKind  kind,
const Tuple head,
const Tuple body,
const Tuple headGuard,
ID  weight,
ID  level,
Tuple  weakconstraintVector 
) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.
headVector of the IDs of atoms in the rule head.
bodyVector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom!
headGuardVector of IDs of atoms or literals in the head guard (for disjunctions of arbitrary length).
weightFor weak constraints.
levelFor weak constraints.
weakconstraintVectorVector of terms in the weak constraint according to ASP-Core-2 standard; ID_FAIL as single element denotes a DLV-style weak constraint.

Definition at line 129 of file Rule.h.

Rule::Rule ( IDKind  kind,
ID  weight,
ID  level,
Tuple  weakconstraintVector 
) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.
weightFor weak constraints.
levelFor weak constraints.
weakconstraintVectorVector of terms in the weak constraint according to ASP-Core-2 standard; ID_FAIL as single element denotes a DLV-style weak constraint.

Definition at line 140 of file Rule.h.

Rule::Rule ( IDKind  kind,
const Tuple head,
const Tuple body,
const Tuple bodyWeightVector,
ID  bound 
) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.
headVector of the IDs of atoms in the rule head.
bodyVector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom!
bodyWeightVectorWeights of body literals for weight rules (lparse).
boundInteger bound value for weight rules (lparse).

Definition at line 152 of file Rule.h.

Rule::Rule ( IDKind  kind,
const Tuple head,
const Tuple body,
const Tuple headGuard,
const Tuple bodyWeightVector,
ID  bound 
) [inline]

Constructor.

Parameters:
kindSpecifies the type of the rule.
headVector of the IDs of atoms in the rule head.
bodyVector of the IDs of literals in the rule body; the IDs must by of type literal rather than atom!
headGuardVector of IDs of atoms or literals in the head guard (for disjunctions of arbitrary length).
bodyWeightVectorWeights of body literals for weight rules (lparse).
boundInteger bound value for weight rules (lparse).

Definition at line 165 of file Rule.h.


Member Function Documentation

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.

Returns:
True if this is a ground or nonground external atom guessing rule and false otherwise.

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.

Returns:
True if this is a ground or nonground external atom guessing rule and false otherwise.

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).

Parameters:
oStream to print.
Returns:
o.

Definition at line 193 of file Rule.h.

References ID::address, body, bodyWeightVector, bound, head, ID_FAIL(), kind, level, printvector(), and weight.


Field Documentation

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()().

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()().


The documentation for this struct was generated from the following file: