dlvhex  2.5.0
AssumptionBasedUnfoundedSetChecker Class Reference

#include <include/dlvhex2/UnfoundedSetChecker.h>

Inheritance diagram for AssumptionBasedUnfoundedSetChecker:
Collaboration diagram for AssumptionBasedUnfoundedSetChecker:

Public Member Functions

 AssumptionBasedUnfoundedSetChecker (ProgramCtx &ctx, const OrdinaryASPProgram &groundProgram, InterpretationConstPtr componentAtoms=InterpretationConstPtr(), SimpleNogoodContainerPtr ngc=SimpleNogoodContainerPtr())
 Initializes the UFS checker without support for external atoms (they are considered as ordinary ones).
 AssumptionBasedUnfoundedSetChecker (BaseModelGenerator &mg, ProgramCtx &ctx, const OrdinaryASPProgram &groundProgram, const AnnotatedGroundProgram &agp, InterpretationConstPtr componentAtoms=InterpretationConstPtr(), SimpleNogoodContainerPtr ngc=SimpleNogoodContainerPtr())
 Initializes the UFS checker with support for external atoms.
void learnNogoodsFromMainSearch (bool reset)
 Forces the unfounded set checker to learn nogoods from main search now.
std::vector< IDAddressgetUnfoundedSet (InterpretationConstPtr compatibleSet, const std::set< ID > &skipProgram)
 Transforms a nogood from the main search to the UFS search.

Private Member Functions

void constructDomain ()
 Goes through EDB and IDB and sets all facts in domain.
void constructUFSDetectionProblemFacts (NogoodSet &ns)
 Encodes that facts cannot be in the unfounded set.
void constructUFSDetectionProblemCreateAuxAtoms ()
 Sets up interpretationShadow and residualShadow.
void constructUFSDetectionProblemDefineAuxiliaries (NogoodSet &ns)
 Defines the auxiliary variables.
void constructUFSDetectionProblemRule (NogoodSet &ns, ID ruleID)
 Encodes a given program rule.
void constructUFSDetectionProblemNonempty (NogoodSet &ns)
 Encodes that we are looking for a nonempty unfounded set.
void constructUFSDetectionProblemRestrictToSCC (NogoodSet &ns)
 Restricts the search to the current strongly connected component.
void constructUFSDetectionProblemBasicEABehavior (NogoodSet &ns)
 Optimization: Basic behavior of external atoms.
void constructUFSDetectionProblemAndInstantiateSolver ()
 Constructs the nogood set used for unfounded set detection and instantiates the solver.
void expandUFSDetectionProblemAndReinstantiateSolver ()
 Extends the nogood set used for unfounded set detection and reinstantiates the solver.
void setAssumptions (InterpretationConstPtr compatibleSet, const std::set< ID > &skipProgram)
 Prepares the list of assumptions for an unfounded set search over a given compatible set.
std::pair< bool, NogoodnogoodTransformation (Nogood ng, InterpretationConstPtr compatibleSet)
 Transforms a nogood (valid input-output relationship of some external atom) learned in the main search for being used in the UFS search.

Private Attributes

boost::unordered_map
< IDAddress, IDAddress
interpretationShadow
 A special atom "a_i" for each atom "a" in the program, representing the truth value of "a" in the compatible set.
boost::unordered_map
< IDAddress, IDAddress
residualShadow
 A special atom "a_j" for each atom "a" in the program, representing the truth value of "a" in I u -X.
boost::unordered_map
< IDAddress, IDAddress
becomeFalse
 A special atom "a_f" for each atom "a" in the program, representing a change from of the truth value of a from true in I to false in I u -X.
boost::unordered_map
< IDAddress, IDAddress
IandU
 A special atom "a_{IandU}" for each atom "a" in the program, representing that a is true in I and member of U.
boost::unordered_map
< IDAddress, IDAddress
nIorU
 A special atom "a_{\overline{I}orU}" for each atom "a" in the program, representing that a is false in I or member of U.
int atomcnt
 Counter for auxiliary atoms.
int problemRuleCount
 Number of program rules respected in the encoding (allows for incremental addition of further rules).
ID hookAtom
 Allows for extension of the problem encoding when additional rules are added.
int learnedNogoodsFromMainSearch

Detailed Description

Definition at line 454 of file UnfoundedSetChecker.h.


Constructor & Destructor Documentation

Initializes the UFS checker without support for external atoms (they are considered as ordinary ones).

Parameters:
ctxProgramCtx
groundProgramGround program used for UFS checking.
componentAtomsAtoms in the component the UFS checker is initialized for.
ngcPointer to a container with valid input-output relationships (EANogoods).

Definition at line 1826 of file UnfoundedSetChecker.cpp.

References constructUFSDetectionProblemAndInstantiateSolver(), DBGLOG, OrdinaryASPProgram::edb, OrdinaryASPProgram::idb, learnedNogoodsFromMainSearch, RawPrinter::print(), UnfoundedSetChecker::reg, and ProgramCtx::registry().

Initializes the UFS checker with support for external atoms.

Parameters:
mgReference to a model generator (used to evaluate the external atoms).
ctxProgramCtx.
groundProgramGround program used for UFS checking.
agpGround program with meta information used for optimized UFS checking.
choiceRuleCompatibleThis parameter is necessary for the clasp backend, which implements non-head cycle free disjunctive rules using choice rules. However, this transformation must be regarded in the optimization of UFS checking. More specifically, the UFS check MUST NOT BE SKIPPED for HFC-free components if they contain such choice rules. For more information, see examples/trickyufs.hex.
ngcPointer to a container with valid input-output relationships (EANogoods).

Definition at line 1854 of file UnfoundedSetChecker.cpp.

References constructUFSDetectionProblemAndInstantiateSolver(), DBGLOG, OrdinaryASPProgram::edb, OrdinaryASPProgram::idb, learnedNogoodsFromMainSearch, RawPrinter::print(), UnfoundedSetChecker::reg, and ProgramCtx::registry().


Member Function Documentation

std::vector< IDAddress > AssumptionBasedUnfoundedSetChecker::getUnfoundedSet ( InterpretationConstPtr  compatibleSet,
const std::set< ID > &  skipProgram 
) [virtual]

Transforms a nogood from the main search to the UFS search.

Parameters:
ngNogodo to transform.
compatibleSetCompatible set for which the UFS check shall be performed.
Returns:
A set of nogoods which can be used in the unfounded set search.

Implements UnfoundedSetChecker.

Definition at line 1980 of file UnfoundedSetChecker.cpp.

References DBGLOG, DLVHEX_BENCHMARK_REGISTER, DLVHEX_BENCHMARK_REGISTER_AND_COUNT, DLVHEX_BENCHMARK_START, DLVHEX_BENCHMARK_STOP, UnfoundedSetChecker::domain, expandUFSDetectionProblemAndReinstantiateSolver(), UnfoundedSetChecker::groundProgram, OrdinaryASPProgram::idb, UnfoundedSetChecker::isUnfoundedSet(), learnNogoodsFromMainSearch(), UnfoundedSetChecker::mode, UnfoundedSetChecker::Ordinary, problemRuleCount, setAssumptions(), UnfoundedSetChecker::solver, and UnfoundedSetChecker::WithExt.

std::pair< bool, Nogood > AssumptionBasedUnfoundedSetChecker::nogoodTransformation ( Nogood  ng,
InterpretationConstPtr  compatibleSet 
) [private, virtual]

Transforms a nogood (valid input-output relationship of some external atom) learned in the main search for being used in the UFS search.

Parameters:
ngThe nogood from the main search.
compatibleSetThe current compatible set we do the unfounded set search with respect to. Note: For AssumptionBasedUnfoundedSetChecker it is essential that the nogood transformation is independent of the compatible set.
Returns:
A pair of a boolean, which denotes if the transformation yielded a nogood, an the transformed nogood in this case.

Implements UnfoundedSetChecker.

Definition at line 1884 of file UnfoundedSetChecker.cpp.

References ID::address, NogoodContainer::createLiteral(), DBGLOG, DLVHEX_BENCHMARK_REGISTER_AND_SCOPE, UnfoundedSetChecker::domain, Nogood::insert(), interpretationShadow, ID::isNaf(), ID::kind, ID::NAF_MASK, UnfoundedSetChecker::reg, residualShadow, and Atom::tuple.

Referenced by learnNogoodsFromMainSearch().

void AssumptionBasedUnfoundedSetChecker::setAssumptions ( InterpretationConstPtr  compatibleSet,
const std::set< ID > &  skipProgram 
) [private]

Prepares the list of assumptions for an unfounded set search over a given compatible set.

Parameters:
compatibleSetThe compatible set over which we do the UFS search
skipProgramThe set of rules ignored in the UFS check

Definition at line 1770 of file UnfoundedSetChecker.cpp.

References ID::address, DBGLOG, UnfoundedSetChecker::domain, Rule::head, hookAtom, interpretationShadow, ID::isNaf(), UnfoundedSetChecker::mode, ID::NAF_MASK, ID::nafLiteralFromAtom(), UnfoundedSetChecker::Ordinary, ID::posLiteralFromAtom(), UnfoundedSetChecker::reg, and UnfoundedSetChecker::solver.

Referenced by getUnfoundedSet().


Field Documentation

A special atom "a_f" for each atom "a" in the program, representing a change from of the truth value of a from true in I to false in I u -X.

Definition at line 462 of file UnfoundedSetChecker.h.

Referenced by constructUFSDetectionProblemBasicEABehavior(), constructUFSDetectionProblemCreateAuxAtoms(), and constructUFSDetectionProblemDefineAuxiliaries().

A special atom "a_{IandU}" for each atom "a" in the program, representing that a is true in I and member of U.

Definition at line 464 of file UnfoundedSetChecker.h.

Referenced by constructUFSDetectionProblemCreateAuxAtoms(), constructUFSDetectionProblemDefineAuxiliaries(), and constructUFSDetectionProblemRule().

A special atom "a_{\overline{I}orU}" for each atom "a" in the program, representing that a is false in I or member of U.

Definition at line 466 of file UnfoundedSetChecker.h.

Referenced by constructUFSDetectionProblemCreateAuxAtoms(), constructUFSDetectionProblemDefineAuxiliaries(), and constructUFSDetectionProblemRule().

Number of program rules respected in the encoding (allows for incremental addition of further rules).

Definition at line 472 of file UnfoundedSetChecker.h.

Referenced by constructUFSDetectionProblemAndInstantiateSolver(), expandUFSDetectionProblemAndReinstantiateSolver(), and getUnfoundedSet().

A special atom "a_j" for each atom "a" in the program, representing the truth value of "a" in I u -X.

Definition at line 460 of file UnfoundedSetChecker.h.

Referenced by constructUFSDetectionProblemCreateAuxAtoms(), constructUFSDetectionProblemDefineAuxiliaries(), and nogoodTransformation().


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