(Positive) Body-Atom-Dependency Graph. More...
#include <dependency_graph.h>
Classes | |
struct | AtomNode |
An atom node. More... | |
struct | BodyNode |
A body node. More... | |
struct | Node |
Base type for nodes. More... | |
class | NonHcfComponent |
Type for storing a non head-cycle-free component of a disjunctive program. More... | |
Public Types | |
enum | { sentinel_atom = 0u } |
typedef Asp::AtomList | AtomList |
typedef std::pair< uint32, NonHcfComponent * > | ComponentPair |
typedef Asp::LogicProgram | LogicProgram |
typedef uint32 | NodeId |
typedef const ComponentPair * | NonHcfIter |
typedef Asp::NonHcfSet | NonHcfSet |
typedef Asp::PrgAtom | PrgAtom |
typedef Asp::PrgBody | PrgBody |
typedef Asp::PrgDisj | PrgDisj |
typedef Asp::PrgNode | PrgNode |
Public Member Functions | |
void | accuStats () const |
void | addSccs (LogicProgram &prg, const AtomList &sccAtoms, const NonHcfSet &nonHcfs) |
Adds SCCs to the graph. | |
const AtomNode & | getAtom (NodeId atomId) const |
Returns AtomNode of atom with given id. | |
const BodyNode & | getBody (NodeId bodyId) const |
Returns BodyNode of body with given id. | |
NodeId | id (const AtomNode &n) const |
uint32 | nodes () const |
Sum of atoms and bodies. | |
NonHcfIter | nonHcfBegin () const |
Configuration * | nonHcfConfig () const |
NonHcfIter | nonHcfEnd () const |
uint32 | numAtoms () const |
Number of atoms in graph. | |
uint32 | numBodies () const |
Number of bodies in graph. | |
uint32 | numNonHcfs () const |
SharedDependencyGraph (Configuration *nonHcfCfg=0) | |
template<class P > | |
void | visitBodyLiterals (const BodyNode &n, const P &p) |
Calls the given function object p once for each body-literal. | |
~SharedDependencyGraph () | |
Private Types | |
typedef PodVector< AtomNode >::type | AtomVec |
typedef PodVector< BodyNode >::type | BodyVec |
typedef PodVector < ComponentPair >::type | ComponentMap |
Private Member Functions | |
NodeId | addBody (const LogicProgram &prg, PrgBody *) |
NodeId | addDisj (const LogicProgram &prg, PrgDisj *) |
uint32 | addHeads (const LogicProgram &prg, PrgBody *, VarVec &atoms) const |
void | addNonHcf (SharedContext &ctx, uint32 scc) |
void | addPreds (const LogicProgram &prg, PrgBody *, uint32 bScc, VarVec &preds) const |
NodeId | createAtom (Literal lit, uint32 aScc) |
NodeId | createBody (PrgBody *b, uint32 bScc) |
uint32 | getAtoms (const LogicProgram &prg, PrgDisj *, VarVec &atoms) const |
void | initAtom (uint32 id, uint32 prop, const VarVec &adj, uint32 preds) |
void | initBody (uint32 id, const VarVec &preds, const VarVec &atHeads) |
SharedDependencyGraph & | operator= (const SharedDependencyGraph &) |
bool | relevantPrgAtom (const Solver &s, PrgAtom *a) const |
bool | relevantPrgBody (const Solver &s, PrgBody *b) const |
SharedDependencyGraph (const SharedDependencyGraph &) | |
Private Attributes | |
AtomVec | atoms_ |
BodyVec | bodies_ |
ComponentMap | components_ |
Configuration * | config_ |
(Positive) Body-Atom-Dependency Graph.
Represents the PBADG of a logic program. Once initialized, the PBDAG is static and read-only and thus can be shared between multiple solvers.
Definition at line 58 of file dependency_graph.h.
Definition at line 69 of file dependency_graph.h.
typedef PodVector<AtomNode>::type Clasp::SharedDependencyGraph::AtomVec [private] |
Definition at line 272 of file dependency_graph.h.
typedef PodVector<BodyNode>::type Clasp::SharedDependencyGraph::BodyVec [private] |
Definition at line 273 of file dependency_graph.h.
typedef PodVector<ComponentPair>::type Clasp::SharedDependencyGraph::ComponentMap [private] |
Definition at line 274 of file dependency_graph.h.
typedef std::pair<uint32, NonHcfComponent*> Clasp::SharedDependencyGraph::ComponentPair |
Definition at line 88 of file dependency_graph.h.
Definition at line 67 of file dependency_graph.h.
typedef uint32 Clasp::SharedDependencyGraph::NodeId |
Definition at line 62 of file dependency_graph.h.
typedef const ComponentPair* Clasp::SharedDependencyGraph::NonHcfIter |
Definition at line 89 of file dependency_graph.h.
Definition at line 68 of file dependency_graph.h.
Definition at line 65 of file dependency_graph.h.
Definition at line 64 of file dependency_graph.h.
Definition at line 66 of file dependency_graph.h.
Definition at line 63 of file dependency_graph.h.
anonymous enum |
Definition at line 142 of file dependency_graph.h.
Clasp::SharedDependencyGraph::SharedDependencyGraph | ( | Configuration * | nonHcfCfg = 0 | ) |
Definition at line 34 of file dependency_graph.cpp.
Definition at line 41 of file dependency_graph.cpp.
Clasp::SharedDependencyGraph::SharedDependencyGraph | ( | const SharedDependencyGraph & | ) | [private] |
void Clasp::SharedDependencyGraph::accuStats | ( | ) | const |
Definition at line 334 of file dependency_graph.cpp.
uint32 Clasp::SharedDependencyGraph::addBody | ( | const LogicProgram & | prg, |
PrgBody * | b | ||
) | [private] |
Definition at line 185 of file dependency_graph.cpp.
uint32 Clasp::SharedDependencyGraph::addDisj | ( | const LogicProgram & | prg, |
PrgDisj * | d | ||
) | [private] |
Definition at line 296 of file dependency_graph.cpp.
uint32 Clasp::SharedDependencyGraph::addHeads | ( | const LogicProgram & | prg, |
PrgBody * | b, | ||
VarVec & | atoms | ||
) | const [private] |
Definition at line 234 of file dependency_graph.cpp.
void Clasp::SharedDependencyGraph::addNonHcf | ( | SharedContext & | ctx, |
uint32 | scc | ||
) | [private] |
Definition at line 309 of file dependency_graph.cpp.
void Clasp::SharedDependencyGraph::addPreds | ( | const LogicProgram & | prg, |
PrgBody * | b, | ||
uint32 | bScc, | ||
VarVec & | preds | ||
) | const [private] |
Definition at line 206 of file dependency_graph.cpp.
void Clasp::SharedDependencyGraph::addSccs | ( | LogicProgram & | prg, |
const AtomList & | sccAtoms, | ||
const NonHcfSet & | nonHcfs | ||
) |
Adds SCCs to the graph.
prg | The logic program for which the dependency graph is to be created. |
sccAtoms | Atoms of the logic program that are strongly connected. |
nonHcfs | Sorted list of non-hcf sccs |
Definition at line 67 of file dependency_graph.cpp.
uint32 Clasp::SharedDependencyGraph::createAtom | ( | Literal | lit, |
uint32 | aScc | ||
) | [private] |
Definition at line 151 of file dependency_graph.cpp.
uint32 Clasp::SharedDependencyGraph::createBody | ( | PrgBody * | b, |
uint32 | bScc | ||
) | [private] |
Definition at line 178 of file dependency_graph.cpp.
const AtomNode& Clasp::SharedDependencyGraph::getAtom | ( | NodeId | atomId | ) | const [inline] |
Returns AtomNode of atom with given id.
Definition at line 246 of file dependency_graph.h.
uint32 Clasp::SharedDependencyGraph::getAtoms | ( | const LogicProgram & | prg, |
PrgDisj * | d, | ||
VarVec & | atoms | ||
) | const [private] |
Definition at line 255 of file dependency_graph.cpp.
const BodyNode& Clasp::SharedDependencyGraph::getBody | ( | NodeId | bodyId | ) | const [inline] |
Returns BodyNode of body with given id.
Definition at line 252 of file dependency_graph.h.
NodeId Clasp::SharedDependencyGraph::id | ( | const AtomNode & | n | ) | const [inline] |
Definition at line 250 of file dependency_graph.h.
void Clasp::SharedDependencyGraph::initAtom | ( | uint32 | id, |
uint32 | prop, | ||
const VarVec & | adj, | ||
uint32 | preds | ||
) | [private] |
Definition at line 160 of file dependency_graph.cpp.
void Clasp::SharedDependencyGraph::initBody | ( | uint32 | id, |
const VarVec & | preds, | ||
const VarVec & | atHeads | ||
) | [private] |
Definition at line 269 of file dependency_graph.cpp.
uint32 Clasp::SharedDependencyGraph::nodes | ( | ) | const [inline] |
Sum of atoms and bodies.
Definition at line 243 of file dependency_graph.h.
NonHcfIter Clasp::SharedDependencyGraph::nonHcfBegin | ( | ) | const [inline] |
Definition at line 266 of file dependency_graph.h.
Configuration* Clasp::SharedDependencyGraph::nonHcfConfig | ( | ) | const [inline] |
Definition at line 269 of file dependency_graph.h.
NonHcfIter Clasp::SharedDependencyGraph::nonHcfEnd | ( | ) | const [inline] |
Definition at line 267 of file dependency_graph.h.
uint32 Clasp::SharedDependencyGraph::numAtoms | ( | ) | const [inline] |
Number of atoms in graph.
Definition at line 239 of file dependency_graph.h.
uint32 Clasp::SharedDependencyGraph::numBodies | ( | ) | const [inline] |
Number of bodies in graph.
Definition at line 241 of file dependency_graph.h.
uint32 Clasp::SharedDependencyGraph::numNonHcfs | ( | ) | const [inline] |
Definition at line 268 of file dependency_graph.h.
SharedDependencyGraph& Clasp::SharedDependencyGraph::operator= | ( | const SharedDependencyGraph & | ) | [private] |
bool Clasp::SharedDependencyGraph::relevantPrgAtom | ( | const Solver & | s, |
PrgAtom * | a | ||
) | const [inline, private] |
Definition at line 54 of file dependency_graph.cpp.
bool Clasp::SharedDependencyGraph::relevantPrgBody | ( | const Solver & | s, |
PrgBody * | b | ||
) | const [inline, private] |
Definition at line 57 of file dependency_graph.cpp.
void Clasp::SharedDependencyGraph::visitBodyLiterals | ( | const BodyNode & | n, |
const P & | p | ||
) | [inline] |
Calls the given function object p once for each body-literal.
Definition at line 258 of file dependency_graph.h.
AtomVec Clasp::SharedDependencyGraph::atoms_ [private] |
Definition at line 289 of file dependency_graph.h.
BodyVec Clasp::SharedDependencyGraph::bodies_ [private] |
Definition at line 290 of file dependency_graph.h.
Definition at line 291 of file dependency_graph.h.
Definition at line 292 of file dependency_graph.h.