Clingo C API
C API for clingo providing high level functions to control grounding and solving.
clingo.h
Go to the documentation of this file.
1 // {{{ MIT License
2 
3 // Copyright 2017 Roland Kaminski
4 
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 // IN THE SOFTWARE.
22 
23 // }}}
24 
29 
44 
45 #ifndef CLINGO_H
46 #define CLINGO_H
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 #include <stddef.h>
53 #include <stdint.h>
54 #include <stdbool.h>
55 
56 #if defined _WIN32 || defined __CYGWIN__
57 # define CLINGO_WIN
58 #endif
59 #ifdef CLINGO_NO_VISIBILITY
60 # define CLINGO_VISIBILITY_DEFAULT
61 # define CLINGO_VISIBILITY_PRIVATE
62 #else
63 # ifdef CLINGO_WIN
64 # ifdef CLINGO_BUILD_LIBRARY
65 # define CLINGO_VISIBILITY_DEFAULT __declspec (dllexport)
66 # else
67 # define CLINGO_VISIBILITY_DEFAULT __declspec (dllimport)
68 # endif
69 # define CLINGO_VISIBILITY_PRIVATE
70 # else
71 # if __GNUC__ >= 4
72 # define CLINGO_VISIBILITY_DEFAULT __attribute__ ((visibility ("default")))
73 # define CLINGO_VISIBILITY_PRIVATE __attribute__ ((visibility ("hidden")))
74 # else
75 # define CLINGO_VISIBILITY_DEFAULT
76 # define CLINGO_VISIBILITY_PRIVATE
77 # endif
78 # endif
79 #endif
80 
81 #if defined __GNUC__
82 #define CLINGO_DEPRECATED __attribute__((deprecated))
83 #elif defined _MSC_VER
84 #define CLINGO_DEPRECATED __declspec(deprecated)
85 #else
86 #define CLINGO_DEPRECATED
87 #endif
88 
89 // {{{1 basic types and error/warning handling
90 
102 
107 
110 
112 #define CLINGO_VERSION_MAJOR 5
113 #define CLINGO_VERSION_MINOR 2
115 #define CLINGO_VERSION_REVISION 2
117 #define CLINGO_VERSION "5.2.2"
119 
121 typedef int32_t clingo_literal_t;
123 typedef uint32_t clingo_atom_t;
125 typedef uint32_t clingo_id_t;
127 typedef int32_t clingo_weight_t;
128 
141 };
143 typedef int clingo_error_t;
145 CLINGO_VISIBILITY_DEFAULT char const *clingo_error_string(clingo_error_t code);
149 CLINGO_VISIBILITY_DEFAULT clingo_error_t clingo_error_code();
153 CLINGO_VISIBILITY_DEFAULT char const *clingo_error_message();
157 CLINGO_VISIBILITY_DEFAULT void clingo_set_error(clingo_error_t code, char const *message);
158 
168 };
170 typedef int clingo_warning_t;
172 CLINGO_VISIBILITY_DEFAULT char const *clingo_warning_string(clingo_warning_t code);
182 typedef void (*clingo_logger_t)(clingo_warning_t code, char const *message, void *data);
183 
189 CLINGO_VISIBILITY_DEFAULT void clingo_version(int *major, int *minor, int *revision);
190 
196 };
199 
204 typedef struct clingo_location {
205  char const *begin_file;
206  char const *end_file;
207  size_t begin_line;
208  size_t end_line;
209  size_t begin_column;
210  size_t end_column;
212 
214 
215 // {{{1 signature and symbols
216 
233 
240 
243 
248 typedef uint64_t clingo_signature_t;
249 
252 
261 CLINGO_VISIBILITY_DEFAULT bool clingo_signature_create(char const *name, uint32_t arity, bool positive, clingo_signature_t *signature);
266 CLINGO_VISIBILITY_DEFAULT char const *clingo_signature_name(clingo_signature_t signature);
271 CLINGO_VISIBILITY_DEFAULT uint32_t clingo_signature_arity(clingo_signature_t signature);
276 CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_positive(clingo_signature_t signature);
281 CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_negative(clingo_signature_t signature);
287 CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_equal_to(clingo_signature_t a, clingo_signature_t b);
296 CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_less_than(clingo_signature_t a, clingo_signature_t b);
301 CLINGO_VISIBILITY_DEFAULT size_t clingo_signature_hash(clingo_signature_t signature);
302 
304 
312 };
315 
320 typedef uint64_t clingo_symbol_t;
321 
323 typedef struct clingo_symbolic_literal {
324  clingo_symbol_t symbol;
325  bool positive;
327 
330 
335 CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_number(int number, clingo_symbol_t *symbol);
339 CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_supremum(clingo_symbol_t *symbol);
343 CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_infimum(clingo_symbol_t *symbol);
350 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_string(char const *string, clingo_symbol_t *symbol);
361 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_id(char const *name, bool positive, clingo_symbol_t *symbol);
373 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_function(char const *name, clingo_symbol_t const *arguments, size_t arguments_size, bool positive, clingo_symbol_t *symbol);
374 
376 
379 
386 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_number(clingo_symbol_t symbol, int *number);
393 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_name(clingo_symbol_t symbol, char const **name);
400 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_string(clingo_symbol_t symbol, char const **string);
407 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_positive(clingo_symbol_t symbol, bool *positive);
414 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_negative(clingo_symbol_t symbol, bool *negative);
422 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_arguments(clingo_symbol_t symbol, clingo_symbol_t const **arguments, size_t *arguments_size);
427 CLINGO_VISIBILITY_DEFAULT clingo_symbol_type_t clingo_symbol_type(clingo_symbol_t symbol);
434 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string_size(clingo_symbol_t symbol, size_t *size);
444 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string(clingo_symbol_t symbol, char *string, size_t size);
445 
447 
450 
456 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_equal_to(clingo_symbol_t a, clingo_symbol_t b);
466 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_less_than(clingo_symbol_t a, clingo_symbol_t b);
471 CLINGO_VISIBILITY_DEFAULT size_t clingo_symbol_hash(clingo_symbol_t symbol);
472 
474 
485 CLINGO_VISIBILITY_DEFAULT bool clingo_add_string(char const *string, char const **result);
499 CLINGO_VISIBILITY_DEFAULT bool clingo_parse_term(char const *string, clingo_logger_t logger, void *logger_data, unsigned message_limit, clingo_symbol_t *symbol);
500 
502 
503 // {{{1 symbolic atoms
504 
519 
525 
528 
533 typedef struct clingo_symbolic_atoms clingo_symbolic_atoms_t;
549 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_size(clingo_symbolic_atoms_t *atoms, size_t *size);
557 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_begin(clingo_symbolic_atoms_t *atoms, clingo_signature_t const *signature, clingo_symbolic_atom_iterator_t *iterator);
563 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_end(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t *iterator);
571 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_find(clingo_symbolic_atoms_t *atoms, clingo_symbol_t symbol, clingo_symbolic_atom_iterator_t *iterator);
579 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_iterator_is_equal_to(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t a, clingo_symbolic_atom_iterator_t b, bool *equal);
586 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_symbol(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbol_t *symbol);
597 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_fact(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *fact);
607 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_external(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *external);
618 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_literal(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_literal_t *literal);
624 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_signatures_size(clingo_symbolic_atoms_t *atoms, size_t *size);
635 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_signatures(clingo_symbolic_atoms_t *atoms, clingo_signature_t *signatures, size_t size);
642 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_next(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbolic_atom_iterator_t *next);
651 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_valid(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *valid);
652 
654 
655 // {{{1 theory atoms
656 
678 
691 
694 
703 };
706 
708 typedef struct clingo_theory_atoms clingo_theory_atoms_t;
709 
712 
719 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_type(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_theory_term_type_t *type);
727 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_number(clingo_theory_atoms_t *atoms, clingo_id_t term, int *number);
735 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_name(clingo_theory_atoms_t *atoms, clingo_id_t term, char const **name);
744 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_arguments(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_id_t const **arguments, size_t *size);
752 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t term, size_t *size);
764 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string(clingo_theory_atoms_t *atoms, clingo_id_t term, char *string, size_t size);
766 
769 
777 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_tuple(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_id_t const **tuple, size_t *size);
785 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_condition(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t const **condition, size_t *size);
797 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_condition_id(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t *condition);
805 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t element, size_t *size);
815 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string(clingo_theory_atoms_t *atoms, clingo_id_t element, char *string, size_t size);
817 
820 
826 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_size(clingo_theory_atoms_t *atoms, size_t *size);
833 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_term(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t *term);
841 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_elements(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t const **elements, size_t *size);
848 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_has_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, bool *has_guard);
856 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, char const **connective, clingo_id_t *term);
863 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_literal(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_literal_t *literal);
871 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t atom, size_t *size);
881 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string(clingo_theory_atoms_t *atoms, clingo_id_t atom, char *string, size_t size);
883 
885 
886 // {{{1 model and solve control
887 
908 
914 
917 
919 typedef struct clingo_solve_control clingo_solve_control_t;
920 
922 typedef struct clingo_model clingo_model_t;
923 
929 };
932 
942 };
944 typedef unsigned clingo_show_type_bitset_t;
945 
948 
954 CLINGO_VISIBILITY_DEFAULT bool clingo_model_type(clingo_model_t *model, clingo_model_type_t *type);
960 CLINGO_VISIBILITY_DEFAULT bool clingo_model_number(clingo_model_t *model, uint64_t *number);
968 CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols_size(clingo_model_t *model, clingo_show_type_bitset_t show, size_t *size);
984 CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols(clingo_model_t *model, clingo_show_type_bitset_t show, clingo_symbol_t *symbols, size_t size);
991 CLINGO_VISIBILITY_DEFAULT bool clingo_model_contains(clingo_model_t *model, clingo_symbol_t atom, bool *contained);
998 CLINGO_VISIBILITY_DEFAULT bool clingo_model_is_true(clingo_model_t *model, clingo_literal_t literal, bool *result);
1004 CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost_size(clingo_model_t *model, size_t *size);
1016 CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost(clingo_model_t *model, int64_t *costs, size_t size);
1024 CLINGO_VISIBILITY_DEFAULT bool clingo_model_optimality_proven(clingo_model_t *model, bool *proven);
1030 CLINGO_VISIBILITY_DEFAULT bool clingo_model_thread_id(clingo_model_t *model, clingo_id_t *id);
1032 
1035 
1042 CLINGO_VISIBILITY_DEFAULT bool clingo_model_context(clingo_model_t *model, clingo_solve_control_t **control);
1048 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_control_symbolic_atoms(clingo_solve_control_t *control, clingo_symbolic_atoms_t **atoms);
1061 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_control_add_clause(clingo_solve_control_t *control, clingo_literal_t const *clause, size_t size);
1063 
1065 
1066 // {{{1 solve result
1067 
1068 // NOTE: documented in Control Module
1074 };
1076 
1077 // {{{1 solve handle
1078 
1099 
1108 
1111 
1116 };
1119 
1124 };
1126 typedef unsigned clingo_solve_event_type_t;
1127 
1141 typedef bool (*clingo_solve_event_callback_t) (clingo_solve_event_type_t type, void *event, void *data, bool *goon);
1142 
1146 typedef struct clingo_solve_handle clingo_solve_handle_t;
1147 
1159 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_get(clingo_solve_handle_t *handle, clingo_solve_result_bitset_t *result);
1168 CLINGO_VISIBILITY_DEFAULT void clingo_solve_handle_wait(clingo_solve_handle_t *handle, double timeout, bool *result);
1176 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_model(clingo_solve_handle_t *handle, clingo_model_t **model);
1187 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_resume(clingo_solve_handle_t *handle);
1194 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_cancel(clingo_solve_handle_t *handle);
1203 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_close(clingo_solve_handle_t *handle);
1204 
1206 
1207 // {{{1 propagator
1208 
1220 
1226 
1229 
1235 };
1238 
1248 typedef struct clingo_propagate_init clingo_propagate_init_t;
1249 
1252 
1259 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_solver_literal(clingo_propagate_init_t *init, clingo_literal_t aspif_literal, clingo_literal_t *solver_literal);
1265 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_watch(clingo_propagate_init_t *init, clingo_literal_t solver_literal);
1271 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_symbolic_atoms(clingo_propagate_init_t *init, clingo_symbolic_atoms_t **atoms);
1277 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_theory_atoms(clingo_propagate_init_t *init, clingo_theory_atoms_t **atoms);
1283 CLINGO_VISIBILITY_DEFAULT int clingo_propagate_init_number_of_threads(clingo_propagate_init_t *init);
1289 CLINGO_VISIBILITY_DEFAULT void clingo_propagate_init_set_check_mode(clingo_propagate_init_t *init, clingo_propagator_check_mode_t mode);
1295 CLINGO_VISIBILITY_DEFAULT clingo_propagator_check_mode_t clingo_propagate_init_get_check_mode(clingo_propagate_init_t *init);
1296 
1298 
1308 typedef struct clingo_assignment clingo_assignment_t;
1309 
1312 
1317 CLINGO_VISIBILITY_DEFAULT uint32_t clingo_assignment_decision_level(clingo_assignment_t *assignment);
1322 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_conflict(clingo_assignment_t *assignment);
1328 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_literal(clingo_assignment_t *assignment, clingo_literal_t literal);
1335 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_level(clingo_assignment_t *assignment, clingo_literal_t literal, uint32_t *level);
1342 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_decision(clingo_assignment_t *assignment, uint32_t level, clingo_literal_t *literal);
1349 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_fixed(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_fixed);
1357 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_true(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_true);
1365 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_false(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_false);
1372 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_truth_value(clingo_assignment_t *assignment, clingo_literal_t literal, clingo_truth_value_t *value);
1377 CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_size(clingo_assignment_t *assignment);
1382 CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_max_size(clingo_assignment_t *assignment);
1387 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_total(clingo_assignment_t *assignment);
1388 
1390 
1400 };
1403 
1405 typedef struct clingo_propagate_control clingo_propagate_control_t;
1406 
1409 
1416 CLINGO_VISIBILITY_DEFAULT clingo_id_t clingo_propagate_control_thread_id(clingo_propagate_control_t *control);
1432 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_literal(clingo_propagate_control_t *control, clingo_literal_t *result);
1443 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_watch(clingo_propagate_control_t *control, clingo_literal_t literal);
1450 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_has_watch(clingo_propagate_control_t *control, clingo_literal_t literal);
1457 CLINGO_VISIBILITY_DEFAULT void clingo_propagate_control_remove_watch(clingo_propagate_control_t *control, clingo_literal_t literal);
1471 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_clause(clingo_propagate_control_t *control, clingo_literal_t const *clause, size_t size, clingo_clause_type_t type, bool *result);
1482 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_propagate(clingo_propagate_control_t *control, bool *result);
1483 
1485 
1488 
1490 typedef bool (*clingo_propagator_propagate_callback_t) (clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *);
1491 
1493 typedef bool (*clingo_propagator_undo_callback_t) (clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *);
1494 
1496 typedef bool (*clingo_propagator_check_callback_t) (clingo_propagate_control_t *, void *);
1497 
1502 typedef struct clingo_propagator {
1513  bool (*init) (clingo_propagate_init_t *init, void *data);
1553  bool (*propagate) (clingo_propagate_control_t *control, clingo_literal_t const *changes, size_t size, void *data);
1565  bool (*undo) (clingo_propagate_control_t *control, clingo_literal_t const *changes, size_t size, void *data);
1576  bool (*check) (clingo_propagate_control_t *control, void *data);
1578 
1580 
1581 // {{{1 backend
1582 
1598 
1605 
1608 
1618 };
1622 
1630 };
1634 
1637 typedef struct clingo_weighted_literal {
1638  clingo_literal_t literal;
1639  clingo_weight_t weight;
1641 
1643 typedef struct clingo_backend clingo_backend_t;
1644 
1655 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);
1668 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);
1677 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_minimize(clingo_backend_t *backend, clingo_weight_t priority, clingo_weighted_literal_t const* literals, size_t size);
1685 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_project(clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size);
1693 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_external(clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type);
1701 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_assume(clingo_backend_t *backend, clingo_literal_t const *literals, size_t size);
1713 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);
1723 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);
1729 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_atom_t *atom);
1730 
1732 
1733 // {{{1 configuration
1734 
1751 
1761 
1764 
1770 };
1773 
1775 typedef struct clingo_configuration clingo_configuration_t;
1776 
1782 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_root(clingo_configuration_t *configuration, clingo_id_t *key);
1791 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_type(clingo_configuration_t *configuration, clingo_id_t key, clingo_configuration_type_bitset_t *type);
1798 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_description(clingo_configuration_t *configuration, clingo_id_t key, char const **description);
1799 
1802 
1810 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size);
1820 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_at(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, clingo_id_t *subkey);
1822 
1825 
1833 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_size(clingo_configuration_t *configuration, clingo_id_t key, size_t* size);
1843 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_has_subkey(clingo_configuration_t *configuration, clingo_id_t key, char const *name, bool *result);
1852 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_subkey_name(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, char const **name);
1862 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_at(clingo_configuration_t *configuration, clingo_id_t key, char const *name, clingo_id_t* subkey);
1864 
1867 
1875 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_is_assigned(clingo_configuration_t *configuration, clingo_id_t key, bool *assigned);
1883 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size);
1893 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get(clingo_configuration_t *configuration, clingo_id_t key, char *value, size_t size);
1901 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_set(clingo_configuration_t *configuration, clingo_id_t key, char const *value);
1903 
1905 
1906 // {{{1 statistics
1907 
1938 
1944 
1947 
1954 };
1957 
1959 typedef struct clingo_statistic clingo_statistics_t;
1960 
1966 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_root(clingo_statistics_t *statistics, uint64_t *key);
1973 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_type(clingo_statistics_t *statistics, uint64_t key, clingo_statistics_type_t *type);
1974 
1977 
1985 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_size(clingo_statistics_t *statistics, uint64_t key, size_t *size);
1994 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_at(clingo_statistics_t *statistics, uint64_t key, size_t offset, uint64_t *subkey);
1996 
1999 
2007 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_size(clingo_statistics_t *statistics, uint64_t key, size_t *size);
2016 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_subkey_name(clingo_statistics_t *statistics, uint64_t key, size_t offset, char const **name);
2026 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_at(clingo_statistics_t *statistics, uint64_t key, char const *name, uint64_t *subkey);
2028 
2031 
2039 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_get(clingo_statistics_t *statistics, uint64_t key, double *value);
2041 
2043 
2044 // {{{1 ast
2045 
2063 
2074 
2077 
2078 enum clingo_ast_comparison_operator {
2079  clingo_ast_comparison_operator_greater_than = 0,
2080  clingo_ast_comparison_operator_less_than = 1,
2081  clingo_ast_comparison_operator_less_equal = 2,
2082  clingo_ast_comparison_operator_greater_equal = 3,
2083  clingo_ast_comparison_operator_not_equal = 4,
2084  clingo_ast_comparison_operator_equal = 5
2085 };
2086 typedef int clingo_ast_comparison_operator_t;
2087 
2088 enum clingo_ast_sign {
2089  clingo_ast_sign_none = 0,
2090  clingo_ast_sign_negation = 1,
2091  clingo_ast_sign_double_negation = 2
2092 };
2093 typedef int clingo_ast_sign_t;
2094 
2095 // {{{2 terms
2096 
2097 enum clingo_ast_term_type {
2098  clingo_ast_term_type_symbol = 0,
2099  clingo_ast_term_type_variable = 1,
2100  clingo_ast_term_type_unary_operation = 2,
2101  clingo_ast_term_type_binary_operation = 3,
2102  clingo_ast_term_type_interval = 4,
2103  clingo_ast_term_type_function = 5,
2104  clingo_ast_term_type_external_function = 6,
2105  clingo_ast_term_type_pool = 7
2106 };
2107 typedef int clingo_ast_term_type_t;
2108 
2113 typedef struct clingo_ast_pool clingo_ast_pool_t;
2114 typedef struct clingo_ast_term {
2115  clingo_location_t location;
2116  clingo_ast_term_type_t type;
2117  union {
2118  clingo_symbol_t symbol;
2119  char const *variable;
2120  clingo_ast_unary_operation_t const *unary_operation;
2121  clingo_ast_binary_operation_t const *binary_operation;
2122  clingo_ast_interval_t const *interval;
2123  clingo_ast_function_t const *function;
2124  clingo_ast_function_t const *external_function;
2125  clingo_ast_pool_t const *pool;
2126  };
2128 
2129 // unary operation
2130 
2131 enum clingo_ast_unary_operator {
2132  clingo_ast_unary_operator_minus = 0,
2133  clingo_ast_unary_operator_negation = 1,
2134  clingo_ast_unary_operator_absolute = 2
2135 };
2136 typedef int clingo_ast_unary_operator_t;
2137 
2139  clingo_ast_unary_operator_t unary_operator;
2140  clingo_ast_term_t argument;
2141 };
2142 
2143 // binary operation
2144 
2145 enum clingo_ast_binary_operator {
2146  clingo_ast_binary_operator_xor = 0,
2147  clingo_ast_binary_operator_or = 1,
2148  clingo_ast_binary_operator_and = 2,
2149  clingo_ast_binary_operator_plus = 3,
2150  clingo_ast_binary_operator_minus = 4,
2151  clingo_ast_binary_operator_multiplication = 5,
2152  clingo_ast_binary_operator_division = 6,
2153  clingo_ast_binary_operator_modulo = 7
2154 
2155 };
2156 typedef int clingo_ast_binary_operator_t;
2157 
2159  clingo_ast_binary_operator_t binary_operator;
2160  clingo_ast_term_t left;
2161  clingo_ast_term_t right;
2162 };
2163 
2164 // interval
2165 
2167  clingo_ast_term_t left;
2168  clingo_ast_term_t right;
2169 };
2170 
2171 // function
2172 
2174  char const *name;
2175  clingo_ast_term_t *arguments;
2176  size_t size;
2177 };
2178 
2179 // pool
2180 
2182  clingo_ast_term_t *arguments;
2183  size_t size;
2184 };
2185 
2186 // {{{2 csp
2187 
2189  clingo_location_t location;
2190  clingo_ast_term_t coefficient;
2191  clingo_ast_term_t const *variable;
2193 
2194 typedef struct clingo_ast_csp_sum_term {
2195  clingo_location_t location;
2197  size_t size;
2199 
2200 typedef struct clingo_ast_csp_guard {
2201  clingo_ast_comparison_operator_t comparison;
2204 
2205 typedef struct clingo_ast_csp_literal {
2207  clingo_ast_csp_guard_t const *guards;
2208  // NOTE: size must be at least one
2209  size_t size;
2211 
2212 // {{{2 ids
2213 
2214 typedef struct clingo_ast_id {
2215  clingo_location_t location;
2216  char const *id;
2217 } clingo_ast_id_t;
2218 
2219 // {{{2 literals
2220 
2221 typedef struct clingo_ast_comparison {
2222  clingo_ast_comparison_operator_t comparison;
2223  clingo_ast_term_t left;
2224  clingo_ast_term_t right;
2226 
2227 enum clingo_ast_literal_type {
2228  clingo_ast_literal_type_boolean = 0,
2229  clingo_ast_literal_type_symbolic = 1,
2230  clingo_ast_literal_type_comparison = 2,
2231  clingo_ast_literal_type_csp = 3
2232 };
2233 typedef int clingo_ast_literal_type_t;
2234 
2235 typedef struct clingo_ast_literal {
2236  clingo_location_t location;
2237  clingo_ast_sign_t sign;
2238  clingo_ast_literal_type_t type;
2239  union {
2240  bool boolean;
2241  clingo_ast_term_t const *symbol;
2242  clingo_ast_comparison_t const *comparison;
2243  clingo_ast_csp_literal_t const *csp_literal;
2244  };
2246 
2247 // {{{2 aggregates
2248 
2249 enum clingo_ast_aggregate_function {
2250  clingo_ast_aggregate_function_count = 0,
2251  clingo_ast_aggregate_function_sum = 1,
2252  clingo_ast_aggregate_function_sump = 2,
2253  clingo_ast_aggregate_function_min = 3,
2254  clingo_ast_aggregate_function_max = 4
2255 };
2256 typedef int clingo_ast_aggregate_function_t;
2257 
2259  clingo_ast_comparison_operator_t comparison;
2260  clingo_ast_term_t term;
2262 
2264  clingo_ast_literal_t literal;
2265  clingo_ast_literal_t const *condition;
2266  size_t size;
2268 
2269 // lparse-style aggregate
2270 
2271 typedef struct clingo_ast_aggregate {
2272  clingo_ast_conditional_literal_t const *elements;
2273  size_t size;
2274  clingo_ast_aggregate_guard_t const *left_guard;
2275  clingo_ast_aggregate_guard_t const *right_guard;
2277 
2278 // body aggregate
2279 
2281  clingo_ast_term_t *tuple;
2282  size_t tuple_size;
2283  clingo_ast_literal_t const *condition;
2284  size_t condition_size;
2286 
2288  clingo_ast_aggregate_function_t function;
2289  clingo_ast_body_aggregate_element_t const *elements;
2290  size_t size;
2291  clingo_ast_aggregate_guard_t const *left_guard;
2292  clingo_ast_aggregate_guard_t const *right_guard;
2294 
2295 // head aggregate
2296 
2298  clingo_ast_term_t const *tuple;
2299  size_t tuple_size;
2300  clingo_ast_conditional_literal_t conditional_literal;
2302 
2304  clingo_ast_aggregate_function_t function;
2305  clingo_ast_head_aggregate_element_t const *elements;
2306  size_t size;
2307  clingo_ast_aggregate_guard_t const *left_guard;
2308  clingo_ast_aggregate_guard_t const *right_guard;
2310 
2311 // disjunction
2312 
2313 typedef struct clingo_ast_disjunction {
2314  clingo_ast_conditional_literal_t const *elements;
2315  size_t size;
2317 
2318 // disjoint
2319 
2321  clingo_location_t location;
2322  clingo_ast_term_t const *tuple;
2323  size_t tuple_size;
2325  clingo_ast_literal_t const *condition;
2326  size_t condition_size;
2328 
2329 typedef struct clingo_ast_disjoint {
2330  clingo_ast_disjoint_element_t const *elements;
2331  size_t size;
2333 
2334 // {{{2 theory atom
2335 
2336 enum clingo_ast_theory_term_type {
2337  clingo_ast_theory_term_type_symbol = 0,
2338  clingo_ast_theory_term_type_variable = 1,
2339  clingo_ast_theory_term_type_tuple = 2,
2340  clingo_ast_theory_term_type_list = 3,
2341  clingo_ast_theory_term_type_set = 4,
2342  clingo_ast_theory_term_type_function = 5,
2343  clingo_ast_theory_term_type_unparsed_term = 6
2344 };
2345 typedef int clingo_ast_theory_term_type_t;
2346 
2347 typedef struct clingo_ast_theory_function clingo_ast_theory_function_t;
2348 typedef struct clingo_ast_theory_term_array clingo_ast_theory_term_array_t;
2349 typedef struct clingo_ast_theory_unparsed_term clingo_ast_theory_unparsed_term_t;
2350 
2351 typedef struct clingo_ast_theory_term {
2352  clingo_location_t location;
2353  clingo_ast_theory_term_type_t type;
2354  union {
2355  clingo_symbol_t symbol;
2356  char const *variable;
2357  clingo_ast_theory_term_array_t const *tuple;
2358  clingo_ast_theory_term_array_t const *list;
2359  clingo_ast_theory_term_array_t const *set;
2360  clingo_ast_theory_function_t const *function;
2361  clingo_ast_theory_unparsed_term_t const *unparsed_term;
2362  };
2364 
2366  clingo_ast_theory_term_t const *terms;
2367  size_t size;
2368 };
2369 
2371  char const *name;
2372  clingo_ast_theory_term_t const *arguments;
2373  size_t size;
2374 };
2375 
2377  char const *const *operators;
2378  size_t size;
2381 
2384  size_t size;
2385 };
2386 
2388  clingo_ast_theory_term_t const *tuple;
2389  size_t tuple_size;
2390  clingo_ast_literal_t const *condition;
2391  size_t condition_size;
2393 
2394 typedef struct clingo_ast_theory_guard {
2395  char const *operator_name;
2398 
2399 typedef struct clingo_ast_theory_atom {
2400  clingo_ast_term_t term;
2401  clingo_ast_theory_atom_element_t const *elements;
2402  size_t size;
2403  clingo_ast_theory_guard_t const *guard;
2405 
2406 // {{{2 head literals
2407 
2408 enum clingo_ast_head_literal_type {
2409  clingo_ast_head_literal_type_literal = 0,
2410  clingo_ast_head_literal_type_disjunction = 1,
2411  clingo_ast_head_literal_type_aggregate = 2,
2412  clingo_ast_head_literal_type_head_aggregate = 3,
2413  clingo_ast_head_literal_type_theory_atom = 4
2414 };
2415 typedef int clingo_ast_head_literal_type_t;
2416 
2417 typedef struct clingo_ast_head_literal {
2418  clingo_location_t location;
2419  clingo_ast_head_literal_type_t type;
2420  union {
2421  clingo_ast_literal_t const *literal;
2422  clingo_ast_disjunction_t const *disjunction;
2423  clingo_ast_aggregate_t const *aggregate;
2424  clingo_ast_head_aggregate_t const *head_aggregate;
2425  clingo_ast_theory_atom_t const *theory_atom;
2426  };
2428 
2429 // {{{2 body literals
2430 
2431 enum clingo_ast_body_literal_type {
2432  clingo_ast_body_literal_type_literal = 0,
2433  clingo_ast_body_literal_type_conditional = 1,
2434  clingo_ast_body_literal_type_aggregate = 2,
2435  clingo_ast_body_literal_type_body_aggregate = 3,
2436  clingo_ast_body_literal_type_theory_atom = 4,
2437  clingo_ast_body_literal_type_disjoint = 5
2438 };
2439 typedef int clingo_ast_body_literal_type_t;
2440 
2441 typedef struct clingo_ast_body_literal {
2442  clingo_location_t location;
2443  clingo_ast_sign_t sign;
2444  clingo_ast_body_literal_type_t type;
2445  union {
2446  clingo_ast_literal_t const *literal;
2447  // Note: conditional literals must not have signs!!!
2448  clingo_ast_conditional_literal_t const *conditional;
2449  clingo_ast_aggregate_t const *aggregate;
2450  clingo_ast_body_aggregate_t const *body_aggregate;
2451  clingo_ast_theory_atom_t const *theory_atom;
2452  clingo_ast_disjoint_t const *disjoint;
2453  };
2455 
2456 // {{{2 theory definitions
2457 
2458 enum clingo_ast_theory_operator_type {
2459  clingo_ast_theory_operator_type_unary = 0,
2460  clingo_ast_theory_operator_type_binary_left = 1,
2461  clingo_ast_theory_operator_type_binary_right = 2
2462 };
2463 typedef int clingo_ast_theory_operator_type_t;
2464 
2466  clingo_location_t location;
2467  char const *name;
2468  unsigned priority;
2469  clingo_ast_theory_operator_type_t type;
2471 
2473  clingo_location_t location;
2474  char const *name;
2475  clingo_ast_theory_operator_definition_t const *operators;
2476  size_t size;
2478 
2480  char const *term;
2481  char const *const *operators;
2482  size_t size;
2484 
2485 enum clingo_ast_theory_atom_definition_type {
2486  clingo_ast_theory_atom_definition_type_head = 0,
2487  clingo_ast_theory_atom_definition_type_body = 1,
2488  clingo_ast_theory_atom_definition_type_any = 2,
2489  clingo_ast_theory_atom_definition_type_directive = 3,
2490 };
2491 typedef int clingo_ast_theory_atom_definition_type_t;
2492 
2494  clingo_location_t location;
2495  clingo_ast_theory_atom_definition_type_t type;
2496  char const *name;
2497  unsigned arity;
2498  char const *elements;
2501 
2503  char const *name;
2505  size_t terms_size;
2507  size_t atoms_size;
2509 
2510 // {{{2 statements
2511 
2512 // rule
2513 
2514 typedef struct clingo_ast_rule {
2516  clingo_ast_body_literal_t const *body;
2517  size_t size;
2519 
2520 // definition
2521 
2522 typedef struct clingo_ast_definition {
2523  char const *name;
2524  clingo_ast_term_t value;
2525  bool is_default;
2527 
2528 // show
2529 
2531  clingo_signature_t signature;
2532  bool csp;
2534 
2535 typedef struct clingo_ast_show_term {
2536  clingo_ast_term_t term;
2537  clingo_ast_body_literal_t const *body;
2538  size_t size;
2539  bool csp;
2541 
2542 // minimize
2543 
2544 typedef struct clingo_ast_minimize {
2545  clingo_ast_term_t weight;
2546  clingo_ast_term_t priority;
2547  clingo_ast_term_t const *tuple;
2548  size_t tuple_size;
2549  clingo_ast_body_literal_t const *body;
2550  size_t body_size;
2552 
2553 // script
2554 
2555 enum clingo_ast_script_type {
2556  clingo_ast_script_type_lua = 0,
2557  clingo_ast_script_type_python = 1
2558 };
2559 typedef int clingo_ast_script_type_t;
2560 
2561 typedef struct clingo_ast_script {
2562  clingo_ast_script_type_t type;
2563  char const *code;
2565 
2566 // program
2567 
2568 typedef struct clingo_ast_program {
2569  char const *name;
2570  clingo_ast_id_t const *parameters;
2571  size_t size;
2573 
2574 // external
2575 
2576 typedef struct clingo_ast_external {
2577  clingo_ast_term_t atom;
2578  clingo_ast_body_literal_t const *body;
2579  size_t size;
2581 
2582 // edge
2583 
2584 typedef struct clingo_ast_edge {
2587  clingo_ast_body_literal_t const *body;
2588  size_t size;
2590 
2591 // heuristic
2592 
2593 typedef struct clingo_ast_heuristic {
2594  clingo_ast_term_t atom;
2595  clingo_ast_body_literal_t const *body;
2596  size_t size;
2597  clingo_ast_term_t bias;
2598  clingo_ast_term_t priority;
2599  clingo_ast_term_t modifier;
2601 
2602 // project
2603 
2604 typedef struct clingo_ast_project {
2605  clingo_ast_term_t atom;
2606  clingo_ast_body_literal_t const *body;
2607  size_t size;
2609 
2610 // statement
2611 
2612 enum clingo_ast_statement_type {
2613  clingo_ast_statement_type_rule = 0,
2614  clingo_ast_statement_type_const = 1,
2615  clingo_ast_statement_type_show_signature = 2,
2616  clingo_ast_statement_type_show_term = 3,
2617  clingo_ast_statement_type_minimize = 4,
2618  clingo_ast_statement_type_script = 5,
2619  clingo_ast_statement_type_program = 6,
2620  clingo_ast_statement_type_external = 7,
2621  clingo_ast_statement_type_edge = 8,
2622  clingo_ast_statement_type_heuristic = 9,
2623  clingo_ast_statement_type_project_atom = 10,
2624  clingo_ast_statement_type_project_atom_signature = 11,
2625  clingo_ast_statement_type_theory_definition = 12
2626 };
2627 typedef int clingo_ast_statement_type_t;
2628 
2629 typedef struct clingo_ast_statement {
2630  clingo_location_t location;
2631  clingo_ast_statement_type_t type;
2632  union {
2633  clingo_ast_rule_t const *rule;
2634  clingo_ast_definition_t const *definition;
2635  clingo_ast_show_signature_t const *show_signature;
2636  clingo_ast_show_term_t const *show_term;
2637  clingo_ast_minimize_t const *minimize;
2638  clingo_ast_script_t const *script;
2639  clingo_ast_program_t const *program;
2640  clingo_ast_external_t const *external;
2641  clingo_ast_edge_t const *edge;
2642  clingo_ast_heuristic_t const *heuristic;
2643  clingo_ast_project_t const *project_atom;
2644  clingo_signature_t project_signature;
2645  clingo_ast_theory_definition_t const *theory_definition;
2646  };
2648 
2649 // }}}2
2650 
2651 typedef bool (*clingo_ast_callback_t) (clingo_ast_statement_t const *, void *);
2663 CLINGO_VISIBILITY_DEFAULT bool clingo_parse_program(char const *program, clingo_ast_callback_t callback, void *callback_data, clingo_logger_t logger, void *logger_data, unsigned message_limit);
2664 
2666 
2667 // {{{1 program builder
2668 
2671 
2673 typedef struct clingo_program_builder clingo_program_builder_t;
2674 
2679 CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_begin(clingo_program_builder_t *builder);
2688 CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_add(clingo_program_builder_t *builder, clingo_ast_statement_t const *statement);
2693 CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_end(clingo_program_builder_t *builder);
2694 
2696 
2697 // {{{1 ground program observer
2698 
2702 
2705 
2725  bool (*init_program)(bool incremental, void *data);
2732  bool (*begin_step)(void *data);
2741  bool (*end_step)(void *data);
2742 
2752  bool (*rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_literal_t const *body, size_t body_size, void *data);
2763  bool (*weight_rule)(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, void *data);
2771  bool (*minimize)(clingo_weight_t priority, clingo_weighted_literal_t const* literals, size_t size, void *data);
2778  bool (*project)(clingo_atom_t const *atoms, size_t size, void *data);
2787  bool (*output_atom)(clingo_symbol_t symbol, clingo_atom_t atom, void *data);
2795  bool (*output_term)(clingo_symbol_t symbol, clingo_literal_t const *condition, size_t size, void *data);
2804  bool (*output_csp)(clingo_symbol_t symbol, int value, clingo_literal_t const *condition, size_t size, void *data);
2811  bool (*external)(clingo_atom_t atom, clingo_external_type_t type, void *data);
2818  bool (*assume)(clingo_literal_t const *literals, size_t size, void *data);
2829  bool (*heuristic)(clingo_atom_t atom, clingo_heuristic_type_t type, int bias, unsigned priority, clingo_literal_t const *condition, size_t size, void *data);
2838  bool (*acyc_edge)(int node_u, int node_v, clingo_literal_t const *condition, size_t size, void *data);
2839 
2846  bool (*theory_term_number)(clingo_id_t term_id, int number, void *data);
2853  bool (*theory_term_string)(clingo_id_t term_id, char const *name, void *data);
2868  bool (*theory_term_compound)(clingo_id_t term_id, int name_id_or_type, clingo_id_t const *arguments, size_t size, void *data);
2878  bool (*theory_element)(clingo_id_t element_id, clingo_id_t const *terms, size_t terms_size, clingo_literal_t const *condition, size_t condition_size, void *data);
2887  bool (*theory_atom)(clingo_id_t atom_id_or_zero, clingo_id_t term_id, clingo_id_t const *elements, size_t size, void *data);
2898  bool (*theory_atom_with_guard)(clingo_id_t atom_id_or_zero, clingo_id_t term_id, clingo_id_t const *elements, size_t size, clingo_id_t operator_id, clingo_id_t right_hand_side_id, void *data);
2900 
2901 // @}
2902 
2903 // {{{1 control
2904 
2918 
2923 
2926 
2944 
2947 
2959 typedef struct clingo_part {
2960  char const *name;
2961  clingo_symbol_t const *params;
2962  size_t size;
2963 } clingo_part_t;
2964 
2973 typedef bool (*clingo_symbol_callback_t) (clingo_symbol_t const *symbols, size_t symbols_size, void *data);
2974 
3014 typedef bool (*clingo_ground_callback_t) (clingo_location_t const *location, char const *name, clingo_symbol_t const *arguments, size_t arguments_size, void *data, clingo_symbol_callback_t symbol_callback, void *symbol_callback_data);
3015 
3017 typedef struct clingo_control clingo_control_t;
3018 
3039 CLINGO_VISIBILITY_DEFAULT bool clingo_control_new(char const *const * arguments, size_t arguments_size, clingo_logger_t logger, void *logger_data, unsigned message_limit, clingo_control_t **control);
3040 
3043 CLINGO_VISIBILITY_DEFAULT void clingo_control_free(clingo_control_t *control);
3044 
3047 
3055 CLINGO_VISIBILITY_DEFAULT bool clingo_control_load(clingo_control_t *control, char const *file);
3056 
3071 CLINGO_VISIBILITY_DEFAULT bool clingo_control_add(clingo_control_t *control, char const *name, char const * const * parameters, size_t parameters_size, char const *program);
3072 
3091 CLINGO_VISIBILITY_DEFAULT bool clingo_control_ground(clingo_control_t *control, clingo_part_t const *parts, size_t parts_size, clingo_ground_callback_t ground_callback, void *ground_callback_data);
3092 
3094 
3097 
3112 CLINGO_VISIBILITY_DEFAULT bool clingo_control_solve(clingo_control_t *control, clingo_solve_mode_bitset_t mode, clingo_symbolic_literal_t const *assumptions, size_t assumptions_size, clingo_solve_event_callback_t notify, void *data, clingo_solve_handle_t **handle);
3124 CLINGO_VISIBILITY_DEFAULT bool clingo_control_cleanup(clingo_control_t *control);
3134 CLINGO_VISIBILITY_DEFAULT bool clingo_control_assign_external(clingo_control_t *control, clingo_symbol_t atom, clingo_truth_value_t value);
3145 CLINGO_VISIBILITY_DEFAULT bool clingo_control_release_external(clingo_control_t *control, clingo_symbol_t atom);
3159 CLINGO_VISIBILITY_DEFAULT bool clingo_control_register_propagator(clingo_control_t *control, clingo_propagator_t const *propagator, void *data, bool sequential);
3177 CLINGO_VISIBILITY_DEFAULT bool clingo_control_statistics(clingo_control_t *control, clingo_statistics_t **statistics);
3181 CLINGO_VISIBILITY_DEFAULT void clingo_control_interrupt(clingo_control_t *control);
3193 CLINGO_VISIBILITY_DEFAULT bool clingo_control_clasp_facade(clingo_control_t *control, void **clasp);
3194 
3196 
3199 
3207 CLINGO_VISIBILITY_DEFAULT bool clingo_control_configuration(clingo_control_t *control, clingo_configuration_t **configuration);
3223 CLINGO_VISIBILITY_DEFAULT bool clingo_control_use_enumeration_assumption(clingo_control_t *control, bool enable);
3225 
3228 
3235 CLINGO_VISIBILITY_DEFAULT bool clingo_control_get_const(clingo_control_t *control, char const *name, clingo_symbol_t *symbol);
3245 CLINGO_VISIBILITY_DEFAULT bool clingo_control_has_const(clingo_control_t *control, char const *name, bool *exists);
3254 CLINGO_VISIBILITY_DEFAULT bool clingo_control_symbolic_atoms(clingo_control_t *control, clingo_symbolic_atoms_t **atoms);
3262 CLINGO_VISIBILITY_DEFAULT bool clingo_control_theory_atoms(clingo_control_t *control, clingo_theory_atoms_t **atoms);
3270 CLINGO_VISIBILITY_DEFAULT bool clingo_control_register_observer(clingo_control_t *control, clingo_ground_program_observer_t const *observer, bool replace, void *data);
3272 
3275 
3284 CLINGO_VISIBILITY_DEFAULT bool clingo_control_backend(clingo_control_t *control, clingo_backend_t **backend);
3292 CLINGO_VISIBILITY_DEFAULT bool clingo_control_program_builder(clingo_control_t *control, clingo_program_builder_t **builder);
3294 
3296 
3297 // }}}1
3298 
3299 #ifdef __cplusplus
3300 }
3301 #endif
3302 
3303 #endif
CSP variable with unbounded domain.
Definition: clingo.h:165
int clingo_external_type_t
Corresponding type to clingo_external_type.
Definition: clingo.h:1633
Definition: clingo.h:2365
configure which sign to chose for an atom
Definition: clingo.h:1613
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_condition_id(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t *condition)
Get the id of the condition of the given theory element.
bool(* clingo_propagator_check_callback_t)(clingo_propagate_control_t *, void *)
Typedef for clingo_propagator::check().
Definition: clingo.h:1496
CLINGO_VISIBILITY_DEFAULT bool clingo_control_add(clingo_control_t *control, char const *name, char const *const *parameters, size_t parameters_size, char const *program)
Extend the logic program with the given non-ground logic program in string form.
clingo_solve_result
Enumeration of bit masks for solve call results.
Definition: clingo.h:1069
the entry is a (string) value
Definition: clingo.h:1767
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_watch(clingo_propagate_init_t *init, clingo_literal_t solver_literal)
Add a watch for the solver literal in the given phase.
struct clingo_ground_program_observer clingo_ground_program_observer_t
An instance of this struct has to be registered with a solver to observe ground directives as they ar...
Represents a symbolic literal.
Definition: clingo.h:323
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_level(clingo_assignment_t *assignment, clingo_literal_t literal, uint32_t *level)
Determine the decision level of a given literal.
allow an external to be assigned freely
Definition: clingo.h:1626
set the level of an atom and choose a negative sign
Definition: clingo.h:1617
no longer treat an atom as external
Definition: clingo.h:1629
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_symbol(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbol_t *symbol)
Get the symbolic representation of an atom.
Definition: clingo.h:2235
Definition: clingo.h:2382
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_fact(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *fact)
Check whether an atom is a fact.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_theory_atoms(clingo_control_t *control, clingo_theory_atoms_t **atoms)
Get an object to inspect theory atoms that occur in the grounding.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_equal_to(clingo_symbol_t a, clingo_symbol_t b)
Check if two symbols are equal.
Yield models in calls to clingo_solve_handle_model.
Definition: clingo.h:1115
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_equal_to(clingo_signature_t a, clingo_signature_t b)
Check if two signatures are equal.
struct clingo_model clingo_model_t
Object representing a model.
Definition: clingo.h:922
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_fixed(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_fixed)
Check if a literal has a fixed truth value.
errors unrelated to clingo
Definition: clingo.h:140
struct clingo_statistic clingo_statistics_t
Handle for to the solver statistics.
Definition: clingo.h:1959
The last solve call completely exhausted the search space.
Definition: clingo.h:1072
Issued if a model is found.
Definition: clingo.h:1122
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_true(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_true)
Check if a literal is true.
Definition: clingo.h:2514
struct clingo_symbolic_literal clingo_symbolic_literal_t
Represents a symbolic literal.
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_symbolic_atoms(clingo_propagate_init_t *init, clingo_symbolic_atoms_t **atoms)
Get an object to inspect the symbolic atoms.
Definition: clingo.h:2370
Definition: clingo.h:2465
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_root(clingo_statistics_t *statistics, uint64_t *key)
Get the root key of the statistics.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_literal(clingo_assignment_t *assignment, clingo_literal_t literal)
Check if the given literal is part of a (partial) assignment.
Definition: clingo.h:2194
Definition: clingo.h:2493
a tuple term, e.g., (1,2,3)
Definition: clingo.h:697
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_control_add_clause(clingo_solve_control_t *control, clingo_literal_t const *clause, size_t size)
Add a clause that applies to the current solving step during model enumeration.
set the level of an atom and choose a positive sign
Definition: clingo.h:1616
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_clause(clingo_propagate_control_t *control, clingo_literal_t const *clause, size_t size, clingo_clause_type_t type, bool *result)
Add the given clause to the solver.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_negative(clingo_symbol_t symbol, bool *negative)
Check if a function is negative (has a sign).
CLINGO_VISIBILITY_DEFAULT bool clingo_control_assign_external(clingo_control_t *control, clingo_symbol_t atom, clingo_truth_value_t value)
Assign a truth value to an external atom.
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.
size_t begin_column
the column where the location begins
Definition: clingo.h:209
int32_t clingo_literal_t
Signed integer type used for aspif and solver literals.
Definition: clingo.h:121
Issued if the search has completed.
Definition: clingo.h:1123
CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_size(clingo_assignment_t *assignment)
The number of assigned literals in the assignment.
struct clingo_backend clingo_backend_t
Handle to the backend to add directives in aspif format.
Definition: clingo.h:1643
CLINGO_VISIBILITY_DEFAULT bool clingo_model_number(clingo_model_t *model, uint64_t *number)
Get the running number of the model.
struct clingo_control clingo_control_t
Control object holding grounding and solving state.
Definition: clingo.h:3017
a list term, e.g., [1,2,3]
Definition: clingo.h:698
clingo_symbol_type
Enumeration of available symbol types.
Definition: clingo.h:306
CLINGO_VISIBILITY_DEFAULT bool clingo_control_configuration(clingo_control_t *control, clingo_configuration_t **configuration)
Get a configuration object to change the solver configuration.
The last solve call was interrupted.
Definition: clingo.h:1073
Definition: clingo.h:2303
clingo_show_type
Enumeration of bit flags to select symbols in models.
Definition: clingo.h:934
struct clingo_solve_handle clingo_solve_handle_t
Search handle to a solve call.
Definition: clingo.h:1146
a string symbol, e.g., "a"
Definition: clingo.h:309
a symbol term, e.g., c
Definition: clingo.h:702
int clingo_clause_type_t
Corresponding type to clingo_clause_type.
Definition: clingo.h:1402
Definition: clingo.h:2394
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_create(char const *name, uint32_t arity, bool positive, clingo_signature_t *signature)
Create a new signature.
CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_infimum(clingo_symbol_t *symbol)
Construct a symbol representing #inf.
CLINGO_VISIBILITY_DEFAULT clingo_assignment_t * clingo_propagate_control_assignment(clingo_propagate_control_t *control)
Get the assignment associated with the underlying solver.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_find(clingo_symbolic_atoms_t *atoms, clingo_symbol_t symbol, clingo_symbolic_atom_iterator_t *iterator)
Find a symbolic atom given its symbolic representation.
a set term, e.g., {1,2,3}
Definition: clingo.h:699
Select symbols added by extensions.
Definition: clingo.h:939
modify the initial VSIDS score of an atom
Definition: clingo.h:1615
Definition: clingo.h:2441
the entry is a map
Definition: clingo.h:1769
CLINGO_VISIBILITY_DEFAULT bool clingo_model_optimality_proven(clingo_model_t *model, bool *proven)
Whether the optimality of a model has been proven.
Struct used to specify the program parts that have to be grounded.
Definition: clingo.h:2959
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_literal(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_literal_t *literal)
Get the aspif literal associated with the given theory atom.
other kinds of warnings
Definition: clingo.h:167
do not call clingo_propagator::check() at all
Definition: clingo.h:1232
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_size(clingo_statistics_t *statistics, uint64_t key, size_t *size)
Get the number of subkeys of a map entry.
Definition: clingo.h:2200
bool(* init)(clingo_propagate_init_t *init, void *data)
This function is called once before each solving step.
Definition: clingo.h:1513
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_at(clingo_configuration_t *configuration, clingo_id_t key, char const *name, clingo_id_t *subkey)
Lookup a subkey under the given name.
uint64_t clingo_symbolic_atom_iterator_t
Object to iterate over symbolic atoms.
Definition: clingo.h:543
Definition: clingo.h:2287
CLINGO_VISIBILITY_DEFAULT bool clingo_control_release_external(clingo_control_t *control, clingo_symbol_t atom)
Release an external atom.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_false(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_false)
Check if a literal has a fixed truth value.
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_close(clingo_solve_handle_t *handle)
Stops the running search and releases the handle.
clingo_symbol_t const * params
array of parameters
Definition: clingo.h:2961
CLINGO_VISIBILITY_DEFAULT void clingo_propagate_init_set_check_mode(clingo_propagate_init_t *init, clingo_propagator_check_mode_t mode)
Configure when to call the check method of the propagator.
CLINGO_VISIBILITY_DEFAULT void clingo_solve_handle_wait(clingo_solve_handle_t *handle, double timeout, bool *result)
Wait for the specified amount of time to check if the next result is ready.
struct clingo_propagate_control clingo_propagate_control_t
This object can be used to add clauses and propagate literals while solving.
Definition: clingo.h:1405
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_elements(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t const **elements, size_t *size)
Get the theory elements associated with the theory atom.
Definition: clingo.h:2158
CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols(clingo_model_t *model, clingo_show_type_bitset_t show, clingo_symbol_t *symbols, size_t size)
Get the symbols of the selected types in the model.
char const * begin_file
the file where the location begins
Definition: clingo.h:205
uint32_t clingo_atom_t
Unsigned integer type used for aspif atoms.
Definition: clingo.h:123
struct clingo_location clingo_location_t
Represents a source code location marking its beginnig and end.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_less_than(clingo_symbol_t a, clingo_symbol_t b)
Check if a symbol is less than another symbol.
modify VSIDS factor of an atom
Definition: clingo.h:1614
Definition: clingo.h:2221
int clingo_propagator_check_mode_t
Corresponding type to clingo_propagator_check_mode.
Definition: clingo.h:1237
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_valid(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *valid)
Check whether the given iterator points to some element with the sequence of symbolic atoms or to the...
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_propagate(clingo_propagate_control_t *control, bool *result)
Propagate implied literals (resulting from added clauses).
undefined arithmetic operation or weight of aggregate
Definition: clingo.h:161
bool positive
whether the literal has a sign
Definition: clingo.h:325
int clingo_symbol_type_t
Corresponding type to clingo_symbol_type.
Definition: clingo.h:314
Definition: clingo.h:2351
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string(clingo_theory_atoms_t *atoms, clingo_id_t atom, char *string, size_t size)
Get the string representation of the given theory atom.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_next(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbolic_atom_iterator_t *next)
Get an iterator to the next element in the sequence of symbolic atoms.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_use_enumeration_assumption(clingo_control_t *control, bool enable)
Configure how learnt constraints are handled during enumeration.
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_cancel(clingo_solve_handle_t *handle)
Stop the running search and block until done.
Definition: clingo.h:2263
Definition: clingo.h:2313
Enable non-blocking search.
Definition: clingo.h:1114
struct clingo_propagate_init clingo_propagate_init_t
Object to initialize a user-defined propagator before each solving step.
Definition: clingo.h:1248
CLINGO_VISIBILITY_DEFAULT size_t clingo_symbol_hash(clingo_symbol_t symbol)
Calculate a hash code of a symbol.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_number(clingo_theory_atoms_t *atoms, clingo_id_t term, int *number)
Get the number of the given numeric theory term.
Select all terms.
Definition: clingo.h:938
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_literal(clingo_propagate_control_t *control, clingo_literal_t *result)
Adds a new volatile literal to the underlying solver thread.
clingo_model_type
Enumeration for the different model types.
Definition: clingo.h:925
Definition: clingo.h:2387
Definition: clingo.h:2188
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t element, size_t *size)
Get the size of the string representation of the given theory element (including the terminating 0)...
size_t end_line
the line where the location ends
Definition: clingo.h:208
char const * end_file
the file where the location ends
Definition: clingo.h:206
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string_size(clingo_symbol_t symbol, size_t *size)
Get the size of the string representation of a symbol (including the terminating 0).
CLINGO_VISIBILITY_DEFAULT bool clingo_model_thread_id(clingo_model_t *model, clingo_id_t *id)
Get the id of the solver thread that found the model.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_iterator_is_equal_to(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t a, clingo_symbolic_atom_iterator_t b, bool *equal)
Check if two iterators point to the same element (or end of the sequence).
Definition: clingo.h:2561
struct clingo_assignment clingo_assignment_t
Represents a (partial) assignment of a particular solver.
Definition: clingo.h:1308
Definition: clingo.h:2479
bool(* clingo_ground_callback_t)(clingo_location_t const *location, char const *name, clingo_symbol_t const *arguments, size_t arguments_size, void *data, clingo_symbol_callback_t symbol_callback, void *symbol_callback_data)
Callback function to implement external functions.
Definition: clingo.h:3014
global variable in tuple of aggregate element
Definition: clingo.h:166
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_string(clingo_symbol_t symbol, char const **string)
Get the string of a symbol.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_has_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, bool *has_guard)
Whether the theory atom has a guard.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_signatures(clingo_symbolic_atoms_t *atoms, clingo_signature_t *signatures, size_t size)
Get the predicate signatures occurring in a logic program.
assign an external to false
Definition: clingo.h:1628
CLINGO_VISIBILITY_DEFAULT bool clingo_parse_program(char const *program, clingo_ast_callback_t callback, void *callback_data, clingo_logger_t logger, void *logger_data, unsigned message_limit)
Parse the given program and return an abstract syntax tree for each statement via a callback...
unsigned clingo_configuration_type_bitset_t
Bitset for values of type clingo_configuration_type.
Definition: clingo.h:1772
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_project(clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size)
Add a projection directive.
Definition: clingo.h:2535
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_at(clingo_statistics_t *statistics, uint64_t key, char const *name, uint64_t *subkey)
Lookup a subkey under the given name.
CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols_size(clingo_model_t *model, clingo_show_type_bitset_t show, size_t *size)
Get the number of symbols of the selected types in the model.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_new(char const *const *arguments, size_t arguments_size, clingo_logger_t logger, void *logger_data, unsigned message_limit, clingo_control_t **control)
Create a new control object.
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_subkey_name(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, char const **name)
Get the name associated with the offset-th subkey.
int clingo_statistics_type_t
Corresponding type to clingo_statistics_type.
Definition: clingo.h:1956
bool(* clingo_propagator_undo_callback_t)(clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *)
Typedef for clingo_propagator::undo().
Definition: clingo.h:1493
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_has_subkey(clingo_configuration_t *configuration, clingo_id_t key, char const *name, bool *result)
Query whether the map has a key.
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_atom_t *atom)
Get a fresh atom to be used in aspif directives.
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 an heuristic directive.
clause is not subject to the solvers deletion policy
Definition: clingo.h:1397
Definition: clingo.h:2399
clingo_truth_value
Represents three-valued truth values.
Definition: clingo.h:192
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_number(clingo_symbol_t symbol, int *number)
Get the number of a symbol.
CLINGO_VISIBILITY_DEFAULT clingo_error_t clingo_error_code()
Get the last error code set by a clingo API call.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_size(clingo_symbolic_atoms_t *atoms, size_t *size)
Get the number of different atoms occurring in a logic program.
size_t end_column
the column where the location ends
Definition: clingo.h:210
Definition: clingo.h:2544
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_subkey_name(clingo_statistics_t *statistics, uint64_t key, size_t offset, char const **name)
Get the name associated with the offset-th subkey.
CLINGO_VISIBILITY_DEFAULT bool clingo_parse_term(char const *string, clingo_logger_t logger, void *logger_data, unsigned message_limit, clingo_symbol_t *symbol)
Parse a term in string form.
CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_number(int number, clingo_symbol_t *symbol)
Construct a symbol representing a number.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_total(clingo_assignment_t *assignment)
Check if the assignmen is total, i.e.
wrong usage of the clingo API
Definition: clingo.h:138
clingo_solve_event_type
Enumeration of solve events.
Definition: clingo.h:1121
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_truth_value(clingo_assignment_t *assignment, clingo_literal_t literal, clingo_truth_value_t *value)
Determine the truth value of a given literal.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_ground(clingo_control_t *control, clingo_part_t const *parts, size_t parts_size, clingo_ground_callback_t ground_callback, void *ground_callback_data)
Ground the selected parts of the current (non-ground) logic program.
struct clingo_theory_atoms clingo_theory_atoms_t
Container that stores theory atoms, elements, and terms (see clingo_control_theory_atoms()).
Definition: clingo.h:708
CLINGO_VISIBILITY_DEFAULT void clingo_version(int *major, int *minor, int *revision)
Obtain the clingo version.
int clingo_error_t
Corresponding type to clingo_error.
Definition: clingo.h:143
CLINGO_VISIBILITY_DEFAULT bool clingo_model_contains(clingo_model_t *model, clingo_symbol_t atom, bool *contained)
Constant time lookup to test whether an atom is in a model.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_load(clingo_control_t *control, char const *file)
Extend the logic program with a program in a file.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_literal(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_literal_t *literal)
Returns the (numeric) aspif literal corresponding to the given symbolic atom.
Definition: clingo.h:2205
CLINGO_VISIBILITY_DEFAULT clingo_id_t clingo_propagate_control_thread_id(clingo_propagate_control_t *control)
Get the id of the underlying solver thread.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_cleanup(clingo_control_t *control)
Clean up the domains of clingo&#39;s grounding component using the solving component&#39;s top level assignme...
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_name(clingo_theory_atoms_t *atoms, clingo_id_t term, char const **name)
Get the name of the given constant or function theory term.
Definition: clingo.h:2502
int clingo_truth_value_t
Corresponding type to clingo_truth_value.
Definition: clingo.h:198
Select everything.
Definition: clingo.h:940
CLINGO_VISIBILITY_DEFAULT clingo_propagator_check_mode_t clingo_propagate_init_get_check_mode(clingo_propagate_init_t *init)
Get the current check mode of the propagator.
uint64_t clingo_signature_t
Represents a predicate signature.
Definition: clingo.h:248
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_external(clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type)
Add an external statement.
Definition: clingo.h:2181
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_begin(clingo_program_builder_t *builder)
Begin building a program.
Definition: clingo.h:2258
Definition: clingo.h:2320
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_add(clingo_program_builder_t *builder, clingo_ast_statement_t const *statement)
Adds a statement to the program.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_program_builder(clingo_control_t *control, clingo_program_builder_t **builder)
Get an object to add non-ground directives to the program.
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_get(clingo_solve_handle_t *handle, clingo_solve_result_bitset_t *result)
Get the next solve result.
size_t size
number of parameters
Definition: clingo.h:2962
like clingo_clause_type_learnt but the clause is deleted after a solving step
Definition: clingo.h:1398
clingo_theory_term_type
Enumeration of theory term types.
Definition: clingo.h:696
CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_supremum(clingo_symbol_t *symbol)
Construct a symbol representing #sup.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_arguments(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_id_t const **arguments, size_t *size)
Get the arguments of the given function theory term.
CLINGO_VISIBILITY_DEFAULT char const * clingo_error_string(clingo_error_t code)
Convert error code into string.
Definition: clingo.h:2114
Definition: clingo.h:2629
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_begin(clingo_symbolic_atoms_t *atoms, clingo_signature_t const *signature, clingo_symbolic_atom_iterator_t *iterator)
Get a forward iterator to the beginning of the sequence of all symbolic atoms optionally restricted t...
CLINGO_VISIBILITY_DEFAULT bool clingo_control_solve(clingo_control_t *control, clingo_solve_mode_bitset_t mode, clingo_symbolic_literal_t const *assumptions, size_t assumptions_size, clingo_solve_event_callback_t notify, void *data, clingo_solve_handle_t **handle)
Solve the currently grounded logic program enumerating its models.
The model represents a set of cautious consequences.
Definition: clingo.h:928
char const * name
name of the program part
Definition: clingo.h:2960
The model represents a stable model.
Definition: clingo.h:926
bool(* clingo_propagator_init_callback_t)(clingo_propagate_init_t *, void *)
Typedef for clingo_propagator::init().
Definition: clingo.h:1487
clingo_external_type
Enumeration of different external statements.
Definition: clingo.h:1625
CLINGO_VISIBILITY_DEFAULT void clingo_set_error(clingo_error_t code, char const *message)
Set a custom error code and message in the active thread.
clingo_error
Enumeration of error codes.
Definition: clingo.h:135
Definition: clingo.h:2604
the entry is a (string) value
Definition: clingo.h:1951
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_resume(clingo_solve_handle_t *handle)
Discards the last model and starts the search for the next one.
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 size_t clingo_assignment_max_size(clingo_assignment_t *assignment)
The maximum size of the assignment (if all literals are assigned).
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_description(clingo_configuration_t *configuration, clingo_id_t key, char const **description)
Get the description of an entry.
CLINGO_VISIBILITY_DEFAULT uint32_t clingo_assignment_decision_level(clingo_assignment_t *assignment)
Get the current decision level.
assign an external to true
Definition: clingo.h:1627
Represents a source code location marking its beginnig and end.
Definition: clingo.h:204
clingo_statistics_type
Enumeration for entries of the statistics.
Definition: clingo.h:1949
CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost(clingo_model_t *model, int64_t *costs, size_t size)
Get the cost vector of a model.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_name(clingo_symbol_t symbol, char const **name)
Get the name of a symbol.
Definition: clingo.h:2214
a function term, e.g., f(1,2,3)
Definition: clingo.h:700
struct clingo_symbolic_atoms clingo_symbolic_atoms_t
Object to inspect symbolic atoms in a program—the relevant Herbrand base gringo uses to instantiate ...
Definition: clingo.h:533
the #sup symbol
Definition: clingo.h:311
clingo_solve_mode
Enumeration of solve modes.
Definition: clingo.h:1113
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_theory_atoms(clingo_propagate_init_t *init, clingo_theory_atoms_t **atoms)
Get an object to inspect the theory atoms.
clingo_heuristic_type
Enumeration of different heuristic modifiers.
Definition: clingo.h:1611
CLINGO_VISIBILITY_DEFAULT size_t clingo_signature_hash(clingo_signature_t signature)
Calculate a hash code of a signature.
the entry is an array
Definition: clingo.h:1952
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 void clingo_control_free(clingo_control_t *control)
Free a control object created with clingo_control_new().
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.
struct clingo_part clingo_part_t
Struct used to specify the program parts that have to be grounded.
clingo_configuration_type
Enumeration for entries of the configuration.
Definition: clingo.h:1766
Definition: clingo.h:2530
int clingo_heuristic_type_t
Corresponding type to clingo_heuristic_type.
Definition: clingo.h:1621
int clingo_theory_term_type_t
Corresponding type to clingo_theory_term_type.
Definition: clingo.h:705
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_arguments(clingo_symbol_t symbol, clingo_symbol_t const **arguments, size_t *arguments_size)
Get the arguments of a symbol.
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size)
Get the number of subkeys of a map entry.
unsigned clingo_solve_mode_bitset_t
Corresponding type to clingo_solve_mode.
Definition: clingo.h:1118
false
Definition: clingo.h:195
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string(clingo_theory_atoms_t *atoms, clingo_id_t element, char *string, size_t size)
Get the string representation of the given theory element.
Select shown atoms and terms.
Definition: clingo.h:936
CLINGO_VISIBILITY_DEFAULT bool clingo_control_register_observer(clingo_control_t *control, clingo_ground_program_observer_t const *observer, bool replace, void *data)
Register a program observer with the control object.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_symbolic_atoms(clingo_control_t *control, clingo_symbolic_atoms_t **atoms)
Get an object to inspect symbolic atoms (the relevant Herbrand base) used for grounding.
call clingo_propagator::check() on propagation fixpoints
Definition: clingo.h:1234
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_condition(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t const **condition, size_t *size)
Get the condition (array of aspif literals) of the given theory element.
CLINGO_VISIBILITY_DEFAULT bool clingo_model_context(clingo_model_t *model, clingo_solve_control_t **control)
Get the associated solve control object of a model.
The last solve call did not find a solution.
Definition: clingo.h:1071
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_model(clingo_solve_handle_t *handle, clingo_model_t **model)
Get the next model (or zero if there are no more models).
int32_t clingo_weight_t
Signed integer type for weights in sum aggregates and minimize constraints.
Definition: clingo.h:127
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size)
Get the size of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_function(char const *name, clingo_symbol_t const *arguments, size_t arguments_size, bool positive, clingo_symbol_t *symbol)
Construct a symbol representing a function or tuple.
the entry is a map
Definition: clingo.h:1953
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_control_symbolic_atoms(clingo_solve_control_t *control, clingo_symbolic_atoms_t **atoms)
Get an object to inspect the symbolic atoms.
struct clingo_propagator clingo_propagator_t
An instance of this struct has to be registered with a solver to implement a custom propagator...
unsigned clingo_solve_result_bitset_t
Corresponding type to clingo_solve_result.
Definition: clingo.h:1075
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_positive(clingo_symbol_t symbol, bool *positive)
Check if a function is positive (does not have a sign).
uint32_t clingo_id_t
Unsigned integer type used in various places.
Definition: clingo.h:125
Definition: clingo.h:2173
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string(clingo_theory_atoms_t *atoms, clingo_id_t term, char *string, size_t size)
Get the string representation of the given theory term.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_id(char const *name, bool positive, clingo_symbol_t *symbol)
Construct a symbol representing an id.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_register_propagator(clingo_control_t *control, clingo_propagator_t const *propagator, void *data, bool sequential)
Register a custom propagator with the control object.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_conflict(clingo_assignment_t *assignment)
Check if the given assignment is conflicting.
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_size(clingo_statistics_t *statistics, uint64_t key, size_t *size)
Get the size of an array entry.
Definition: clingo.h:2297
An instance of this struct has to be registered with a solver to observe ground directives as they ar...
Definition: clingo.h:2717
Definition: clingo.h:2522
clause is subject to the solvers deletion policy
Definition: clingo.h:1396
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_negative(clingo_signature_t signature)
Whether the signature is negative (is classically negated).
clingo_propagator_check_mode
Supported check modes for propagators.
Definition: clingo.h:1231
CLINGO_VISIBILITY_DEFAULT void clingo_control_interrupt(clingo_control_t *control)
Interrupt the active solve call (or the following solve call right at the beginning).
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_decision(clingo_assignment_t *assignment, uint32_t level, clingo_literal_t *literal)
Determine the decision literal given a decision level.
the entry is invalid (has neither of the types below)
Definition: clingo.h:1950
call clingo_propagator::check() on total assignment
Definition: clingo.h:1233
Definition: clingo.h:2417
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size)
Get the size of the string value of the given entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_tuple(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_id_t const **tuple, size_t *size)
Get the tuple (array of theory terms) of the given theory element.
memory could not be allocated
Definition: clingo.h:139
Definition: clingo.h:2271
clingo_symbol_t symbol
the associated symbol (must be a function)
Definition: clingo.h:324
void(* clingo_logger_t)(clingo_warning_t code, char const *message, void *data)
Callback to intercept warning messages.
Definition: clingo.h:182
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_size(clingo_theory_atoms_t *atoms, size_t *size)
Get the total number of theory atoms.
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_positive(clingo_signature_t signature)
Whether the signature is positive (is not classically negated).
CLINGO_VISIBILITY_DEFAULT int clingo_propagate_init_number_of_threads(clingo_propagate_init_t *init)
Get the number of threads used in subsequent solving.
Definition: clingo.h:2584
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t atom, size_t *size)
Get the size of the string representation of the given theory atom (including the terminating 0)...
CLINGO_VISIBILITY_DEFAULT bool clingo_add_string(char const *string, char const **result)
Internalize a string.
bool(* clingo_propagator_propagate_callback_t)(clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *)
Typedef for clingo_propagator::propagate().
Definition: clingo.h:1490
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get(clingo_configuration_t *configuration, clingo_id_t key, char *value, size_t size)
Get the string value of the given entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_has_const(clingo_control_t *control, char const *name, bool *exists)
Check if there is a constant definition for the given constant.
Select CSP assignments.
Definition: clingo.h:935
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_at(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, clingo_id_t *subkey)
Get the subkey at the given offset of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_type(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_theory_term_type_t *type)
Get the type of the given theory term.
A Literal with an associated weight.
Definition: clingo.h:1637
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_set(clingo_configuration_t *configuration, clingo_id_t key, char const *value)
Set the value of an entry.
Select false instead of true atoms (clingo_show_type_atoms) or terms (clingo_show_type_terms).
Definition: clingo.h:941
like clingo_clause_type_static but the clause is deleted after a solving step
Definition: clingo.h:1399
An instance of this struct has to be registered with a solver to implement a custom propagator...
Definition: clingo.h:1502
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_term(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t *term)
Get the theory term associated with the theory atom.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, char const **connective, clingo_id_t *term)
Get the guard consisting of a theory operator and a theory term of the given theory atom...
same file included multiple times
Definition: clingo.h:164
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_solver_literal(clingo_propagate_init_t *init, clingo_literal_t aspif_literal, clingo_literal_t *solver_literal)
Map the given program literal or condition id to its solver literal.
a numeric symbol, e.g., 1
Definition: clingo.h:308
CLINGO_VISIBILITY_DEFAULT bool clingo_control_get_const(clingo_control_t *control, char const *name, clingo_symbol_t *symbol)
Return the symbol for a constant definition of form: #const name = symbol.
CLINGO_VISIBILITY_DEFAULT char const * clingo_warning_string(clingo_warning_t code)
Convert warning code into string.
Definition: clingo.h:2166
Definition: clingo.h:2568
int clingo_model_type_t
Corresponding type to clingo_model_type.
Definition: clingo.h:931
struct clingo_solve_control clingo_solve_control_t
Object to add clauses during search.
Definition: clingo.h:919
clingo_warning
Enumeration of warning codes.
Definition: clingo.h:160
to report multiple errors; a corresponding runtime error is raised later
Definition: clingo.h:162
bool(* clingo_solve_event_callback_t)(clingo_solve_event_type_t type, void *event, void *data, bool *goon)
Callback function called during search to notify when the search is finished or a model is ready...
Definition: clingo.h:1141
unsigned clingo_show_type_bitset_t
Corresponding type to clingo_show_type.
Definition: clingo.h:944
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_has_watch(clingo_propagate_control_t *control, clingo_literal_t literal)
Check whether a literal is watched in the current solver thread.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_end(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t *iterator)
Iterator pointing to the end of the sequence of symbolic atoms.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_backend(clingo_control_t *control, clingo_backend_t **backend)
Get an object to add ground directives to the program.
The model represents a set of brave consequences.
Definition: clingo.h:927
struct clingo_program_builder clingo_program_builder_t
Object to build non-ground programs.
Definition: clingo.h:2673
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_root(clingo_configuration_t *configuration, clingo_id_t *key)
Get the root key of the configuration.
The last solve call found a solution.
Definition: clingo.h:1070
CLINGO_VISIBILITY_DEFAULT uint32_t clingo_signature_arity(clingo_signature_t signature)
Get the arity of a signature.
the entry is an array
Definition: clingo.h:1768
CLINGO_VISIBILITY_DEFAULT void clingo_propagate_control_remove_watch(clingo_propagate_control_t *control, clingo_literal_t literal)
Removes the watch (if any) for the given solver literal.
int clingo_warning_t
Corresponding type to clingo_warning.
Definition: clingo.h:170
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_external(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *external)
Check whether an atom is external.
no truth value
Definition: clingo.h:193
Definition: clingo.h:2472
set the level of an atom
Definition: clingo.h:1612
bool(* clingo_symbol_callback_t)(clingo_symbol_t const *symbols, size_t symbols_size, void *data)
Callback function to inject symbols.
Definition: clingo.h:2973
Definition: clingo.h:2280
CLINGO_VISIBILITY_DEFAULT bool clingo_control_clasp_facade(clingo_control_t *control, void **clasp)
Get low-level access to clasp.
a numeric symbol, e.g., c, (1, "a"), or f(1,"a")
Definition: clingo.h:310
clingo_clause_type
Enumeration of clause types determining the lifetime of a clause.
Definition: clingo.h:1395
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_less_than(clingo_signature_t a, clingo_signature_t b)
Check if a signature is less than another signature.
CLINGO_VISIBILITY_DEFAULT char const * clingo_error_message()
Get the last error message set if an API call fails.
struct clingo_weighted_literal clingo_weighted_literal_t
A Literal with an associated weight.
CLINGO_VISIBILITY_DEFAULT bool clingo_model_is_true(clingo_model_t *model, clingo_literal_t literal, bool *result)
Check if a program literal is true in a model.
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_at(clingo_statistics_t *statistics, uint64_t key, size_t offset, uint64_t *subkey)
Get the subkey at the given offset of an array entry.
a number term, e.g., 42
Definition: clingo.h:701
undefined atom in program
Definition: clingo.h:163
successful API calls
Definition: clingo.h:136
Definition: clingo.h:2576
CLINGO_VISIBILITY_DEFAULT char const * clingo_signature_name(clingo_signature_t signature)
Get the name of a signature.
Definition: clingo.h:2329
unsigned clingo_solve_event_type_t
Corresponding type to clingo_solve_event_type.
Definition: clingo.h:1126
CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost_size(clingo_model_t *model, size_t *size)
Get the number of cost values of a model.
errors only detectable at runtime like invalid input
Definition: clingo.h:137
the #inf symbol
Definition: clingo.h:307
struct clingo_configuration clingo_configuration_t
Handle for to the solver configuration.
Definition: clingo.h:1775
Definition: clingo.h:2593
CLINGO_VISIBILITY_DEFAULT bool clingo_control_statistics(clingo_control_t *control, clingo_statistics_t **statistics)
Get a statistics object to inspect solver statistics.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t term, size_t *size)
Get the size of the string representation of the given theory term (including the terminating 0)...
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_is_assigned(clingo_configuration_t *configuration, clingo_id_t key, bool *assigned)
Check whether a entry has a value.
size_t begin_line
the line where the location begins
Definition: clingo.h:207
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_string(char const *string, clingo_symbol_t *symbol)
Construct a symbol representing a string.
Select all atoms.
Definition: clingo.h:937
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_watch(clingo_propagate_control_t *control, clingo_literal_t literal)
Add a watch for the solver literal in the given phase.
Definition: clingo.h:2138
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_statistics_value_get(clingo_statistics_t *statistics, uint64_t key, double *value)
Get the value of the given entry.
true
Definition: clingo.h:194
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_signatures_size(clingo_symbolic_atoms_t *atoms, size_t *size)
Get the number of different predicate signatures used in the program.
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_end(clingo_program_builder_t *builder)
End building a program.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string(clingo_symbol_t symbol, char *string, size_t size)
Get the string representation of a symbol.
uint64_t clingo_symbol_t
Represents a symbol.
Definition: clingo.h:320