Preprocesses (i.e. simplifies) a logic program. More...
#include <asp_preprocessor.h>
Classes | |
struct | BodyExtra |
Public Types | |
enum | EqType { no_eq, full_eq } |
Possible eq-preprocessing types. More... | |
Public Member Functions | |
bool | eq () const |
Var | getRootAtom (Literal p) const |
bool | preprocess (LogicProgram &prg, EqType t, uint32 maxIters, bool dfs=true) |
Starts preprocessing of the logic program. | |
Preprocessor () | |
const LogicProgram * | program () const |
LogicProgram * | program () |
void | setRootAtom (Literal p, uint32 atomId) |
Private Types | |
typedef PodVector< BodyExtra > ::type | BodyData |
typedef PrgHead *const * | HeadIter |
typedef std::pair< HeadIter, HeadIter > | HeadRange |
Private Member Functions | |
PrgBody * | addBodyVar (uint32 bodyId) |
bool | addHeadsToUpper (PrgBody *body) |
bool | addHeadToUpper (PrgHead *head, PrgEdge headEdge, PrgEdge support) |
bool | classifyProgram (const VarVec &supportedBodies) |
bool | hasRootLiteral (PrgBody *b) const |
bool | mergeEqBodies (PrgBody *b, Var rootId, bool equalLits) |
uint32 | nextBodyId (VarVec::size_type &idx) |
Preprocessor & | operator= (const Preprocessor &) |
bool | preprocessEq (uint32 maxIters) |
Preprocessor (const Preprocessor &) | |
bool | preprocessSimple () |
bool | propagateAtomValue (PrgAtom *, ValueRep val) |
bool | propagateAtomVar (Var atomId, PrgAtom *, PrgEdge source) |
ValueRep | simplifyBody (PrgBody *b, bool reclassify, VarVec &supported) |
ValueRep | simplifyClassifiedProgram (const HeadRange &atoms, bool more, VarVec &supported) |
ValueRep | simplifyHead (PrgHead *h, bool reclassify) |
Private Attributes | |
BodyData | bodyInfo_ |
bool | dfs_ |
VarVec | follow_ |
VarVec | litToNode_ |
uint32 | maxPass_ |
uint32 | pass_ |
LogicProgram * | prg_ |
EqType | type_ |
Preprocesses (i.e. simplifies) a logic program.
Preprocesses (i.e. simplifies) a logic program and associates variables with the nodes of the simplified logic program.
Definition at line 41 of file asp_preprocessor.h.
typedef PodVector<BodyExtra>::type Clasp::Asp::Preprocessor::BodyData [private] |
Definition at line 113 of file asp_preprocessor.h.
typedef PrgHead* const* Clasp::Asp::Preprocessor::HeadIter [private] |
Definition at line 83 of file asp_preprocessor.h.
typedef std::pair<HeadIter,HeadIter> Clasp::Asp::Preprocessor::HeadRange [private] |
Definition at line 84 of file asp_preprocessor.h.
Possible eq-preprocessing types.
no_eq |
no eq-preprocessing, associate a new var with each supported atom and body |
full_eq |
check for all kinds of equivalences between atoms and bodies |
Definition at line 45 of file asp_preprocessor.h.
Clasp::Asp::Preprocessor::Preprocessor | ( | ) | [inline] |
Definition at line 43 of file asp_preprocessor.h.
Clasp::Asp::Preprocessor::Preprocessor | ( | const Preprocessor & | ) | [private] |
PrgBody * Clasp::Asp::Preprocessor::addBodyVar | ( | uint32 | bodyId | ) | [private] |
Definition at line 180 of file asp_preprocessor.cpp.
bool Clasp::Asp::Preprocessor::addHeadsToUpper | ( | PrgBody * | body | ) | [private] |
Definition at line 233 of file asp_preprocessor.cpp.
bool Clasp::Asp::Preprocessor::addHeadToUpper | ( | PrgHead * | head, |
PrgEdge | headEdge, | ||
PrgEdge | support | ||
) | [private] |
Definition at line 46 of file asp_preprocessor.cpp.
bool Clasp::Asp::Preprocessor::classifyProgram | ( | const VarVec & | supportedBodies | ) | [private] |
Definition at line 104 of file asp_preprocessor.cpp.
bool Clasp::Asp::Preprocessor::eq | ( | ) | const [inline] |
Definition at line 71 of file asp_preprocessor.h.
Var Clasp::Asp::Preprocessor::getRootAtom | ( | Literal | p | ) | const [inline] |
Definition at line 72 of file asp_preprocessor.h.
bool Clasp::Asp::Preprocessor::hasRootLiteral | ( | PrgBody * | b | ) | const [private] |
Definition at line 378 of file asp_preprocessor.cpp.
bool Clasp::Asp::Preprocessor::mergeEqBodies | ( | PrgBody * | b, |
Var | rootId, | ||
bool | equalLits | ||
) | [private] |
Definition at line 366 of file asp_preprocessor.cpp.
uint32 Clasp::Asp::Preprocessor::nextBodyId | ( | VarVec::size_type & | idx | ) | [inline, private] |
Definition at line 103 of file asp_preprocessor.h.
Preprocessor& Clasp::Asp::Preprocessor::operator= | ( | const Preprocessor & | ) | [private] |
bool Clasp::Asp::Preprocessor::preprocess | ( | LogicProgram & | prg, |
EqType | t, | ||
uint32 | maxIters, | ||
bool | dfs = true |
||
) | [inline] |
Starts preprocessing of the logic program.
Computes the maximum consequences of prg and associates a variable with each supported atom and body.
prg | The logic program to preprocess. |
t | Type of eq-preprocessing. |
maxIters | If t == full_eq, maximal number of iterations during eq preprocessing. |
dfs | If t == full_eq, classify in df-order (true) or bf-order (false). |
Definition at line 62 of file asp_preprocessor.h.
bool Clasp::Asp::Preprocessor::preprocessEq | ( | uint32 | maxIters | ) | [private] |
Definition at line 75 of file asp_preprocessor.cpp.
bool Clasp::Asp::Preprocessor::preprocessSimple | ( | ) | [private] |
Definition at line 30 of file asp_preprocessor.cpp.
const LogicProgram* Clasp::Asp::Preprocessor::program | ( | ) | const [inline] |
Definition at line 50 of file asp_preprocessor.h.
LogicProgram* Clasp::Asp::Preprocessor::program | ( | ) | [inline] |
Definition at line 51 of file asp_preprocessor.h.
bool Clasp::Asp::Preprocessor::propagateAtomValue | ( | PrgAtom * | atom, |
ValueRep | val | ||
) | [private] |
Definition at line 361 of file asp_preprocessor.cpp.
bool Clasp::Asp::Preprocessor::propagateAtomVar | ( | Var | atomId, |
PrgAtom * | a, | ||
PrgEdge | source | ||
) | [private] |
Definition at line 280 of file asp_preprocessor.cpp.
void Clasp::Asp::Preprocessor::setRootAtom | ( | Literal | p, |
uint32 | atomId | ||
) | [inline] |
Definition at line 73 of file asp_preprocessor.h.
ValueRep Clasp::Asp::Preprocessor::simplifyBody | ( | PrgBody * | b, |
bool | reclassify, | ||
VarVec & | supported | ||
) | [private] |
Definition at line 389 of file asp_preprocessor.cpp.
ValueRep Clasp::Asp::Preprocessor::simplifyClassifiedProgram | ( | const HeadRange & | atoms, |
bool | more, | ||
VarVec & | supported | ||
) | [private] |
Definition at line 134 of file asp_preprocessor.cpp.
ValueRep Clasp::Asp::Preprocessor::simplifyHead | ( | PrgHead * | h, |
bool | reclassify | ||
) | [private] |
Definition at line 449 of file asp_preprocessor.cpp.
BodyData Clasp::Asp::Preprocessor::bodyInfo_ [private] |
Definition at line 116 of file asp_preprocessor.h.
bool Clasp::Asp::Preprocessor::dfs_ [private] |
Definition at line 121 of file asp_preprocessor.h.
VarVec Clasp::Asp::Preprocessor::follow_ [private] |
Definition at line 115 of file asp_preprocessor.h.
VarVec Clasp::Asp::Preprocessor::litToNode_ [private] |
Definition at line 117 of file asp_preprocessor.h.
uint32 Clasp::Asp::Preprocessor::maxPass_ [private] |
Definition at line 119 of file asp_preprocessor.h.
uint32 Clasp::Asp::Preprocessor::pass_ [private] |
Definition at line 118 of file asp_preprocessor.h.
LogicProgram* Clasp::Asp::Preprocessor::prg_ [private] |
Definition at line 114 of file asp_preprocessor.h.
EqType Clasp::Asp::Preprocessor::type_ [private] |
Definition at line 120 of file asp_preprocessor.h.