dlvhex  2.5.0
FLPModelGeneratorFactoryBase Class Reference

Factory for model generators which provides capability for true FLP reduct computation via rewriting, guessing, and checking. More...

#include <include/dlvhex2/FLPModelGeneratorBase.h>

Inheritance diagram for FLPModelGeneratorFactoryBase:
Collaboration diagram for FLPModelGeneratorFactoryBase:

Public Member Functions

 FLPModelGeneratorFactoryBase (ProgramCtx &ctx)
virtual ~FLPModelGeneratorFactoryBase ()

Protected Member Functions

void createEatomGuessingRules (const ProgramCtx &ctx)
 Creates guessing rules for all external atoms in the component.
ID createEatomGuessingRule (const ProgramCtx &ctx, ID ruleID, ID litID)
 Creates guessing rules for one external atom in the component.
void createFLPRules ()
 Create rules from xidb.
void computeCyclicInputPredicates (RegistryPtr reg, ProgramCtx &ctx, const std::vector< ID > &idb)
 Computes the set of predicates which occur in a cycle.

Protected Attributes

ProgramCtxctx
 ProgramCtx.
RegistryPtr reg
 RegistryPtr.
std::vector< IDidb
 Original idb, possibly augmented with domain predicates (may contain eatoms where all inputs are known).
std::vector< IDinnerEatoms
 Inner external atoms (those are guessed).
std::vector< IDgidb
 One guessing rule for each inner eatom.
std::vector< IDxidb
 IDB rewritten with eatom replacement atoms.
std::vector< IDdeidb
 IDB for domain exploration (equivalent to xidb, except that it does not contain domain predicates).
std::vector< IDdeidbInnerEatoms
 Inner external Atoms in deidb.
std::vector< IDxidbflphead
 Rewriting to find out which body is satisfied -> creates heads.
std::vector< IDxidbflpbody
 Rewriting to compute the reduct's models -> has flp auxiliaries in bodies.
PredicateMask gpMask
 Mask for positive external atom guesses.
PredicateMask gnMask
 Mask for negative external atom guesses.
PredicateMask fMask
 Incrementally updated bitmask for FLP auxiliary predicates.

Friends

class FLPModelGeneratorBase

Detailed Description

Factory for model generators which provides capability for true FLP reduct computation via rewriting, guessing, and checking.

Definition at line 49 of file FLPModelGeneratorBase.h.


Constructor & Destructor Documentation

Definition at line 54 of file FLPModelGeneratorBase.h.


Member Function Documentation

void FLPModelGeneratorFactoryBase::computeCyclicInputPredicates ( RegistryPtr  reg,
ProgramCtx ctx,
const std::vector< ID > &  idb 
) [protected]

Computes the set of predicates which occur in a cycle.

Parameters:
regRegistry.
ctxProgramCtx.
idbOriginal IDB.

Creates guessing rules for all external atoms in the component.

go through all rules with external atoms for each such rule and each inner eatom in the body: * collect all variables in the eatom (input and output) * collect all positive non-external predicates in the rule body containing these variables * build rule <aux_ext_eatompos>(<all variables>="">) v <aux_ext_eatomneg>(<all variables>="">) :- <all bodies>=""> * store into gidb

Parameters:
ctxProgramCtx.

Definition at line 76 of file FLPModelGeneratorBase.cpp.

References ID::atomFromLiteral(), Rule::body, createEatomGuessingRule(), DBGLOG, DBGLOG_SCOPE, ID::doesRuleContainExtatoms(), gidb, idb, innerEatoms, ID::isExternalAtom(), and reg.

Referenced by GenuineGuessAndCheckModelGeneratorFactory::GenuineGuessAndCheckModelGeneratorFactory().

Create rules from xidb.

for each rule in xidb * keep disjunctive facts: copy ID to xidbflphead and xidbflpbody * (note: nondisjunctive facts are stored in edb) * for all other rules: * collect all variables in the body (which means also all variables in the head) * create ground or nonground flp replacement atom containing all variables * create rule <flpreplacement>(<allvariables>) :- <body> and store in xidbflphead * create rule <head> :- <flpreplacement>(<allvariables>), <body> and store in xidbflpbody

* For evaluating which bodies are satisfied -> xidbflphead -> this program creates flp auxiliary atoms * For evaluating the reduct -> xidbflpbody -> this program has flp auxiliary atoms in the body

Definition at line 277 of file FLPModelGeneratorBase.cpp.

References PredicateMask::addPredicate(), Rule::body, ProgramCtx::config, ctx, DBGLOG, DBGLOG_SCOPE, fMask, Configuration::getOption(), Rule::head, ID_FAIL(), IDKind, ID::isAggregateAtom(), ID::isBuiltinAtom(), ID::isConstraint(), Rule::isEAAuxInputRule(), ID::isExternalAtom(), ID::isOrdinaryGroundAtom(), ID::isOrdinaryNongroundAtom(), ID::isRegularRule(), ID::isVariableTerm(), Rule::kind, Atom::kind, ID::literalFromAtom(), LOG, ID::MAINKIND_ATOM, ID::MAINKIND_RULE, RawPrinter::print(), printset(), ID::PROPERTY_AUX, ID::PROPERTY_FLPAUX, ID::PROPERTY_RULE_DISJ, reg, ID::SUBKIND_ATOM_ORDINARYG, ID::SUBKIND_ATOM_ORDINARYN, ID::SUBKIND_RULE_CONSTRAINT, ID::SUBKIND_RULE_REGULAR, Atom::tuple, WARNING(), xidb, xidbflpbody, and xidbflphead.

Referenced by GenuineGuessAndCheckModelGeneratorFactory::GenuineGuessAndCheckModelGeneratorFactory().


Friends And Related Function Documentation

friend class FLPModelGeneratorBase [friend]

Definition at line 132 of file FLPModelGeneratorBase.h.


Field Documentation

std::vector<ID> FLPModelGeneratorFactoryBase::deidb [protected]

IDB for domain exploration (equivalent to xidb, except that it does not contain domain predicates).

Definition at line 83 of file FLPModelGeneratorBase.h.

Referenced by GenuineGuessAndCheckModelGenerator::GenuineGuessAndCheckModelGenerator(), and GenuineGuessAndCheckModelGeneratorFactory::GenuineGuessAndCheckModelGeneratorFactory().

Incrementally updated bitmask for FLP auxiliary predicates.

Definition at line 101 of file FLPModelGeneratorBase.h.

Referenced by createFLPRules(), FLPModelGeneratorFactoryBase(), and FLPModelGeneratorBase::isSubsetMinimalFLPModel().

std::vector<ID> FLPModelGeneratorFactoryBase::idb [protected]

Original idb, possibly augmented with domain predicates (may contain eatoms where all inputs are known).

Auxiliary input rules of these eatoms must be in predecessor unit!

Definition at line 69 of file FLPModelGeneratorBase.h.

Referenced by createEatomGuessingRules(), GenuineGuessAndCheckModelGeneratorFactory::GenuineGuessAndCheckModelGeneratorFactory(), GuessAndCheckModelGeneratorFactory::print(), and GenuineGuessAndCheckModelGeneratorFactory::print().

Rewriting to compute the reduct's models -> has flp auxiliaries in bodies.

Definition at line 91 of file FLPModelGeneratorBase.h.

Referenced by createFLPRules(), FLPModelGeneratorBase::isSubsetMinimalFLPModel(), GuessAndCheckModelGeneratorFactory::print(), and GenuineGuessAndCheckModelGeneratorFactory::print().


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