Clingo
|
Interface to output statements. More...
#include <output.hh>
Public Types | |
using | BdElem = std::pair< SymbolSpan, IndexSpan > |
A body aggregate element. | |
using | BdElemSpan = std::span< BdElem const > |
A span of body aggregate elements. | |
using | HdElem = std::pair< SymbolSpan, std::span< std::tuple< Symbol, size_t, size_t > const > > |
A head aggregate element. | |
using | HdElemSpan = std::span< HdElem const > |
A span of body aggregate elements. | |
using | Guard = std::pair< Relation, Symbol > |
A rhs guard. | |
using | GuardSpan = std::span< Guard const > |
The guards of an aggregate. | |
using | CondLit = std::pair< std::optional< size_t >, size_t > |
A conditional literal. | |
using | CondLitSpan = std::span< CondLit const > |
A span of conditional literals. | |
using | DisjElem = std::tuple< Symbol, size_t, IndexSpan > |
A disjunction element. | |
using | DisjElemSpan = std::span< DisjElem const > |
A span of disjunction elements. | |
Public Member Functions | |
virtual | ~OutputStm ()=default |
Destroy the output. | |
auto | uid (bool fact=false) -> size_t |
Generate a new unique id for a literal. | |
void | fact (Symbol sym, size_t uid) |
Output the given fact. | |
void | project_atom (size_t p_atom, size_t atom) |
Adds a projection rule for the given atom. | |
auto | body () -> OutputLit & |
Get an output for body literals. | |
void | rule (std::optional< std::tuple< Symbol, size_t, bool > > head) |
Output the given rule. | |
void | external (Symbol atom, size_t uid, ExternalType type) |
Output the given external. | |
void | project (Symbol atom, size_t uid) |
Output the given external. | |
auto | aggr_rule (std::optional< size_t > uid) -> size_t |
Output a head aggregate rule. | |
auto | theory_rule (std::optional< size_t > uid) -> size_t |
Output a theory atom rule. | |
auto | disjunctive_rule (std::optional< size_t > uid) -> size_t |
Output a disjunctive rule. | |
void | weak_constraint (Number const &weight, Number const *prio, SymbolSpan terms) |
Output the given weak constraint. | |
void | heuristic (Symbol atom, size_t uid, Number const &weight, Number const *prio, HeuristicType type) |
Output the given heuristic statement. | |
void | edge (Symbol src, Symbol dst) |
Output the given edge statement. | |
void | show_atom (Symbol atom, size_t uid) |
Output the given atom. | |
void | show_term (Symbol term) |
Output the given term. | |
auto | cond () -> OutputLit & |
Return an output for a condition. | |
auto | cond_id () -> size_t |
Commit a condition of simple literals returning its id. | |
void | bd_aggr (size_t uid, AggregateFunction fun, BdElemSpan elems, GuardSpan guards) |
Complete a delayed body aggregate. | |
void | hd_aggr (size_t uid, AggregateFunction fun, HdElemSpan elems, GuardSpan guards) |
Complete a delayed head aggregate. | |
void | disjunction (size_t uid, DisjElemSpan elems) |
Complete a delayed disjunction. | |
void | cond_lit (size_t uid, CondLitSpan elems) |
Complete a delayed conditional literal. | |
auto | theory () -> OutputTheory & |
Return a theory output. | |
void | flush () |
Flush all delayed rule assuming they are completely defined. | |
void | classical_negation (size_t atom_a, size_t atom_b) |
Handle classical negation of two atoms. | |
void | end_step () |
End the current (incremental) grounding step. | |
void | mark (SymbolCollector &gc) |
Mark owned symbols. | |
void | simplify (std::function< TruthValue(prg_lit_t)> const &pred) |
Simplify stored state in the output. | |
Interface to output statements.
using CppClingo::OutputStm::BdElem = std::pair<SymbolSpan, IndexSpan> |
A body aggregate element.
The span captures the ids of conditions.
using CppClingo::OutputStm::CondLit = std::pair<std::optional<size_t>, size_t> |
A conditional literal.
The two sizes correspond to indices of conditions. If the first one is not given, it is assumed false.
using CppClingo::OutputStm::HdElem = std::pair<SymbolSpan, std::span<std::tuple<Symbol, size_t, size_t> const> > |
A head aggregate element.
The span captures the heads (#sup
is used to represent #true
) and the ids of conditions.
Output the given edge statement.
The body of the rule has to be output first.
|
inline |
Flush all delayed rule assuming they are completely defined.
Should be called after grounding a component.
|
inline |
Output the given heuristic statement.
The body of the rule has to be output first.
|
inline |
Output the given rule.
The body of the rule has to be output first.
|
inline |
Output the given term.
The body of the corresponding statement has to be output first.
|
inline |
Generate a new unique id for a literal.
Parameter fact can be set to true. The output is free to map all facts to the same id.
|
inline |
Output the given weak constraint.
The body of the rule has to be output first.