Clingo
Loading...
Searching...
No Matches
backend.h
1#ifndef CLINGO_BACKEND_H
2#define CLINGO_BACKEND_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <clingo/core.h>
9#include <clingo/shared.h>
10#include <clingo/symbol.h>
11
12typedef struct clingo_control clingo_control_t;
13
29
36
45
47typedef struct clingo_backend clingo_backend_t;
48
56CLINGO_VISIBILITY_DEFAULT bool clingo_control_backend(clingo_control_t *control, clingo_backend_t **backend);
57
62CLINGO_VISIBILITY_DEFAULT bool clingo_backend_close(clingo_backend_t *backend);
63
73CLINGO_VISIBILITY_DEFAULT bool clingo_backend_rule(clingo_backend_t *backend, bool choice, clingo_atom_t const *head,
74 size_t head_size, clingo_literal_t const *body, size_t body_size);
86CLINGO_VISIBILITY_DEFAULT bool clingo_backend_weight_rule(clingo_backend_t *backend, bool choice,
87 clingo_atom_t const *head, size_t head_size,
88 clingo_weight_t lower_bound,
89 clingo_weighted_literal_t const *body, size_t body_size);
97CLINGO_VISIBILITY_DEFAULT bool clingo_backend_minimize(clingo_backend_t *backend, clingo_weight_t priority,
98 clingo_weighted_literal_t const *literals, size_t size);
105CLINGO_VISIBILITY_DEFAULT bool clingo_backend_project(clingo_backend_t *backend, clingo_atom_t const *atoms,
106 size_t size);
113CLINGO_VISIBILITY_DEFAULT bool clingo_backend_external(clingo_backend_t *backend, clingo_atom_t atom,
122CLINGO_VISIBILITY_DEFAULT bool clingo_backend_assume(clingo_backend_t *backend, clingo_literal_t const *literals,
123 size_t size);
134CLINGO_VISIBILITY_DEFAULT bool clingo_backend_heuristic(clingo_backend_t *backend, clingo_atom_t atom,
135 clingo_heuristic_type_t type, int bias, unsigned priority,
136 clingo_literal_t const *condition, size_t size);
145CLINGO_VISIBILITY_DEFAULT bool clingo_backend_acyc_edge(clingo_backend_t *backend, int node_u, int node_v,
146 clingo_literal_t const *condition, size_t size);
153CLINGO_VISIBILITY_DEFAULT bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_symbol_t const *symbol,
154 clingo_atom_t *atom);
161CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_number(clingo_backend_t *backend, int number,
162 clingo_id_t *term_id);
170CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_string(clingo_backend_t *backend, char const *string,
171 size_t size, clingo_id_t *term_id);
180CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_sequence(clingo_backend_t *backend,
182 clingo_id_t const *arguments, size_t size,
183 clingo_id_t *term_id);
193CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_function(clingo_backend_t *backend, char const *name,
194 size_t name_size, clingo_id_t const *arguments,
195 size_t arguments_size, clingo_id_t *term_id);
202CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_symbol(clingo_backend_t *backend, clingo_symbol_t symbol,
203 clingo_id_t *term_id);
213CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_element(clingo_backend_t *backend, clingo_id_t const *tuple,
214 size_t tuple_size, clingo_literal_t const *condition,
215 size_t condition_size, clingo_id_t *element_id);
216
233CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_atom(clingo_backend_t *backend, clingo_symbol_t name,
234 clingo_id_t const *elements, size_t size,
235 clingo_string_t *operator_name,
236 clingo_id_t right_hand_side_id, clingo_atom_t const *atom_in,
237 clingo_atom_t *atom_out);
238
240#ifdef __cplusplus
241}
242#endif
243
244#endif
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_project(clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size)
Add a projection directive.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_symbol(clingo_backend_t *backend, clingo_symbol_t symbol, clingo_id_t *term_id)
Convert the given symbol into a theory term.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_function(clingo_backend_t *backend, char const *name, size_t name_size, clingo_id_t const *arguments, size_t arguments_size, clingo_id_t *term_id)
Add a theory term representing a function.
struct clingo_backend clingo_backend_t
Handle to the backend to add directives in aspif format.
Definition backend.h:47
CLINGO_VISIBILITY_DEFAULT bool clingo_control_backend(clingo_control_t *control, clingo_backend_t **backend)
Get a backend object to extend the ground program.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_assume(clingo_backend_t *backend, clingo_literal_t const *literals, size_t size)
Add an assumption directive.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_number(clingo_backend_t *backend, int number, clingo_id_t *term_id)
Add a numeric theory term.
CLINGO_VISIBILITY_DEFAULT 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.
CLINGO_VISIBILITY_DEFAULT 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 a heuristic directive.
CLINGO_VISIBILITY_DEFAULT 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.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_string(clingo_backend_t *backend, char const *string, size_t size, clingo_id_t *term_id)
Add a theory term representing a string.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_symbol_t const *symbol, clingo_atom_t *atom)
Get a fresh atom to be used in aspif directives.
CLINGO_VISIBILITY_DEFAULT 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.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_term_sequence(clingo_backend_t *backend, clingo_theory_sequence_type_t type, clingo_id_t const *arguments, size_t size, clingo_id_t *term_id)
Add a theory term representing a sequence of theory terms.
CLINGO_VISIBILITY_DEFAULT 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.
clingo_theory_sequence_type_e
Enumeration of theory sequence types.
Definition backend.h:38
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_close(clingo_backend_t *backend)
Finalize the backend after using it.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_element(clingo_backend_t *backend, clingo_id_t const *tuple, size_t tuple_size, clingo_literal_t const *condition, size_t condition_size, clingo_id_t *element_id)
Add a theory atom element.
int clingo_theory_sequence_type_t
Corresponding type to clingo_theory_sequence_type_e.
Definition backend.h:44
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_external(clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type)
Add an external statement.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_theory_atom(clingo_backend_t *backend, clingo_symbol_t name, clingo_id_t const *elements, size_t size, clingo_string_t *operator_name, clingo_id_t right_hand_side_id, clingo_atom_t const *atom_in, clingo_atom_t *atom_out)
Add a theory atom without a guard.
@ clingo_theory_sequence_type_list
Theory lists "[t1,...,tn]".
Definition backend.h:41
@ clingo_theory_sequence_type_tuple
Theory tuples "(t1,...,tn)".
Definition backend.h:39
@ clingo_theory_sequence_type_set
Theory sets "{t1,...,tn}".
Definition backend.h:40
uint32_t clingo_atom_t
Unsigned integer type used for aspif atoms.
Definition core.h:80
int32_t clingo_literal_t
Signed integer type used for aspif and solver literals.
Definition core.h:78
uint32_t clingo_id_t
Unsigned integer type used in various places.
Definition core.h:82
int32_t clingo_weight_t
Signed integer type for weights in sum aggregates and minimize constraints.
Definition core.h:84
int clingo_external_type_t
Corresponding type to clingo_external_type_e.
Definition shared.h:32
int clingo_heuristic_type_t
Corresponding type to clingo_heuristic_type_e.
Definition shared.h:22
uint64_t clingo_symbol_t
Type to represent a symbol.
Definition symbol.h:51
Struct to capture strings that are not null-terminated.
Definition core.h:91
A literal with an associated weight.
Definition core.h:86