Add non-ground program representations (ASTs) to logic programs or extend the ground (aspif) program.
For an example about ground logic programs, see backend.c. For an example about non-ground logic programs, see ast.c and the Abstract Syntax Trees module.
|
bool | clingo_backend_rule (clingo_backend_t *backend, bool choice, clingo_atom_t const *head, size_t head_size, clingo_literal_t const *body, size_t body_size) |
| Add a rule to the program. More...
|
|
bool | clingo_backend_weight_rule (clingo_backend_t *backend, bool choice, clingo_atom_t const *head, size_t head_size, clingo_weight_t lower_bound, clingo_weighted_literal_t const *body, size_t body_size) |
| Add a weight rule to the program. More...
|
|
bool | clingo_backend_minimize (clingo_backend_t *backend, clingo_weight_t priority, clingo_weighted_literal_t const *literals, size_t size) |
| Add a minimize constraint (or weak constraint) to the program. More...
|
|
bool | clingo_backend_project (clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size) |
| Add a projection directive. More...
|
|
bool | clingo_backend_external (clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type) |
| Add an external statement. More...
|
|
bool | clingo_backend_assume (clingo_backend_t *backend, clingo_literal_t const *literals, size_t size) |
| Add an assumption directive. More...
|
|
bool | clingo_backend_heuristic (clingo_backend_t *backend, clingo_atom_t atom, clingo_heuristic_type_t type, int bias, unsigned priority, clingo_literal_t const *condition, size_t size) |
| Add an heuristic directive. More...
|
|
bool | clingo_backend_acyc_edge (clingo_backend_t *backend, int node_u, int node_v, clingo_literal_t const *condition, size_t size) |
| Add an edge directive. More...
|
|
bool | clingo_backend_add_atom (clingo_backend_t *backend, clingo_atom_t *atom) |
| Get a fresh atom to be used in aspif directives. More...
|
|
bool | clingo_program_builder_begin (clingo_program_builder_t *builder) |
| Begin building a program. More...
|
|
bool | clingo_program_builder_add (clingo_program_builder_t *builder, clingo_ast_statement_t const *statement) |
| Adds a statement to the program. More...
|
|
bool | clingo_program_builder_end (clingo_program_builder_t *builder) |
| End building a program. More...
|
|
Enumeration of different external statements.
Enumerator |
---|
clingo_external_type_free |
allow an external to be assigned freely
|
clingo_external_type_true |
assign an external to true
|
clingo_external_type_false |
assign an external to false
|
clingo_external_type_release |
no longer treat an atom as external
|
Enumeration of different heuristic modifiers.
Enumerator |
---|
clingo_heuristic_type_level |
set the level of an atom
|
clingo_heuristic_type_sign |
configure which sign to chose for an atom
|
clingo_heuristic_type_factor |
modify VSIDS factor of an atom
|
clingo_heuristic_type_init |
modify the initial VSIDS score of an atom
|
clingo_heuristic_type_true |
set the level of an atom and choose a positive sign
|
clingo_heuristic_type_false |
set the level of an atom and choose a negative sign
|
Add an edge directive.
- Parameters
-
[in] | backend | the target backend |
[in] | node_u | the start vertex of the edge |
[in] | node_v | the end vertex of the edge |
[in] | condition | the condition under which the edge is part of the graph |
[in] | size | the number of atoms in the condition |
- Returns
- whether the call was successful; might set one of the following error codes:
Get a fresh atom to be used in aspif directives.
- Parameters
-
[in] | backend | the target backend |
[out] | atom | the resulting atom |
- Returns
- whether the call was successful
- Examples:
- backend.c.
Add an assumption directive.
- Parameters
-
[in] | backend | the target backend |
[in] | literals | the literals to assume (positive literals are true and negative literals false for the next solve call) |
[in] | size | the number of atoms |
- Returns
- whether the call was successful; might set one of the following error codes:
- Examples:
- theory-atoms.c.
Add an external statement.
- Parameters
-
[in] | backend | the target backend |
[in] | atom | the external atom |
[in] | type | the type of the external statement |
- Returns
- whether the call was successful; might set one of the following error codes:
Add an heuristic directive.
- Parameters
-
[in] | backend | the target backend |
[in] | atom | the target atom |
[in] | type | the type of the heuristic modification |
[in] | bias | the heuristic bias |
[in] | priority | the heuristic priority |
[in] | condition | the condition under which to apply the heuristic modification |
[in] | size | the number of atoms in the condition |
- Returns
- whether the call was successful; might set one of the following error codes:
Add a minimize constraint (or weak constraint) to the program.
- Parameters
-
[in] | backend | the target backend |
[in] | priority | the priority of the constraint |
[in] | literals | the weighted literals whose sum to minimize |
[in] | size | the number of weighted literals |
- Returns
- whether the call was successful; might set one of the following error codes:
Add a projection directive.
- Parameters
-
[in] | backend | the target backend |
[in] | atoms | the atoms to project on |
[in] | size | the number of atoms |
- Returns
- whether the call was successful; might set one of the following error codes:
Add a rule to the program.
- Parameters
-
[in] | backend | the target backend |
[in] | choice | determines if the head is a choice or a disjunction |
[in] | head | the head atoms |
[in] | head_size | the number of atoms in the head |
[in] | body | the body literals |
[in] | body_size | the number of literals in the body |
- Returns
- whether the call was successful; might set one of the following error codes:
- Examples:
- backend.c.
Add a weight rule to the program.
- Attention
- All weights and the lower bound must be positive.
- Parameters
-
[in] | backend | the target backend |
[in] | choice | determines if the head is a choice or a disjunction |
[in] | head | the head atoms |
[in] | head_size | the number of atoms in the head |
[in] | lower_bound | the lower bound of the weight rule |
[in] | body | the weighted body literals |
[in] | body_size | the number of weighted literals in the body |
- Returns
- whether the call was successful; might set one of the following error codes:
Adds a statement to the program.
- Attention
- clingo_program_builder_begin() must be called before adding statements and clingo_program_builder_end() must be called after all statements have been added.
- Parameters
-
builder | the target program builder |
statement | the statement to add |
- Returns
- whether the call was successful; might set one of the following error codes:
- Examples:
- ast.c.
Begin building a program.
- Parameters
-
builder | the target program builder |
- Returns
- whether the call was successful
- Examples:
- ast.c.
End building a program.
- Parameters
-
builder | the target program builder |
- Returns
- whether the call was successful
- Examples:
- ast.c.