|
Clingo
|
Program backend to add atoms and statements. More...
#include <backend.hh>
Public Member Functions | |
| ProgramBackend (clingo_backend_t *backend) | |
| Create a program atom from its C representation. | |
| void | close () |
| Finalize the backend. | |
| auto | atom (std::optional< Symbol > symbol) const -> ProgramAtom |
| Create a fresh program atom. | |
| void | rule (ProgramAtomSpan head, ProgramLiteralSpan body={}, bool choice=false) const |
| Add a choice or disjunctive ground rule. | |
| void | weight_rule (ProgramAtomSpan head, Weight lower, WeightedLiteralSpan body, bool choice=false) const |
| Add a ground weight rule to the program. | |
| void | minimize (WeightedLiteralSpan literals, Weight priority=0) const |
| Add a minimize constraint to the program. | |
| void | project (ProgramAtomSpan atoms) const |
| Add a project directive to the program. | |
| void | external (ProgramAtom atom, ExternalType type) const |
| Add an external directive to the program. | |
| void | assume (ProgramLiteralSpan literals) const |
| Add assumptions to the program. | |
| void | heuristic (ProgramAtom atom, HeuristicType type, int bias, unsigned priority=0, ProgramLiteralSpan condition={}) const |
| Add a heuristic directive to the program. | |
| void | edge (int node_u, int node_v, ProgramLiteralSpan condition) const |
| Add an edge directive. | |
| auto | theory () const -> TheoryBackend const & |
| Get the associated theory backend. | |
Program backend to add atoms and statements.
The program backend must not be stored. Its destructor finalizes the added statements.
|
inlineexplicit |
Create a program atom from its C representation.
For internal use.
| backend | the C backend |
|
inline |
Add assumptions to the program.
| literals | the literals to assume |
|
inline |
Create a fresh program atom.
If a symbol is given, the corresponding atom is returned or a fresh one created. If no symbol is given, a fresh program atom is returned.
| symbol | the symbol of the program atom |
|
inline |
Finalize the backend.
After closing the backend, it must no longer be used. If this function is called, the destructor is guaranteed to not throw.
|
inline |
Add an edge directive.
| node_u | the start vertex of the edge |
| node_v | the end vertex of the edge |
| condition | the condition under which the edge is part of the graph |
|
inline |
Add an external directive to the program.
| atom | the external atom |
| type | the type of the external atom |
|
inline |
Add a heuristic directive to the program.
| atom | the target atom |
| type | the type of the heuristic modification |
| bias | the heuristic bias |
| priority | the heuristic priority |
| condition | the condition under which to apply the heuristic modification |
|
inline |
Add a minimize constraint to the program.
| literals | the weighted literals |
| priority | the priority of the constraint |
|
inline |
Add a project directive to the program.
| atoms | the atoms to project |
|
inline |
Add a choice or disjunctive ground rule.
| head | the head atoms |
| body | the body literals |
| choice | whether the head is a choice or disjunction |
|
inline |
Get the associated theory backend.
|
inline |
Add a ground weight rule to the program.
| head | the head atoms |
| lower | the lower bound |
| body | the weighted body literals |
| choice | whether the head is a choice or disjunction |