Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
Clasp::SharedDependencyGraph Class Reference

(Positive) Body-Atom-Dependency Graph. More...

#include <dependency_graph.h>

List of all members.

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 ComponentPairNonHcfIter
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 AtomNodegetAtom (NodeId atomId) const
 Returns AtomNode of atom with given id.
const BodyNodegetBody (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
ConfigurationnonHcfConfig () 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)
SharedDependencyGraphoperator= (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_
Configurationconfig_

Detailed Description

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

Note:
Initialization is *not* thread-safe, i.e. must be done only once by one thread.

Definition at line 58 of file dependency_graph.h.


Member Typedef Documentation

Definition at line 69 of file dependency_graph.h.

Definition at line 272 of file dependency_graph.h.

Definition at line 273 of file dependency_graph.h.

Definition at line 274 of file dependency_graph.h.

Definition at line 88 of file dependency_graph.h.

Definition at line 67 of file dependency_graph.h.

Definition at line 62 of file dependency_graph.h.

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.


Member Enumeration Documentation

anonymous enum
Enumerator:
sentinel_atom 

Definition at line 142 of file dependency_graph.h.


Constructor & Destructor Documentation

Definition at line 34 of file dependency_graph.cpp.

Definition at line 41 of file dependency_graph.cpp.


Member Function Documentation

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.

Parameters:
prgThe logic program for which the dependency graph is to be created.
sccAtomsAtoms of the logic program that are strongly connected.
nonHcfsSorted 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.

Definition at line 266 of file dependency_graph.h.

Definition at line 269 of file dependency_graph.h.

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.

template<class P >
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.


Member Data Documentation

Definition at line 289 of file dependency_graph.h.

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.


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


clasp
Author(s): Benjamin Kaufmann
autogenerated on Thu Aug 27 2015 12:41:41