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

A rule of a logic program. More...

#include <logic_program_types.h>

Collaboration diagram for Clasp::Asp::Rule:
Collaboration graph

Public Member Functions

 Rule (RuleType t=ENDRULE)
 
void clear ()
 Resets the rule. More...
 
void swap (Rule &o)
 Swaps *this with o. More...
 
RulesetType (RuleType t)
 Sets the type of the rule. More...
 
RuleType type () const
 Returns the rule's type. More...
 
RulesetBound (weight_t bound)
 Sets the lower bound of the rule. More...
 
weight_t bound () const
 Returns the lower bound of the rule. More...
 
bool bodyHasWeights () const
 
bool bodyHasBound () const
 
bool bodyIsSet () const
 
RuleaddHead (Var v)
 Adds v as a head of this rule. More...
 
RuleaddToBody (Var v, bool pos, weight_t w=1)
 Adds v to the positive/negative body of the rule. More...
 

Public Attributes

VarVec heads
 
WeightLitVec body
 

Detailed Description

A rule of a logic program.

Objects of this class represent one rule of a logic program.

Constructor & Destructor Documentation

Clasp::Asp::Rule::Rule ( RuleType  t = ENDRULE)
inlineexplicit

Member Function Documentation

Rule & Clasp::Asp::Rule::addHead ( Var  v)

Adds v as a head of this rule.

Rule & Clasp::Asp::Rule::addToBody ( Var  v,
bool  pos,
weight_t  w = 1 
)

Adds v to the positive/negative body of the rule.

Here is the call graph for this function:

bool Clasp::Asp::Rule::bodyHasBound ( ) const
inline
bool Clasp::Asp::Rule::bodyHasWeights ( ) const
inline
bool Clasp::Asp::Rule::bodyIsSet ( ) const
inline
weight_t Clasp::Asp::Rule::bound ( ) const
inline

Returns the lower bound of the rule.

void Clasp::Asp::Rule::clear ( )

Resets the rule.

Rule& Clasp::Asp::Rule::setBound ( weight_t  bound)
inline

Sets the lower bound of the rule.

Precondition
bound >= 0
Note
The bound is only used for constraint- and weight rules.

Here is the call graph for this function:

Rule& Clasp::Asp::Rule::setType ( RuleType  t)
inline

Sets the type of the rule.

Precondition
t != ENDRULE
void Clasp::Asp::Rule::swap ( Rule o)
inline

Swaps *this with o.

Here is the call graph for this function:

RuleType Clasp::Asp::Rule::type ( ) const
inline

Returns the rule's type.

Member Data Documentation

WeightLitVec Clasp::Asp::Rule::body

Body literals of this rule.

VarVec Clasp::Asp::Rule::heads

List of rule heads.


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