A class for defining a logic program. More...
#include <logic_program.h>
Classes | |
struct | AspOptions |
Options for the Asp-Preprocessor. More... | |
struct | Incremental |
struct | MinimizeRule |
Public Types | |
enum | ExtendedRuleMode { mode_native = 0, mode_transform = 1, mode_transform_choice = 2, mode_transform_card = 3, mode_transform_weight = 4, mode_transform_scc = 5, mode_transform_nhcf = 6, mode_transform_integ = 7, mode_transform_dynamic = 8 } |
Defines the possible modes for handling extended rules, i.e. choice, cardinality, and weight rules. More... | |
Public Member Functions | |
LogicProgram () | |
~LogicProgram () | |
Step control functions | |
LogicProgram & | start (SharedContext &ctx, const AspOptions &opts=AspOptions()) |
Starts the definition of a logic program. | |
void | setExtendedRuleMode (ExtendedRuleMode m) |
Sets the mode for handling extended rules (default: mode_native). | |
void | setOptions (const AspOptions &opts) |
Sets preprocessing options. | |
void | setNonHcfConfiguration (Configuration *c) |
Sets the configuration to be used for checker solvers in disjunctive LP solving. | |
bool | update () |
Unfreezes a currently frozen program and starts an incremental step. | |
bool | end () |
Finishes the definition of the logic program (or its current increment). | |
void | write (std::ostream &os) |
Writes the (possibly simplified) program in lparse-format to the given stream. | |
void | dispose (bool forceFullDispose) |
Disposes (parts of) the internal representation of the logic program. | |
bool | clone (SharedContext &ctx, bool shareSymbols=false) |
Clones the program and adds it to the given ctx. | |
Program mutating functions | |
Var | newAtom () |
Adds a new atom to the program. | |
LogicProgram & | setAtomName (Var atomId, const char *name) |
Sets the name of the given atom and adds it to the program's symbol table. | |
LogicProgram & | setCompute (Var atomId, bool value) |
Forces the atom's truth-value to value. | |
LogicProgram & | freeze (Var atomId, ValueRep value=value_false) |
Protects an otherwise undefined atom from preprocessing. | |
LogicProgram & | unfreeze (Var atomId) |
Removes any protection from the given atom. | |
LogicProgram & | addRule (const Rule &r) |
Adds the given rule to the program. | |
Rule creation functions | |
Functions in this group may be used to construct logic program rules. The construction of a rule must start with a call to startRule() and ends with a call to endRule(). Functions for adding elements to a rule shall only be called between calls to startRule()/endRule() and only one rule can be under construction at any one time. | |
LogicProgram & | startRule (RuleType t=BASICRULE, weight_t bound=-1) |
Starts the construction of a rule. | |
LogicProgram & | setBound (weight_t bound) |
Sets the bound (resp. min weight) of the currently active rule. | |
LogicProgram & | addHead (Var atomId) |
Adds the atom with the given id as a head to the currently active rule. | |
LogicProgram & | addToBody (Var atomId, bool pos, weight_t weight=1) |
Adds a subgoal to the currently active rule. | |
LogicProgram & | endRule () |
Finishes the construction of the active rule and adds it to the program. | |
Private Types | |
typedef IndexMap::iterator | IndexIter |
typedef std::multimap< uint32, uint32 > | IndexMap |
typedef std::pair< IndexIter, IndexIter > | IndexRange |
typedef PodVector< Rule * >::type | RuleList |
typedef PodVector< uint8 >::type | SccMap |
Private Member Functions | |
bool | addConstraints () |
void | addRuleImpl (RuleType t, const VarVec &head, BodyInfo &body) |
PrgBody * | assignBodyFor (BodyInfo &body, EdgeType x, bool strongSimp) |
bool | doEndProgram () |
void | doGetAssumptions (LitVec &out) const |
bool | doParse (StreamSource &prg) |
bool | doStartProgram () |
int | doType () const |
bool | doUpdateProgram () |
uint32 | equalBody (const IndexRange &range, BodyInfo &info) const |
void | finalizeDisjunctions (Preprocessor &p, uint32 numSccs) |
uint32 | findEqBody (PrgBody *b, uint32 hash) |
Var | findLpFalseAtom () const |
PrgBody * | getBodyFor (BodyInfo &body, bool addDeps=true) |
PrgDisj * | getDisjFor (const VarVec &heads, uint32 headHash) |
Literal | getEqAtomLit (Literal lit, const BodyList &supports, Preprocessor &p, const SccMap &x) |
template<class C > | |
Var | getEqNode (C &vec, Var id) const |
PrgAtom * | getFalseAtom () const |
Var | getFalseId () const |
bool | handleNatively (RuleType t, const BodyInfo &i) const |
LogicProgram (const LogicProgram &) | |
void | normalize () |
LogicProgram & | operator= (const LogicProgram &) |
bool | positiveLoopSafe (PrgBody *b, PrgBody *root) const |
void | prepareComponents () |
void | prepareProgram (bool checkSccs) |
uint32 | removeBody (PrgBody *b, uint32 oldHash) |
PrgAtom * | resize (Var atomId) |
RuleType | simplifyBody (const Rule &r, BodyInfo &info) |
void | simplifyMinimize () |
bool | transform (const PrgBody &body, BodyInfo &out) const |
void | transform (const MinimizeRule &, BodyInfo &out) const |
void | transformExtended () |
void | transformIntegrity (uint32 maxAux) |
bool | transformNoAux (RuleType t, const BodyInfo &i) const |
void | updateFrozenAtoms () |
void | writeBody (const BodyInfo &body, std::ostream &) const |
Private Attributes | |
BodyInfo | activeBody_ |
VarVec | activeHead_ |
AtomList | atoms_ |
BodyList | bodies_ |
IndexMap | bodyIndex_ |
IndexMap | disjIndex_ |
DisjList | disjunctions_ |
RuleList | extended_ |
struct Clasp::Asp::LogicProgram::Incremental * | incData_ |
VarVec | initialSupp_ |
struct Clasp::Asp::LogicProgram::MinimizeRule * | minimize_ |
Configuration * | nonHcfCfg_ |
NonHcfSet | nonHcfs_ |
AspOptions | opts_ |
VarVec | propQ_ |
Rule | rule_ |
RuleState | ruleState_ |
AtomList | sccAtoms_ |
Query functions | |
Functions in this group are useful to query important information once the program is frozen, i.e. after end() was called. | |
LpStats | stats |
LpStats * | accu |
bool | hasMinimize () const |
Returns whether the program contains any minimize statements. | |
uint32 | numAtoms () const |
Returns the number of atoms in the logic program. | |
uint32 | numBodies () const |
Returns the number of bodies in the current (slice of the) logic program. | |
uint32 | numDisjunctions () const |
Returns the number of disjunctive heads. | |
Var | startAtom () const |
Returns the id of the first atom of the current step. | |
Literal | getLiteral (Var atomId) const |
Returns the internal literal that is associated with the given atom. | |
Implementation functions | |
Low-level implementation functions. Use with care and only if you know what you are doing! | |
typedef VarVec::const_iterator | VarIter |
typedef PrgHead *const * | HeadIter |
typedef std::pair < EdgeIterator, EdgeIterator > | EdgeRange |
typedef std::pair< HeadIter, HeadIter > | HeadRange |
const AspOptions & | options () const |
bool | hasConflict () const |
bool | ok () const |
Returns true if the program is not conflicting. | |
PrgAtom * | getAtom (Var atomId) const |
PrgHead * | getHead (PrgEdge it) const |
PrgNode * | getSupp (PrgEdge it) const |
Var | getEqAtom (Var a) const |
PrgBody * | getBody (Var bodyId) const |
Var | getEqBody (Var b) const |
PrgDisj * | getDisj (Var disjId) const |
bool | isFact (PrgAtom *a) const |
HeadIter | disj_begin () const |
HeadIter | disj_end () const |
HeadIter | atom_begin () const |
HeadIter | atom_end () const |
VarIter | unfreeze_begin () const |
VarIter | unfreeze_end () const |
const char * | getAtomName (Var id) const |
RuleType | simplifyRule (const Rule &r, VarVec &head, BodyInfo &info) |
VarVec & | getSupportedBodies (bool sorted) |
uint32 | update (PrgBody *b, uint32 oldHash, uint32 newHash) |
bool | assignValue (PrgAtom *a, ValueRep v) |
bool | assignValue (PrgHead *h, ValueRep v) |
bool | propagate (bool backprop) |
PrgAtom * | mergeEqAtoms (PrgAtom *a, Var rootAtom) |
PrgBody * | mergeEqBodies (PrgBody *b, Var rootBody, bool hashEq, bool atomsAssigned) |
bool | propagate () |
void | setConflict () |
RuleState & | ruleState () |
void | addMinimize () |
void | upRules (RuleType r, int i) |
void | incTr (RuleType r, uint32 n) |
void | incTrAux (uint32 n) |
void | incEqs (VarType t) |
A class for defining a logic program.
Use this class to specify a logic program. Once the program is completly defined, call endProgram() to load the logic program into a SharedContext object.
Definition at line 77 of file logic_program.h.
typedef std::pair<EdgeIterator, EdgeIterator> Clasp::Asp::LogicProgram::EdgeRange |
Definition at line 373 of file logic_program.h.
typedef PrgHead* const* Clasp::Asp::LogicProgram::HeadIter |
Definition at line 372 of file logic_program.h.
typedef std::pair<HeadIter, HeadIter> Clasp::Asp::LogicProgram::HeadRange |
Definition at line 374 of file logic_program.h.
typedef IndexMap::iterator Clasp::Asp::LogicProgram::IndexIter [private] |
Definition at line 418 of file logic_program.h.
typedef std::multimap<uint32, uint32> Clasp::Asp::LogicProgram::IndexMap [private] |
Definition at line 417 of file logic_program.h.
typedef std::pair<IndexIter, IndexIter> Clasp::Asp::LogicProgram::IndexRange [private] |
Definition at line 419 of file logic_program.h.
typedef PodVector<Rule*>::type Clasp::Asp::LogicProgram::RuleList [private] |
Definition at line 416 of file logic_program.h.
typedef PodVector<uint8>::type Clasp::Asp::LogicProgram::SccMap [private] |
Definition at line 420 of file logic_program.h.
typedef VarVec::const_iterator Clasp::Asp::LogicProgram::VarIter |
Definition at line 371 of file logic_program.h.
Defines the possible modes for handling extended rules, i.e. choice, cardinality, and weight rules.
Definition at line 82 of file logic_program.h.
Definition at line 132 of file logic_program.cpp.
Definition at line 133 of file logic_program.cpp.
Clasp::Asp::LogicProgram::LogicProgram | ( | const LogicProgram & | ) | [private] |
bool Clasp::Asp::LogicProgram::addConstraints | ( | ) | [private] |
Definition at line 913 of file logic_program.cpp.
LogicProgram& Clasp::Asp::LogicProgram::addHead | ( | Var | atomId | ) | [inline] |
Adds the atom with the given id as a head to the currently active rule.
Definition at line 306 of file logic_program.h.
Definition at line 282 of file logic_program.cpp.
LogicProgram & Clasp::Asp::LogicProgram::addRule | ( | const Rule & | r | ) |
Adds the given rule to the program.
Simplifies the given rule and adds it to the program if it is neither tautological (e.g. a :- a) nor contradictory (e.g. a :- b, not b). Atoms in the simplified rule that are not yet known are implicitly created.
RedefinitionError | if the precondition is violated. |
Definition at line 449 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::addRuleImpl | ( | RuleType | t, |
const VarVec & | head, | ||
BodyInfo & | body | ||
) | [private] |
Definition at line 499 of file logic_program.cpp.
LogicProgram& Clasp::Asp::LogicProgram::addToBody | ( | Var | atomId, |
bool | pos, | ||
weight_t | weight = 1 |
||
) | [inline] |
Adds a subgoal to the currently active rule.
atomId | The id of the atom to be added to the rule. |
pos | true if the atom is positive. Fals otherwise |
weight | The weight the new predecessor should have in the rule. |
Definition at line 320 of file logic_program.h.
PrgBody * Clasp::Asp::LogicProgram::assignBodyFor | ( | BodyInfo & | body, |
EdgeType | x, | ||
bool | strongSimp | ||
) | [private] |
Definition at line 1195 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::assignValue | ( | PrgAtom * | a, |
ValueRep | v | ||
) |
Definition at line 538 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::assignValue | ( | PrgHead * | h, |
ValueRep | v | ||
) |
Definition at line 546 of file logic_program.cpp.
HeadIter Clasp::Asp::LogicProgram::atom_begin | ( | ) | const [inline] |
Definition at line 388 of file logic_program.h.
HeadIter Clasp::Asp::LogicProgram::atom_end | ( | ) | const [inline] |
Definition at line 389 of file logic_program.h.
bool Clasp::Asp::LogicProgram::clone | ( | SharedContext & | ctx, |
bool | shareSymbols = false |
||
) |
Clones the program and adds it to the given ctx.
Definition at line 269 of file logic_program.cpp.
HeadIter Clasp::Asp::LogicProgram::disj_begin | ( | ) | const [inline] |
Definition at line 386 of file logic_program.h.
HeadIter Clasp::Asp::LogicProgram::disj_end | ( | ) | const [inline] |
Definition at line 387 of file logic_program.h.
void Clasp::Asp::LogicProgram::dispose | ( | bool | forceFullDispose | ) |
Disposes (parts of) the internal representation of the logic program.
forceFullDispose | If set to true, the whole program is disposed. Otherwise, only the rules (of the current step) are disposed but atoms and any incremental control data remain. |
Definition at line 135 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::doEndProgram | ( | ) | [private, virtual] |
Implements Clasp::ProgramBuilder.
Definition at line 260 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::doGetAssumptions | ( | LitVec & | out | ) | const [private] |
Definition at line 489 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::doParse | ( | StreamSource & | prg | ) | [private, virtual] |
Implements Clasp::ProgramBuilder.
Definition at line 235 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::doStartProgram | ( | ) | [private, virtual] |
Implements Clasp::ProgramBuilder.
Definition at line 215 of file logic_program.cpp.
int Clasp::Asp::LogicProgram::doType | ( | ) | const [inline, private, virtual] |
Implements Clasp::ProgramBuilder.
Definition at line 429 of file logic_program.h.
bool Clasp::Asp::LogicProgram::doUpdateProgram | ( | ) | [private, virtual] |
Implements Clasp::ProgramBuilder.
Definition at line 236 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::end | ( | ) | [inline] |
Finishes the definition of the logic program (or its current increment).
Applies program mutating operations issued in the current step and transforms the new program into the solver's internal representation.
Definition at line 165 of file logic_program.h.
LogicProgram& Clasp::Asp::LogicProgram::endRule | ( | ) | [inline] |
Finishes the construction of the active rule and adds it to the program.
Definition at line 329 of file logic_program.h.
uint32 Clasp::Asp::LogicProgram::equalBody | ( | const IndexRange & | range, |
BodyInfo & | info | ||
) | const [private] |
Definition at line 1219 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::finalizeDisjunctions | ( | Preprocessor & | p, |
uint32 | numSccs | ||
) | [private] |
Definition at line 734 of file logic_program.cpp.
uint32 Clasp::Asp::LogicProgram::findEqBody | ( | PrgBody * | b, |
uint32 | hash | ||
) | [private] |
Definition at line 1233 of file logic_program.cpp.
uint32 Clasp::Asp::LogicProgram::findLpFalseAtom | ( | ) | const [private] |
Definition at line 1356 of file logic_program.cpp.
LogicProgram & Clasp::Asp::LogicProgram::freeze | ( | Var | atomId, |
ValueRep | value = value_false |
||
) |
Protects an otherwise undefined atom from preprocessing.
If the atom is defined in this or a previous step, the operation has no effect.
Definition at line 423 of file logic_program.cpp.
PrgAtom* Clasp::Asp::LogicProgram::getAtom | ( | Var | atomId | ) | const [inline] |
Definition at line 378 of file logic_program.h.
const char * Clasp::Asp::LogicProgram::getAtomName | ( | Var | id | ) | const |
Definition at line 1365 of file logic_program.cpp.
PrgBody* Clasp::Asp::LogicProgram::getBody | ( | Var | bodyId | ) | const [inline] |
Definition at line 382 of file logic_program.h.
PrgBody * Clasp::Asp::LogicProgram::getBodyFor | ( | BodyInfo & | body, |
bool | addDeps = true |
||
) | [private] |
Definition at line 1179 of file logic_program.cpp.
PrgDisj* Clasp::Asp::LogicProgram::getDisj | ( | Var | disjId | ) | const [inline] |
Definition at line 384 of file logic_program.h.
PrgDisj * Clasp::Asp::LogicProgram::getDisjFor | ( | const VarVec & | heads, |
uint32 | headHash | ||
) | [private] |
Definition at line 1250 of file logic_program.cpp.
Var Clasp::Asp::LogicProgram::getEqAtom | ( | Var | a | ) | const [inline] |
Definition at line 381 of file logic_program.h.
Literal Clasp::Asp::LogicProgram::getEqAtomLit | ( | Literal | lit, |
const BodyList & | supports, | ||
Preprocessor & | p, | ||
const SccMap & | x | ||
) | [private] |
Definition at line 1143 of file logic_program.cpp.
Var Clasp::Asp::LogicProgram::getEqBody | ( | Var | b | ) | const [inline] |
Definition at line 383 of file logic_program.h.
Var Clasp::Asp::LogicProgram::getEqNode | ( | C & | vec, |
Var | id | ||
) | const [inline, private] |
Definition at line 450 of file logic_program.h.
PrgAtom* Clasp::Asp::LogicProgram::getFalseAtom | ( | ) | const [inline, private] |
Definition at line 474 of file logic_program.h.
Var Clasp::Asp::LogicProgram::getFalseId | ( | ) | const [inline, private] |
Definition at line 473 of file logic_program.h.
PrgHead* Clasp::Asp::LogicProgram::getHead | ( | PrgEdge | it | ) | const [inline] |
Definition at line 379 of file logic_program.h.
Literal Clasp::Asp::LogicProgram::getLiteral | ( | Var | atomId | ) | const |
Returns the internal literal that is associated with the given atom.
std::logic_error | if precondition is violated. |
Definition at line 485 of file logic_program.cpp.
PrgNode* Clasp::Asp::LogicProgram::getSupp | ( | PrgEdge | it | ) | const [inline] |
Definition at line 380 of file logic_program.h.
VarVec & Clasp::Asp::LogicProgram::getSupportedBodies | ( | bool | sorted | ) |
Definition at line 1371 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::handleNatively | ( | RuleType | t, |
const BodyInfo & | i | ||
) | const [private] |
Definition at line 550 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::hasConflict | ( | ) | const [inline] |
Definition at line 376 of file logic_program.h.
bool Clasp::Asp::LogicProgram::hasMinimize | ( | ) | const [inline] |
Returns whether the program contains any minimize statements.
Definition at line 343 of file logic_program.h.
void Clasp::Asp::LogicProgram::incEqs | ( | VarType | t | ) | [inline] |
Definition at line 410 of file logic_program.h.
void Clasp::Asp::LogicProgram::incTr | ( | RuleType | r, |
uint32 | n | ||
) | [inline] |
Definition at line 408 of file logic_program.h.
void Clasp::Asp::LogicProgram::incTrAux | ( | uint32 | n | ) | [inline] |
Definition at line 409 of file logic_program.h.
bool Clasp::Asp::LogicProgram::isFact | ( | PrgAtom * | a | ) | const [inline] |
Definition at line 385 of file logic_program.h.
PrgAtom * Clasp::Asp::LogicProgram::mergeEqAtoms | ( | PrgAtom * | a, |
Var | rootAtom | ||
) |
Definition at line 1312 of file logic_program.cpp.
PrgBody * Clasp::Asp::LogicProgram::mergeEqBodies | ( | PrgBody * | b, |
Var | rootBody, | ||
bool | hashEq, | ||
bool | atomsAssigned | ||
) |
Definition at line 1332 of file logic_program.cpp.
Adds a new atom to the program.
Definition at line 399 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::normalize | ( | ) | [private] |
uint32 Clasp::Asp::LogicProgram::numAtoms | ( | ) | const [inline] |
Returns the number of atoms in the logic program.
Definition at line 345 of file logic_program.h.
uint32 Clasp::Asp::LogicProgram::numBodies | ( | ) | const [inline] |
Returns the number of bodies in the current (slice of the) logic program.
Definition at line 347 of file logic_program.h.
uint32 Clasp::Asp::LogicProgram::numDisjunctions | ( | ) | const [inline] |
Returns the number of disjunctive heads.
Definition at line 349 of file logic_program.h.
bool Clasp::Asp::LogicProgram::ok | ( | ) | const [inline, virtual] |
Returns true if the program is not conflicting.
Reimplemented from Clasp::ProgramBuilder.
Definition at line 377 of file logic_program.h.
LogicProgram& Clasp::Asp::LogicProgram::operator= | ( | const LogicProgram & | ) | [private] |
const AspOptions& Clasp::Asp::LogicProgram::options | ( | ) | const [inline] |
Definition at line 375 of file logic_program.h.
bool Clasp::Asp::LogicProgram::positiveLoopSafe | ( | PrgBody * | b, |
PrgBody * | root | ||
) | const [private] |
Definition at line 1326 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::prepareComponents | ( | ) | [private] |
Definition at line 832 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::prepareProgram | ( | bool | checkSccs | ) | [private] |
Definition at line 691 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::propagate | ( | bool | backprop | ) |
Definition at line 969 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::propagate | ( | ) | [inline] |
Definition at line 401 of file logic_program.h.
uint32 Clasp::Asp::LogicProgram::removeBody | ( | PrgBody * | b, |
uint32 | oldHash | ||
) | [private] |
Definition at line 1299 of file logic_program.cpp.
PrgAtom * Clasp::Asp::LogicProgram::resize | ( | Var | atomId | ) | [private] |
Definition at line 962 of file logic_program.cpp.
RuleState& Clasp::Asp::LogicProgram::ruleState | ( | ) | [inline] |
Definition at line 403 of file logic_program.h.
LogicProgram & Clasp::Asp::LogicProgram::setAtomName | ( | Var | atomId, |
const char * | name | ||
) |
Sets the name of the given atom and adds it to the program's symbol table.
atomId | The id of the atom for which a name should be set |
name | The new name of the atom with the given id. |
RedefinitionError | precondition is violated. |
std::logic_error | program is frozen. |
Definition at line 406 of file logic_program.cpp.
LogicProgram& Clasp::Asp::LogicProgram::setBound | ( | weight_t | bound | ) | [inline] |
Sets the bound (resp. min weight) of the currently active rule.
bound | The lower bound (resp. min weight) of the rule to be created. |
Definition at line 300 of file logic_program.h.
LogicProgram & Clasp::Asp::LogicProgram::setCompute | ( | Var | atomId, |
bool | value | ||
) |
Forces the atom's truth-value to value.
atomId | Id of the Atom for which a truth-value should be set. |
pos | If true, atom is set to true (forced to be in every answer set). Otherwise atom is set to false (not part of any answer set). |
Definition at line 414 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::setConflict | ( | ) | [inline] |
Definition at line 402 of file logic_program.h.
void Clasp::Asp::LogicProgram::setExtendedRuleMode | ( | ExtendedRuleMode | m | ) | [inline] |
Sets the mode for handling extended rules (default: mode_native).
Definition at line 127 of file logic_program.h.
void Clasp::Asp::LogicProgram::setNonHcfConfiguration | ( | Configuration * | c | ) | [inline] |
Sets the configuration to be used for checker solvers in disjunctive LP solving.
Definition at line 131 of file logic_program.h.
void Clasp::Asp::LogicProgram::setOptions | ( | const AspOptions & | opts | ) |
Sets preprocessing options.
Definition at line 227 of file logic_program.cpp.
RuleType Clasp::Asp::LogicProgram::simplifyBody | ( | const Rule & | r, |
BodyInfo & | info | ||
) | [private] |
Definition at line 1002 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::simplifyMinimize | ( | ) | [private] |
Definition at line 650 of file logic_program.cpp.
RuleType Clasp::Asp::LogicProgram::simplifyRule | ( | const Rule & | r, |
VarVec & | head, | ||
BodyInfo & | info | ||
) |
Definition at line 1090 of file logic_program.cpp.
LogicProgram& Clasp::Asp::LogicProgram::start | ( | SharedContext & | ctx, |
const AspOptions & | opts = AspOptions() |
||
) | [inline] |
Starts the definition of a logic program.
Definition at line 121 of file logic_program.h.
Var Clasp::Asp::LogicProgram::startAtom | ( | ) | const [inline] |
Returns the id of the first atom of the current step.
Definition at line 351 of file logic_program.h.
LogicProgram& Clasp::Asp::LogicProgram::startRule | ( | RuleType | t = BASICRULE , |
weight_t | bound = -1 |
||
) | [inline] |
Starts the construction of a rule.
t | The type of the new rule. |
bound | The lower bound (resp. min weight) of the rule to be created. |
Definition at line 286 of file logic_program.h.
bool Clasp::Asp::LogicProgram::transform | ( | const PrgBody & | body, |
BodyInfo & | out | ||
) | const [private] |
Definition at line 1378 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::transform | ( | const MinimizeRule & | body, |
BodyInfo & | out | ||
) | const [private] |
Definition at line 1401 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::transformExtended | ( | ) | [private] |
Definition at line 582 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::transformIntegrity | ( | uint32 | maxAux | ) | [private] |
Definition at line 598 of file logic_program.cpp.
bool Clasp::Asp::LogicProgram::transformNoAux | ( | RuleType | t, |
const BodyInfo & | i | ||
) | const [private] |
Definition at line 578 of file logic_program.cpp.
LogicProgram & Clasp::Asp::LogicProgram::unfreeze | ( | Var | atomId | ) |
Removes any protection from the given atom.
If the atom is defined in this or a previous step, the operation has no effect.
Definition at line 437 of file logic_program.cpp.
VarIter Clasp::Asp::LogicProgram::unfreeze_begin | ( | ) | const [inline] |
Definition at line 390 of file logic_program.h.
VarIter Clasp::Asp::LogicProgram::unfreeze_end | ( | ) | const [inline] |
Definition at line 391 of file logic_program.h.
bool Clasp::Asp::LogicProgram::update | ( | ) | [inline] |
Unfreezes a currently frozen program and starts an incremental step.
If a program is to be defined incrementally, this function must be called exactly once for each step before any new rules or atoms are added.
std::logic_error | precondition is violated. |
Definition at line 148 of file logic_program.h.
uint32 Clasp::Asp::LogicProgram::update | ( | PrgBody * | b, |
uint32 | oldHash, | ||
uint32 | newHash | ||
) |
Definition at line 1284 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::updateFrozenAtoms | ( | ) | [private] |
Definition at line 659 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::upRules | ( | RuleType | r, |
int | i | ||
) | [inline] |
Definition at line 407 of file logic_program.h.
void Clasp::Asp::LogicProgram::write | ( | std::ostream & | os | ) |
Writes the (possibly simplified) program in lparse-format to the given stream.
Definition at line 298 of file logic_program.cpp.
void Clasp::Asp::LogicProgram::writeBody | ( | const BodyInfo & | body, |
std::ostream & | out | ||
) | const [private] |
Definition at line 1418 of file logic_program.cpp.
Definition at line 362 of file logic_program.h.
Definition at line 477 of file logic_program.h.
VarVec Clasp::Asp::LogicProgram::activeHead_ [private] |
Definition at line 478 of file logic_program.h.
AtomList Clasp::Asp::LogicProgram::atoms_ [private] |
Definition at line 484 of file logic_program.h.
BodyList Clasp::Asp::LogicProgram::bodies_ [private] |
Definition at line 483 of file logic_program.h.
IndexMap Clasp::Asp::LogicProgram::bodyIndex_ [private] |
Definition at line 481 of file logic_program.h.
IndexMap Clasp::Asp::LogicProgram::disjIndex_ [private] |
Definition at line 482 of file logic_program.h.
Definition at line 486 of file logic_program.h.
RuleList Clasp::Asp::LogicProgram::extended_ [private] |
Definition at line 480 of file logic_program.h.
struct Clasp::Asp::LogicProgram::Incremental* Clasp::Asp::LogicProgram::incData_ [private] |
VarVec Clasp::Asp::LogicProgram::initialSupp_ [private] |
Definition at line 487 of file logic_program.h.
struct Clasp::Asp::LogicProgram::MinimizeRule* Clasp::Asp::LogicProgram::minimize_ [private] |
Definition at line 490 of file logic_program.h.
NonHcfSet Clasp::Asp::LogicProgram::nonHcfs_ [private] |
Definition at line 489 of file logic_program.h.
AspOptions Clasp::Asp::LogicProgram::opts_ [private] |
Definition at line 503 of file logic_program.h.
VarVec Clasp::Asp::LogicProgram::propQ_ [private] |
Definition at line 488 of file logic_program.h.
Rule Clasp::Asp::LogicProgram::rule_ [private] |
Definition at line 476 of file logic_program.h.
Definition at line 479 of file logic_program.h.
AtomList Clasp::Asp::LogicProgram::sccAtoms_ [private] |
Definition at line 485 of file logic_program.h.
Definition at line 361 of file logic_program.h.