clingo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Public Types | Public Member Functions | List of all members
Clasp::Asp::PrgAtom Class Reference

An atom in a logic program. More...

#include <logic_program_types.h>

Inheritance diagram for Clasp::Asp::PrgAtom:
Inheritance graph
Collaboration diagram for Clasp::Asp::PrgAtom:
Collaboration graph

Public Types

enum  Dependency { dep_pos = 0, dep_neg = 1, dep_all = 2 }
 
typedef LitVec::const_iterator dep_iterator
 
- Public Types inherited from Clasp::Asp::PrgHead
enum  Simplify { no_simplify = 0, force_simplify = 1 }
 
enum  State { state_normal = 0u, state_in_flux = 1u, state_freeze = 2u, state_freeze_true = 3u }
 
typedef EdgeIterator sup_iterator
 

Public Member Functions

 PrgAtom (uint32 id, bool checkScc=true)
 
uint32 scc () const
 Strongly connected component of this node. More...
 
Literal eqGoal (bool sign) const
 If eq(), stores the literal that is eq to this atom. More...
 
bool inDisj () const
 Returns true if atom belongs to a disjunctive head. More...
 
forward dependencies (bodies containing this atom)
dep_iterator deps_begin () const
 
dep_iterator deps_end () const
 
bool hasDep (Dependency d) const
 
void addDep (Var bodyId, bool pos)
 
void removeDep (Var bodyId, bool pos)
 
void clearDeps (Dependency d)
 
implementation functions

Low-level implementation functions. Use with care and only if you know what you are doing!

void setEqGoal (Literal x)
 
bool propagateValue (LogicProgram &prg, bool backprop)
 
bool addConstraints (const LogicProgram &prg, ClauseCreator &c)
 
void setScc (uint32 scc)
 
void setState (State s)
 
- Public Member Functions inherited from Clasp::Asp::PrgHead
bool inUpper () const
 Is the head part of the (simplified) program? More...
 
bool isAtom () const
 Is this head an atom? More...
 
uint32 supports () const
 Number of supports (rules) for this head. More...
 
sup_iterator supps_begin () const
 
sup_iterator supps_end () const
 
bool frozen () const
 Defined in a later incremental step? More...
 
bool inFlux () const
 Thawed in this step? More...
 
Literal assumption () const
 
State state () const
 
void addSupport (PrgEdge r)
 Adds r as support edge for this node. More...
 
void addSupport (PrgEdge r, Simplify s)
 
void removeSupport (PrgEdge r)
 Removes r from the head's list of supports. More...
 
void clearSupports ()
 
void clearSupports (EdgeVec &to)
 
bool simplifySupports (LogicProgram &prg, bool strong, uint32 *numDiffSupps=0)
 Removes any superfluous/irrelevant supports. More...
 
bool assignValue (ValueRep v)
 Assigns the value v to this head. More...
 
void setInUpper (bool b)
 
void markDirty ()
 
void assignVar (LogicProgram &prg, PrgEdge it)
 
- Public Member Functions inherited from Clasp::Asp::PrgNode
 PrgNode (uint32 id, bool checkScc=true)
 Creates a new node that corresponds to a literal that is false. More...
 
bool relevant () const
 Is the node still relevant or removed() resp. eq()? More...
 
bool removed () const
 Was the node removed? More...
 
bool ignoreScc () const
 Ignore the node during scc checking? More...
 
bool eq () const
 Returns true if this node is equivalent to some other node. More...
 
bool seen () const
 
bool hasVar () const
 Returns true if node has an associated variable in a solver. More...
 
Var var () const
 Returns the variable associated with this node or sentVar if no var is associated with this node. More...
 
Literal literal () const
 Returns the literal associated with this node or a sentinel literal if no var is associated with this node. More...
 
ValueRep value () const
 Returns the value currently assigned to this node. More...
 
uint32 id () const
 Returns the current id of this node. More...
 
Literal trueLit () const
 Returns the literal that must be true in order to fulfill the truth-value of this node. More...
 
void setLiteral (Literal x)
 
void clearLiteral (bool clVal)
 
void setValue (ValueRep v)
 
void setEq (uint32 eqId)
 
void setIgnoreScc (bool b)
 
void markRemoved ()
 
void markSeen (bool b)
 
void resetId (uint32 id, bool seen)
 
bool assignValueImpl (ValueRep v, bool noWeak)
 

Additional Inherited Members

- Static Public Attributes inherited from Clasp::Asp::PrgNode
static const uint32 noScc = (1u << 27)-1
 
static const uint32 maxVertex = (1u << 28)-1
 
static const uint32 noIdx = 1
 
- Protected Member Functions inherited from Clasp::Asp::PrgHead
 PrgHead (uint32 id, NodeType t, uint32 data=0, bool checkScc=true)
 Creates a new node that corresponds to a literal that is false. More...
 
bool backpropagate (LogicProgram &prg, ValueRep val, bool bpFull)
 
- Protected Attributes inherited from Clasp::Asp::PrgHead
EdgeVec supports_
 
uint32 data_: 27
 
uint32 upper_: 1
 
uint32 dirty_: 1
 
uint32 state_: 2
 
uint32 isAtom_: 1
 
- Protected Attributes inherited from Clasp::Asp::PrgNode
uint32 litIdx_: 31
 
uint32 noScc_: 1
 
uint32 id_: 28
 
uint32 val_: 2
 
uint32 eq_: 1
 
uint32 seen_: 1
 

Detailed Description

An atom in a logic program.

An atom stores the list of bodies depending on it. Furthermore, once strongly-connected components are identified, atoms store their SCC-number. All trivial SCCs are represented with the special SCC-number PrgNode::noScc.

Member Typedef Documentation

typedef LitVec::const_iterator Clasp::Asp::PrgAtom::dep_iterator

Member Enumeration Documentation

Enumerator
dep_pos 
dep_neg 
dep_all 

Constructor & Destructor Documentation

Clasp::Asp::PrgAtom::PrgAtom ( uint32  id,
bool  checkScc = true 
)
explicit

Member Function Documentation

bool Clasp::Asp::PrgAtom::addConstraints ( const LogicProgram prg,
ClauseCreator c 
)

Here is the call graph for this function:

void Clasp::Asp::PrgAtom::addDep ( Var  bodyId,
bool  pos 
)
void Clasp::Asp::PrgAtom::clearDeps ( Dependency  d)
dep_iterator Clasp::Asp::PrgAtom::deps_begin ( ) const
inline
dep_iterator Clasp::Asp::PrgAtom::deps_end ( ) const
inline
Literal Clasp::Asp::PrgAtom::eqGoal ( bool  sign) const

If eq(), stores the literal that is eq to this atom.

Here is the call graph for this function:

bool Clasp::Asp::PrgAtom::hasDep ( Dependency  d) const
bool Clasp::Asp::PrgAtom::inDisj ( ) const

Returns true if atom belongs to a disjunctive head.

bool Clasp::Asp::PrgAtom::propagateValue ( LogicProgram prg,
bool  backprop 
)

Here is the call graph for this function:

void Clasp::Asp::PrgAtom::removeDep ( Var  bodyId,
bool  pos 
)
uint32 Clasp::Asp::PrgAtom::scc ( ) const
inline

Strongly connected component of this node.

void Clasp::Asp::PrgAtom::setEqGoal ( Literal  x)

Here is the call graph for this function:

void Clasp::Asp::PrgAtom::setScc ( uint32  scc)
inline

Here is the call graph for this function:

void Clasp::Asp::PrgAtom::setState ( State  s)
inline

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