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 4
115 #define CLINGO_VERSION_REVISION 0
117 #define CLINGO_VERSION "5.4.0"
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 
324 
329 CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_number(int number, clingo_symbol_t *symbol);
333 CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_supremum(clingo_symbol_t *symbol);
337 CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_infimum(clingo_symbol_t *symbol);
344 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_string(char const *string, clingo_symbol_t *symbol);
355 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_id(char const *name, bool positive, clingo_symbol_t *symbol);
367 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);
368 
370 
373 
380 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_number(clingo_symbol_t symbol, int *number);
387 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_name(clingo_symbol_t symbol, char const **name);
394 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_string(clingo_symbol_t symbol, char const **string);
401 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_positive(clingo_symbol_t symbol, bool *positive);
408 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_negative(clingo_symbol_t symbol, bool *negative);
416 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_arguments(clingo_symbol_t symbol, clingo_symbol_t const **arguments, size_t *arguments_size);
421 CLINGO_VISIBILITY_DEFAULT clingo_symbol_type_t clingo_symbol_type(clingo_symbol_t symbol);
428 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string_size(clingo_symbol_t symbol, size_t *size);
438 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string(clingo_symbol_t symbol, char *string, size_t size);
439 
441 
444 
450 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_equal_to(clingo_symbol_t a, clingo_symbol_t b);
460 CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_less_than(clingo_symbol_t a, clingo_symbol_t b);
465 CLINGO_VISIBILITY_DEFAULT size_t clingo_symbol_hash(clingo_symbol_t symbol);
466 
468 
479 CLINGO_VISIBILITY_DEFAULT bool clingo_add_string(char const *string, char const **result);
493 CLINGO_VISIBILITY_DEFAULT bool clingo_parse_term(char const *string, clingo_logger_t logger, void *logger_data, unsigned message_limit, clingo_symbol_t *symbol);
494 
496 
497 // {{{1 symbolic atoms
498 
513 
519 
522 
527 typedef struct clingo_symbolic_atoms clingo_symbolic_atoms_t;
543 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_size(clingo_symbolic_atoms_t const *atoms, size_t *size);
551 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_begin(clingo_symbolic_atoms_t const *atoms, clingo_signature_t const *signature, clingo_symbolic_atom_iterator_t *iterator);
557 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_end(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t *iterator);
565 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_find(clingo_symbolic_atoms_t const *atoms, clingo_symbol_t symbol, clingo_symbolic_atom_iterator_t *iterator);
573 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_iterator_is_equal_to(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t a, clingo_symbolic_atom_iterator_t b, bool *equal);
580 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_symbol(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbol_t *symbol);
591 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_fact(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, bool *fact);
601 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_external(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, bool *external);
612 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_literal(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_literal_t *literal);
618 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_signatures_size(clingo_symbolic_atoms_t const *atoms, size_t *size);
629 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_signatures(clingo_symbolic_atoms_t const *atoms, clingo_signature_t *signatures, size_t size);
636 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_next(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbolic_atom_iterator_t *next);
645 CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_valid(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, bool *valid);
646 
655 typedef bool (*clingo_symbol_callback_t) (clingo_symbol_t const *symbols, size_t symbols_size, void *data);
657 
658 // {{{1 theory atoms
659 
681 
694 
697 
706 };
709 
711 typedef struct clingo_theory_atoms clingo_theory_atoms_t;
712 
715 
722 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_type(clingo_theory_atoms_t const *atoms, clingo_id_t term, clingo_theory_term_type_t *type);
730 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_number(clingo_theory_atoms_t const *atoms, clingo_id_t term, int *number);
738 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_name(clingo_theory_atoms_t const *atoms, clingo_id_t term, char const **name);
747 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_arguments(clingo_theory_atoms_t const *atoms, clingo_id_t term, clingo_id_t const **arguments, size_t *size);
755 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string_size(clingo_theory_atoms_t const *atoms, clingo_id_t term, size_t *size);
767 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string(clingo_theory_atoms_t const *atoms, clingo_id_t term, char *string, size_t size);
769 
772 
780 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_tuple(clingo_theory_atoms_t const *atoms, clingo_id_t element, clingo_id_t const **tuple, size_t *size);
788 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_condition(clingo_theory_atoms_t const *atoms, clingo_id_t element, clingo_literal_t const **condition, size_t *size);
800 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_condition_id(clingo_theory_atoms_t const *atoms, clingo_id_t element, clingo_literal_t *condition);
808 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string_size(clingo_theory_atoms_t const *atoms, clingo_id_t element, size_t *size);
818 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string(clingo_theory_atoms_t const *atoms, clingo_id_t element, char *string, size_t size);
820 
823 
829 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_size(clingo_theory_atoms_t const *atoms, size_t *size);
836 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_term(clingo_theory_atoms_t const *atoms, clingo_id_t atom, clingo_id_t *term);
844 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_elements(clingo_theory_atoms_t const *atoms, clingo_id_t atom, clingo_id_t const **elements, size_t *size);
851 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_has_guard(clingo_theory_atoms_t const *atoms, clingo_id_t atom, bool *has_guard);
859 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_guard(clingo_theory_atoms_t const *atoms, clingo_id_t atom, char const **connective, clingo_id_t *term);
866 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_literal(clingo_theory_atoms_t const *atoms, clingo_id_t atom, clingo_literal_t *literal);
874 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string_size(clingo_theory_atoms_t const *atoms, clingo_id_t atom, size_t *size);
884 CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string(clingo_theory_atoms_t const *atoms, clingo_id_t atom, char *string, size_t size);
886 
888 
889 // {{{1 propagator
890 
902 
908 
911 
921 typedef struct clingo_assignment clingo_assignment_t;
922 
925 
930 CLINGO_VISIBILITY_DEFAULT uint32_t clingo_assignment_decision_level(clingo_assignment_t const *assignment);
937 CLINGO_VISIBILITY_DEFAULT uint32_t clingo_assignment_root_level(clingo_assignment_t const *assignment);
942 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_conflict(clingo_assignment_t const *assignment);
948 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_literal(clingo_assignment_t const *assignment, clingo_literal_t literal);
955 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_level(clingo_assignment_t const *assignment, clingo_literal_t literal, uint32_t *level);
962 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_decision(clingo_assignment_t const *assignment, uint32_t level, clingo_literal_t *literal);
969 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_fixed(clingo_assignment_t const *assignment, clingo_literal_t literal, bool *is_fixed);
977 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_true(clingo_assignment_t const *assignment, clingo_literal_t literal, bool *is_true);
985 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_false(clingo_assignment_t const *assignment, clingo_literal_t literal, bool *is_false);
992 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_truth_value(clingo_assignment_t const *assignment, clingo_literal_t literal, clingo_truth_value_t *value);
997 CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_size(clingo_assignment_t const *assignment);
1002 CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_max_size(clingo_assignment_t const *assignment);
1007 CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_total(clingo_assignment_t const *assignment);
1008 
1010 
1016 };
1019 
1029 typedef struct clingo_propagate_init clingo_propagate_init_t;
1030 
1033 
1040 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_solver_literal(clingo_propagate_init_t const *init, clingo_literal_t aspif_literal, clingo_literal_t *solver_literal);
1046 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_watch(clingo_propagate_init_t *init, clingo_literal_t solver_literal);
1053 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_watch_to_thread(clingo_propagate_init_t *init, clingo_literal_t solver_literal, clingo_id_t thread_id);
1059 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_symbolic_atoms(clingo_propagate_init_t const *init, clingo_symbolic_atoms_t const **atoms);
1065 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_theory_atoms(clingo_propagate_init_t const *init, clingo_theory_atoms_t const **atoms);
1071 CLINGO_VISIBILITY_DEFAULT int clingo_propagate_init_number_of_threads(clingo_propagate_init_t const *init);
1077 CLINGO_VISIBILITY_DEFAULT void clingo_propagate_init_set_check_mode(clingo_propagate_init_t *init, clingo_propagator_check_mode_t mode);
1083 CLINGO_VISIBILITY_DEFAULT clingo_propagator_check_mode_t clingo_propagate_init_get_check_mode(clingo_propagate_init_t const *init);
1088 CLINGO_VISIBILITY_DEFAULT clingo_assignment_t const *clingo_propagate_init_assignment(clingo_propagate_init_t const *init);
1099 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_clause(clingo_propagate_init_t *init, clingo_literal_t const *clause, size_t size, bool *result);
1100 
1102 
1112 };
1115 
1117 typedef struct clingo_propagate_control clingo_propagate_control_t;
1118 
1121 
1128 CLINGO_VISIBILITY_DEFAULT clingo_id_t clingo_propagate_control_thread_id(clingo_propagate_control_t const *control);
1133 CLINGO_VISIBILITY_DEFAULT clingo_assignment_t const *clingo_propagate_control_assignment(clingo_propagate_control_t const *control);
1144 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_literal(clingo_propagate_control_t *control, clingo_literal_t *result);
1155 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_add_watch(clingo_propagate_control_t *control, clingo_literal_t literal);
1162 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_has_watch(clingo_propagate_control_t const *control, clingo_literal_t literal);
1169 CLINGO_VISIBILITY_DEFAULT void clingo_propagate_control_remove_watch(clingo_propagate_control_t *control, clingo_literal_t literal);
1183 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);
1194 CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_propagate(clingo_propagate_control_t *control, bool *result);
1195 
1197 
1200 
1202 typedef bool (*clingo_propagator_propagate_callback_t) (clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *);
1203 
1205 typedef bool (*clingo_propagator_undo_callback_t) (clingo_propagate_control_t const *, clingo_literal_t const *, size_t, void *);
1206 
1208 typedef bool (*clingo_propagator_check_callback_t) (clingo_propagate_control_t *, void *);
1209 
1214 typedef struct clingo_propagator {
1225  bool (*init) (clingo_propagate_init_t *init, void *data);
1265  bool (*propagate) (clingo_propagate_control_t *control, clingo_literal_t const *changes, size_t size, void *data);
1278  bool (*undo) (clingo_propagate_control_t const *control, clingo_literal_t const *changes, size_t size, void *data);
1289  bool (*check) (clingo_propagate_control_t *control, void *data);
1303  bool (*decide) (clingo_id_t thread_id, clingo_assignment_t const *assignment, clingo_literal_t fallback, void *data, clingo_literal_t *decision);
1305 
1307 
1308 // {{{1 backend
1309 
1325 
1332 
1335 
1345 };
1349 
1357 };
1361 
1364 typedef struct clingo_weighted_literal {
1365  clingo_literal_t literal;
1366  clingo_weight_t weight;
1368 
1370 typedef struct clingo_backend clingo_backend_t;
1371 
1378 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_begin(clingo_backend_t *backend);
1385 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_end(clingo_backend_t *backend);
1396 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);
1409 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);
1418 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_minimize(clingo_backend_t *backend, clingo_weight_t priority, clingo_weighted_literal_t const* literals, size_t size);
1426 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_project(clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size);
1434 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_external(clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type);
1442 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_assume(clingo_backend_t *backend, clingo_literal_t const *literals, size_t size);
1454 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);
1464 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);
1471 CLINGO_VISIBILITY_DEFAULT bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_symbol_t *symbol, clingo_atom_t *atom);
1472 
1474 
1475 // {{{1 configuration
1476 
1493 
1503 
1506 
1512 };
1515 
1517 typedef struct clingo_configuration clingo_configuration_t;
1518 
1524 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_root(clingo_configuration_t const *configuration, clingo_id_t *key);
1533 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_type(clingo_configuration_t const *configuration, clingo_id_t key, clingo_configuration_type_bitset_t *type);
1540 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_description(clingo_configuration_t const *configuration, clingo_id_t key, char const **description);
1541 
1544 
1552 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_size(clingo_configuration_t const *configuration, clingo_id_t key, size_t *size);
1562 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_at(clingo_configuration_t const *configuration, clingo_id_t key, size_t offset, clingo_id_t *subkey);
1564 
1567 
1575 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_size(clingo_configuration_t const *configuration, clingo_id_t key, size_t* size);
1585 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_has_subkey(clingo_configuration_t const *configuration, clingo_id_t key, char const *name, bool *result);
1594 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_subkey_name(clingo_configuration_t const *configuration, clingo_id_t key, size_t offset, char const **name);
1604 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_at(clingo_configuration_t const *configuration, clingo_id_t key, char const *name, clingo_id_t* subkey);
1606 
1609 
1617 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_is_assigned(clingo_configuration_t const *configuration, clingo_id_t key, bool *assigned);
1625 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get_size(clingo_configuration_t const *configuration, clingo_id_t key, size_t *size);
1635 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get(clingo_configuration_t const *configuration, clingo_id_t key, char *value, size_t size);
1643 CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_set(clingo_configuration_t *configuration, clingo_id_t key, char const *value);
1645 
1647 
1648 // {{{1 statistics
1649 
1680 
1686 
1689 
1696 };
1699 
1701 typedef struct clingo_statistic clingo_statistics_t;
1702 
1708 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_root(clingo_statistics_t const *statistics, uint64_t *key);
1715 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_type(clingo_statistics_t const *statistics, uint64_t key, clingo_statistics_type_t *type);
1716 
1719 
1727 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_size(clingo_statistics_t const *statistics, uint64_t key, size_t *size);
1736 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_at(clingo_statistics_t const *statistics, uint64_t key, size_t offset, uint64_t *subkey);
1745 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_push(clingo_statistics_t *statistics, uint64_t key, clingo_statistics_type_t type, uint64_t *subkey);
1747 
1750 
1758 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_size(clingo_statistics_t const *statistics, uint64_t key, size_t *size);
1767 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_has_subkey(clingo_statistics_t const *statistics, uint64_t key, char const *name, bool* result);
1776 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_subkey_name(clingo_statistics_t const *statistics, uint64_t key, size_t offset, char const **name);
1786 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_at(clingo_statistics_t const *statistics, uint64_t key, char const *name, uint64_t *subkey);
1796 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_add_subkey(clingo_statistics_t *statistics, uint64_t key, char const *name, clingo_statistics_type_t type, uint64_t *subkey);
1798 
1801 
1809 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_get(clingo_statistics_t const *statistics, uint64_t key, double *value);
1817 CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_set(clingo_statistics_t *statistics, uint64_t key, double value);
1819 
1821 
1822 // {{{1 model and solve control
1823 
1844 
1850 
1853 
1855 typedef struct clingo_solve_control clingo_solve_control_t;
1856 
1858 typedef struct clingo_model clingo_model_t;
1859 
1865 };
1868 
1877 };
1879 typedef unsigned clingo_show_type_bitset_t;
1880 
1883 
1889 CLINGO_VISIBILITY_DEFAULT bool clingo_model_type(clingo_model_t const *model, clingo_model_type_t *type);
1895 CLINGO_VISIBILITY_DEFAULT bool clingo_model_number(clingo_model_t const *model, uint64_t *number);
1903 CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols_size(clingo_model_t const *model, clingo_show_type_bitset_t show, size_t *size);
1919 CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols(clingo_model_t const *model, clingo_show_type_bitset_t show, clingo_symbol_t *symbols, size_t size);
1926 CLINGO_VISIBILITY_DEFAULT bool clingo_model_contains(clingo_model_t const *model, clingo_symbol_t atom, bool *contained);
1933 CLINGO_VISIBILITY_DEFAULT bool clingo_model_is_true(clingo_model_t const *model, clingo_literal_t literal, bool *result);
1939 CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost_size(clingo_model_t const *model, size_t *size);
1951 CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost(clingo_model_t const *model, int64_t *costs, size_t size);
1959 CLINGO_VISIBILITY_DEFAULT bool clingo_model_optimality_proven(clingo_model_t const *model, bool *proven);
1965 CLINGO_VISIBILITY_DEFAULT bool clingo_model_thread_id(clingo_model_t const *model, clingo_id_t *id);
1976 CLINGO_VISIBILITY_DEFAULT bool clingo_model_extend(clingo_model_t *model, clingo_symbol_t const *symbols, size_t size);
1978 
1981 
1988 CLINGO_VISIBILITY_DEFAULT bool clingo_model_context(clingo_model_t const *model, clingo_solve_control_t **control);
1994 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_control_symbolic_atoms(clingo_solve_control_t const *control, clingo_symbolic_atoms_t const **atoms);
2007 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_control_add_clause(clingo_solve_control_t *control, clingo_literal_t const *clause, size_t size);
2009 
2011 
2012 // {{{1 solve result
2013 
2014 // NOTE: documented in Control Module
2020 };
2022 
2023 // {{{1 solve handle
2024 
2045 
2054 
2057 
2062 };
2065 
2071 };
2073 typedef unsigned clingo_solve_event_type_t;
2074 
2089 typedef bool (*clingo_solve_event_callback_t) (clingo_solve_event_type_t type, void *event, void *data, bool *goon);
2090 
2094 typedef struct clingo_solve_handle clingo_solve_handle_t;
2095 
2107 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_get(clingo_solve_handle_t *handle, clingo_solve_result_bitset_t *result);
2116 CLINGO_VISIBILITY_DEFAULT void clingo_solve_handle_wait(clingo_solve_handle_t *handle, double timeout, bool *result);
2124 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_model(clingo_solve_handle_t *handle, clingo_model_t const **model);
2135 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_resume(clingo_solve_handle_t *handle);
2142 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_cancel(clingo_solve_handle_t *handle);
2151 CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_close(clingo_solve_handle_t *handle);
2152 
2154 
2155 // {{{1 ast
2156 
2174 
2185 
2188 
2189 enum clingo_ast_comparison_operator {
2190  clingo_ast_comparison_operator_greater_than = 0,
2191  clingo_ast_comparison_operator_less_than = 1,
2192  clingo_ast_comparison_operator_less_equal = 2,
2193  clingo_ast_comparison_operator_greater_equal = 3,
2194  clingo_ast_comparison_operator_not_equal = 4,
2195  clingo_ast_comparison_operator_equal = 5
2196 };
2197 typedef int clingo_ast_comparison_operator_t;
2198 
2199 enum clingo_ast_sign {
2200  clingo_ast_sign_none = 0,
2201  clingo_ast_sign_negation = 1,
2202  clingo_ast_sign_double_negation = 2
2203 };
2204 typedef int clingo_ast_sign_t;
2205 
2206 // {{{2 terms
2207 
2208 enum clingo_ast_term_type {
2209  clingo_ast_term_type_symbol = 0,
2210  clingo_ast_term_type_variable = 1,
2211  clingo_ast_term_type_unary_operation = 2,
2212  clingo_ast_term_type_binary_operation = 3,
2213  clingo_ast_term_type_interval = 4,
2214  clingo_ast_term_type_function = 5,
2215  clingo_ast_term_type_external_function = 6,
2216  clingo_ast_term_type_pool = 7
2217 };
2218 typedef int clingo_ast_term_type_t;
2219 
2224 typedef struct clingo_ast_pool clingo_ast_pool_t;
2225 typedef struct clingo_ast_term {
2226  clingo_location_t location;
2227  clingo_ast_term_type_t type;
2228  union {
2229  clingo_symbol_t symbol;
2230  char const *variable;
2231  clingo_ast_unary_operation_t const *unary_operation;
2232  clingo_ast_binary_operation_t const *binary_operation;
2233  clingo_ast_interval_t const *interval;
2234  clingo_ast_function_t const *function;
2235  clingo_ast_function_t const *external_function;
2236  clingo_ast_pool_t const *pool;
2237  };
2239 
2240 // unary operation
2241 
2242 enum clingo_ast_unary_operator {
2243  clingo_ast_unary_operator_minus = 0,
2244  clingo_ast_unary_operator_negation = 1,
2245  clingo_ast_unary_operator_absolute = 2
2246 };
2247 typedef int clingo_ast_unary_operator_t;
2248 
2250  clingo_ast_unary_operator_t unary_operator;
2251  clingo_ast_term_t argument;
2252 };
2253 
2254 // binary operation
2255 
2256 enum clingo_ast_binary_operator {
2257  clingo_ast_binary_operator_xor = 0,
2258  clingo_ast_binary_operator_or = 1,
2259  clingo_ast_binary_operator_and = 2,
2260  clingo_ast_binary_operator_plus = 3,
2261  clingo_ast_binary_operator_minus = 4,
2262  clingo_ast_binary_operator_multiplication = 5,
2263  clingo_ast_binary_operator_division = 6,
2264  clingo_ast_binary_operator_modulo = 7,
2265  clingo_ast_binary_operator_power = 8
2266 
2267 };
2268 typedef int clingo_ast_binary_operator_t;
2269 
2271  clingo_ast_binary_operator_t binary_operator;
2272  clingo_ast_term_t left;
2273  clingo_ast_term_t right;
2274 };
2275 
2276 // interval
2277 
2279  clingo_ast_term_t left;
2280  clingo_ast_term_t right;
2281 };
2282 
2283 // function
2284 
2286  char const *name;
2287  clingo_ast_term_t *arguments;
2288  size_t size;
2289 };
2290 
2291 // pool
2292 
2294  clingo_ast_term_t *arguments;
2295  size_t size;
2296 };
2297 
2298 // {{{2 csp
2299 
2301  clingo_location_t location;
2302  clingo_ast_term_t coefficient;
2303  clingo_ast_term_t const *variable;
2305 
2306 typedef struct clingo_ast_csp_sum_term {
2307  clingo_location_t location;
2308  clingo_ast_csp_product_term_t const *terms;
2309  size_t size;
2311 
2312 typedef struct clingo_ast_csp_guard {
2313  clingo_ast_comparison_operator_t comparison;
2316 
2317 typedef struct clingo_ast_csp_literal {
2319  clingo_ast_csp_guard_t const *guards;
2320  // NOTE: size must be at least one
2321  size_t size;
2323 
2324 // {{{2 ids
2325 
2326 typedef struct clingo_ast_id {
2327  clingo_location_t location;
2328  char const *id;
2329 } clingo_ast_id_t;
2330 
2331 // {{{2 literals
2332 
2333 typedef struct clingo_ast_comparison {
2334  clingo_ast_comparison_operator_t comparison;
2335  clingo_ast_term_t left;
2336  clingo_ast_term_t right;
2338 
2339 enum clingo_ast_literal_type {
2340  clingo_ast_literal_type_boolean = 0,
2341  clingo_ast_literal_type_symbolic = 1,
2342  clingo_ast_literal_type_comparison = 2,
2343  clingo_ast_literal_type_csp = 3
2344 };
2345 typedef int clingo_ast_literal_type_t;
2346 
2347 typedef struct clingo_ast_literal {
2348  clingo_location_t location;
2349  clingo_ast_sign_t sign;
2350  clingo_ast_literal_type_t type;
2351  union {
2352  bool boolean;
2353  clingo_ast_term_t const *symbol;
2354  clingo_ast_comparison_t const *comparison;
2355  clingo_ast_csp_literal_t const *csp_literal;
2356  };
2358 
2359 // {{{2 aggregates
2360 
2361 enum clingo_ast_aggregate_function {
2362  clingo_ast_aggregate_function_count = 0,
2363  clingo_ast_aggregate_function_sum = 1,
2364  clingo_ast_aggregate_function_sump = 2,
2365  clingo_ast_aggregate_function_min = 3,
2366  clingo_ast_aggregate_function_max = 4
2367 };
2368 typedef int clingo_ast_aggregate_function_t;
2369 
2371  clingo_ast_comparison_operator_t comparison;
2372  clingo_ast_term_t term;
2374 
2376  clingo_ast_literal_t literal;
2377  clingo_ast_literal_t const *condition;
2378  size_t size;
2380 
2381 // lparse-style aggregate
2382 
2383 typedef struct clingo_ast_aggregate {
2384  clingo_ast_conditional_literal_t const *elements;
2385  size_t size;
2386  clingo_ast_aggregate_guard_t const *left_guard;
2387  clingo_ast_aggregate_guard_t const *right_guard;
2389 
2390 // body aggregate
2391 
2393  clingo_ast_term_t *tuple;
2394  size_t tuple_size;
2395  clingo_ast_literal_t const *condition;
2396  size_t condition_size;
2398 
2400  clingo_ast_aggregate_function_t function;
2401  clingo_ast_body_aggregate_element_t const *elements;
2402  size_t size;
2403  clingo_ast_aggregate_guard_t const *left_guard;
2404  clingo_ast_aggregate_guard_t const *right_guard;
2406 
2407 // head aggregate
2408 
2410  clingo_ast_term_t const *tuple;
2411  size_t tuple_size;
2412  clingo_ast_conditional_literal_t conditional_literal;
2414 
2416  clingo_ast_aggregate_function_t function;
2417  clingo_ast_head_aggregate_element_t const *elements;
2418  size_t size;
2419  clingo_ast_aggregate_guard_t const *left_guard;
2420  clingo_ast_aggregate_guard_t const *right_guard;
2422 
2423 // disjunction
2424 
2425 typedef struct clingo_ast_disjunction {
2426  clingo_ast_conditional_literal_t const *elements;
2427  size_t size;
2429 
2430 // disjoint
2431 
2433  clingo_location_t location;
2434  clingo_ast_term_t const *tuple;
2435  size_t tuple_size;
2437  clingo_ast_literal_t const *condition;
2438  size_t condition_size;
2440 
2441 typedef struct clingo_ast_disjoint {
2442  clingo_ast_disjoint_element_t const *elements;
2443  size_t size;
2445 
2446 // {{{2 theory atom
2447 
2448 enum clingo_ast_theory_term_type {
2449  clingo_ast_theory_term_type_symbol = 0,
2450  clingo_ast_theory_term_type_variable = 1,
2451  clingo_ast_theory_term_type_tuple = 2,
2452  clingo_ast_theory_term_type_list = 3,
2453  clingo_ast_theory_term_type_set = 4,
2454  clingo_ast_theory_term_type_function = 5,
2455  clingo_ast_theory_term_type_unparsed_term = 6
2456 };
2457 typedef int clingo_ast_theory_term_type_t;
2458 
2459 typedef struct clingo_ast_theory_function clingo_ast_theory_function_t;
2460 typedef struct clingo_ast_theory_term_array clingo_ast_theory_term_array_t;
2461 typedef struct clingo_ast_theory_unparsed_term clingo_ast_theory_unparsed_term_t;
2462 
2463 typedef struct clingo_ast_theory_term {
2464  clingo_location_t location;
2465  clingo_ast_theory_term_type_t type;
2466  union {
2467  clingo_symbol_t symbol;
2468  char const *variable;
2469  clingo_ast_theory_term_array_t const *tuple;
2470  clingo_ast_theory_term_array_t const *list;
2471  clingo_ast_theory_term_array_t const *set;
2472  clingo_ast_theory_function_t const *function;
2473  clingo_ast_theory_unparsed_term_t const *unparsed_term;
2474  };
2476 
2478  clingo_ast_theory_term_t const *terms;
2479  size_t size;
2480 };
2481 
2483  char const *name;
2484  clingo_ast_theory_term_t const *arguments;
2485  size_t size;
2486 };
2487 
2489  char const *const *operators;
2490  size_t size;
2493 
2496  size_t size;
2497 };
2498 
2500  clingo_ast_theory_term_t const *tuple;
2501  size_t tuple_size;
2502  clingo_ast_literal_t const *condition;
2503  size_t condition_size;
2505 
2506 typedef struct clingo_ast_theory_guard {
2507  char const *operator_name;
2510 
2511 typedef struct clingo_ast_theory_atom {
2512  clingo_ast_term_t term;
2513  clingo_ast_theory_atom_element_t const *elements;
2514  size_t size;
2515  clingo_ast_theory_guard_t const *guard;
2517 
2518 // {{{2 head literals
2519 
2520 enum clingo_ast_head_literal_type {
2521  clingo_ast_head_literal_type_literal = 0,
2522  clingo_ast_head_literal_type_disjunction = 1,
2523  clingo_ast_head_literal_type_aggregate = 2,
2524  clingo_ast_head_literal_type_head_aggregate = 3,
2525  clingo_ast_head_literal_type_theory_atom = 4
2526 };
2527 typedef int clingo_ast_head_literal_type_t;
2528 
2529 typedef struct clingo_ast_head_literal {
2530  clingo_location_t location;
2531  clingo_ast_head_literal_type_t type;
2532  union {
2533  clingo_ast_literal_t const *literal;
2534  clingo_ast_disjunction_t const *disjunction;
2535  clingo_ast_aggregate_t const *aggregate;
2536  clingo_ast_head_aggregate_t const *head_aggregate;
2537  clingo_ast_theory_atom_t const *theory_atom;
2538  };
2540 
2541 // {{{2 body literals
2542 
2543 enum clingo_ast_body_literal_type {
2544  clingo_ast_body_literal_type_literal = 0,
2545  clingo_ast_body_literal_type_conditional = 1,
2546  clingo_ast_body_literal_type_aggregate = 2,
2547  clingo_ast_body_literal_type_body_aggregate = 3,
2548  clingo_ast_body_literal_type_theory_atom = 4,
2549  clingo_ast_body_literal_type_disjoint = 5
2550 };
2551 typedef int clingo_ast_body_literal_type_t;
2552 
2553 typedef struct clingo_ast_body_literal {
2554  clingo_location_t location;
2555  clingo_ast_sign_t sign;
2556  clingo_ast_body_literal_type_t type;
2557  union {
2558  clingo_ast_literal_t const *literal;
2559  // Note: conditional literals must not have signs!!!
2560  clingo_ast_conditional_literal_t const *conditional;
2561  clingo_ast_aggregate_t const *aggregate;
2562  clingo_ast_body_aggregate_t const *body_aggregate;
2563  clingo_ast_theory_atom_t const *theory_atom;
2564  clingo_ast_disjoint_t const *disjoint;
2565  };
2567 
2568 // {{{2 theory definitions
2569 
2570 enum clingo_ast_theory_operator_type {
2571  clingo_ast_theory_operator_type_unary = 0,
2572  clingo_ast_theory_operator_type_binary_left = 1,
2573  clingo_ast_theory_operator_type_binary_right = 2
2574 };
2575 typedef int clingo_ast_theory_operator_type_t;
2576 
2578  clingo_location_t location;
2579  char const *name;
2580  unsigned priority;
2581  clingo_ast_theory_operator_type_t type;
2583 
2585  clingo_location_t location;
2586  char const *name;
2587  clingo_ast_theory_operator_definition_t const *operators;
2588  size_t size;
2590 
2592  char const *term;
2593  char const *const *operators;
2594  size_t size;
2596 
2597 enum clingo_ast_theory_atom_definition_type {
2598  clingo_ast_theory_atom_definition_type_head = 0,
2599  clingo_ast_theory_atom_definition_type_body = 1,
2600  clingo_ast_theory_atom_definition_type_any = 2,
2601  clingo_ast_theory_atom_definition_type_directive = 3,
2602 };
2603 typedef int clingo_ast_theory_atom_definition_type_t;
2604 
2606  clingo_location_t location;
2607  clingo_ast_theory_atom_definition_type_t type;
2608  char const *name;
2609  unsigned arity;
2610  char const *elements;
2613 
2615  char const *name;
2617  size_t terms_size;
2619  size_t atoms_size;
2621 
2622 // {{{2 statements
2623 
2624 // rule
2625 
2626 typedef struct clingo_ast_rule {
2628  clingo_ast_body_literal_t const *body;
2629  size_t size;
2631 
2632 // definition
2633 
2634 typedef struct clingo_ast_definition {
2635  char const *name;
2636  clingo_ast_term_t value;
2637  bool is_default;
2639 
2640 // show
2641 
2643  clingo_signature_t signature;
2644  bool csp;
2646 
2647 typedef struct clingo_ast_show_term {
2648  clingo_ast_term_t term;
2649  clingo_ast_body_literal_t const *body;
2650  size_t size;
2651  bool csp;
2653 
2654 // show
2655 
2656 typedef struct clingo_ast_defined {
2657  clingo_signature_t signature;
2659 
2660 // minimize
2661 
2662 typedef struct clingo_ast_minimize {
2663  clingo_ast_term_t weight;
2664  clingo_ast_term_t priority;
2665  clingo_ast_term_t const *tuple;
2666  size_t tuple_size;
2667  clingo_ast_body_literal_t const *body;
2668  size_t body_size;
2670 
2671 // script
2672 
2673 enum clingo_ast_script_type {
2674  clingo_ast_script_type_lua = 0,
2675  clingo_ast_script_type_python = 1
2676 };
2677 typedef int clingo_ast_script_type_t;
2678 
2679 typedef struct clingo_ast_script {
2680  clingo_ast_script_type_t type;
2681  char const *code;
2683 
2684 // program
2685 
2686 typedef struct clingo_ast_program {
2687  char const *name;
2688  clingo_ast_id_t const *parameters;
2689  size_t size;
2691 
2692 // external
2693 
2694 typedef struct clingo_ast_external {
2695  clingo_ast_term_t atom;
2696  clingo_ast_body_literal_t const *body;
2697  size_t size;
2698  clingo_ast_term_t type;
2700 
2701 // edge
2702 
2703 typedef struct clingo_ast_edge {
2706  clingo_ast_body_literal_t const *body;
2707  size_t size;
2709 
2710 // heuristic
2711 
2712 typedef struct clingo_ast_heuristic {
2713  clingo_ast_term_t atom;
2714  clingo_ast_body_literal_t const *body;
2715  size_t size;
2716  clingo_ast_term_t bias;
2717  clingo_ast_term_t priority;
2718  clingo_ast_term_t modifier;
2720 
2721 // project
2722 
2723 typedef struct clingo_ast_project {
2724  clingo_ast_term_t atom;
2725  clingo_ast_body_literal_t const *body;
2726  size_t size;
2728 
2729 // statement
2730 
2731 enum clingo_ast_statement_type {
2732  clingo_ast_statement_type_rule = 0,
2733  clingo_ast_statement_type_const = 1,
2734  clingo_ast_statement_type_show_signature = 2,
2735  clingo_ast_statement_type_show_term = 3,
2736  clingo_ast_statement_type_minimize = 4,
2737  clingo_ast_statement_type_script = 5,
2738  clingo_ast_statement_type_program = 6,
2739  clingo_ast_statement_type_external = 7,
2740  clingo_ast_statement_type_edge = 8,
2741  clingo_ast_statement_type_heuristic = 9,
2742  clingo_ast_statement_type_project_atom = 10,
2743  clingo_ast_statement_type_project_atom_signature = 11,
2744  clingo_ast_statement_type_theory_definition = 12,
2745  clingo_ast_statement_type_defined = 13
2746 };
2747 typedef int clingo_ast_statement_type_t;
2748 
2749 typedef struct clingo_ast_statement {
2750  clingo_location_t location;
2751  clingo_ast_statement_type_t type;
2752  union {
2753  clingo_ast_rule_t const *rule;
2754  clingo_ast_definition_t const *definition;
2755  clingo_ast_show_signature_t const *show_signature;
2756  clingo_ast_show_term_t const *show_term;
2757  clingo_ast_minimize_t const *minimize;
2758  clingo_ast_script_t const *script;
2759  clingo_ast_program_t const *program;
2760  clingo_ast_external_t const *external;
2761  clingo_ast_edge_t const *edge;
2762  clingo_ast_heuristic_t const *heuristic;
2763  clingo_ast_project_t const *project_atom;
2764  clingo_signature_t project_signature;
2765  clingo_ast_theory_definition_t const *theory_definition;
2766  clingo_ast_defined_t const *defined;
2767  };
2769 
2770 // }}}2
2771 
2772 typedef bool (*clingo_ast_callback_t) (clingo_ast_statement_t const *, void *);
2784 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);
2785 
2787 
2788 // {{{1 program builder
2789 
2792 
2794 typedef struct clingo_program_builder clingo_program_builder_t;
2795 
2800 CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_begin(clingo_program_builder_t *builder);
2809 CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_add(clingo_program_builder_t *builder, clingo_ast_statement_t const *statement);
2814 CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_end(clingo_program_builder_t *builder);
2815 
2817 
2818 // {{{1 ground program observer
2819 
2823 
2826 
2846  bool (*init_program)(bool incremental, void *data);
2853  bool (*begin_step)(void *data);
2862  bool (*end_step)(void *data);
2863 
2873  bool (*rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_literal_t const *body, size_t body_size, void *data);
2884  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);
2892  bool (*minimize)(clingo_weight_t priority, clingo_weighted_literal_t const* literals, size_t size, void *data);
2899  bool (*project)(clingo_atom_t const *atoms, size_t size, void *data);
2908  bool (*output_atom)(clingo_symbol_t symbol, clingo_atom_t atom, void *data);
2916  bool (*output_term)(clingo_symbol_t symbol, clingo_literal_t const *condition, size_t size, void *data);
2925  bool (*output_csp)(clingo_symbol_t symbol, int value, clingo_literal_t const *condition, size_t size, void *data);
2932  bool (*external)(clingo_atom_t atom, clingo_external_type_t type, void *data);
2939  bool (*assume)(clingo_literal_t const *literals, size_t size, void *data);
2950  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);
2959  bool (*acyc_edge)(int node_u, int node_v, clingo_literal_t const *condition, size_t size, void *data);
2960 
2967  bool (*theory_term_number)(clingo_id_t term_id, int number, void *data);
2974  bool (*theory_term_string)(clingo_id_t term_id, char const *name, void *data);
2989  bool (*theory_term_compound)(clingo_id_t term_id, int name_id_or_type, clingo_id_t const *arguments, size_t size, void *data);
2999  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);
3008  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);
3019  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);
3021 
3022 // @}
3023 
3024 // {{{1 control
3025 
3039 
3044 
3047 
3065 
3068 
3080 typedef struct clingo_part {
3081  char const *name;
3082  clingo_symbol_t const *params;
3083  size_t size;
3084 } clingo_part_t;
3085 
3125 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);
3126 
3128 typedef struct clingo_control clingo_control_t;
3129 
3150 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);
3151 
3154 CLINGO_VISIBILITY_DEFAULT void clingo_control_free(clingo_control_t *control);
3155 
3158 
3166 CLINGO_VISIBILITY_DEFAULT bool clingo_control_load(clingo_control_t *control, char const *file);
3167 
3182 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);
3183 
3202 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);
3203 
3205 
3208 
3223 CLINGO_VISIBILITY_DEFAULT bool clingo_control_solve(clingo_control_t *control, clingo_solve_mode_bitset_t mode, clingo_literal_t const *assumptions, size_t assumptions_size, clingo_solve_event_callback_t notify, void *data, clingo_solve_handle_t **handle);
3235 CLINGO_VISIBILITY_DEFAULT bool clingo_control_cleanup(clingo_control_t *control);
3248 CLINGO_VISIBILITY_DEFAULT bool clingo_control_assign_external(clingo_control_t *control, clingo_literal_t literal, clingo_truth_value_t value);
3261 CLINGO_VISIBILITY_DEFAULT bool clingo_control_release_external(clingo_control_t *control, clingo_literal_t literal);
3275 CLINGO_VISIBILITY_DEFAULT bool clingo_control_register_propagator(clingo_control_t *control, clingo_propagator_t const *propagator, void *data, bool sequential);
3286 CLINGO_VISIBILITY_DEFAULT bool clingo_control_is_conflicting(clingo_control_t const *control);
3287 
3305 CLINGO_VISIBILITY_DEFAULT bool clingo_control_statistics(clingo_control_t const *control, clingo_statistics_t const **statistics);
3309 CLINGO_VISIBILITY_DEFAULT void clingo_control_interrupt(clingo_control_t *control);
3321 CLINGO_VISIBILITY_DEFAULT bool clingo_control_clasp_facade(clingo_control_t *control, void **clasp);
3322 
3324 
3327 
3335 CLINGO_VISIBILITY_DEFAULT bool clingo_control_configuration(clingo_control_t *control, clingo_configuration_t **configuration);
3351 CLINGO_VISIBILITY_DEFAULT bool clingo_control_use_enumeration_assumption(clingo_control_t *control, bool enable);
3353 
3356 
3363 CLINGO_VISIBILITY_DEFAULT bool clingo_control_get_const(clingo_control_t const *control, char const *name, clingo_symbol_t *symbol);
3373 CLINGO_VISIBILITY_DEFAULT bool clingo_control_has_const(clingo_control_t const *control, char const *name, bool *exists);
3382 CLINGO_VISIBILITY_DEFAULT bool clingo_control_symbolic_atoms(clingo_control_t const *control, clingo_symbolic_atoms_t const **atoms);
3390 CLINGO_VISIBILITY_DEFAULT bool clingo_control_theory_atoms(clingo_control_t const *control, clingo_theory_atoms_t const **atoms);
3398 CLINGO_VISIBILITY_DEFAULT bool clingo_control_register_observer(clingo_control_t *control, clingo_ground_program_observer_t const *observer, bool replace, void *data);
3400 
3403 
3412 CLINGO_VISIBILITY_DEFAULT bool clingo_control_backend(clingo_control_t *control, clingo_backend_t **backend);
3420 CLINGO_VISIBILITY_DEFAULT bool clingo_control_program_builder(clingo_control_t *control, clingo_program_builder_t **builder);
3422 
3424 
3425 // {{{1 extending clingo
3426 
3454 
3462 
3465 
3467 typedef struct clingo_options clingo_options_t;
3468 
3477 typedef bool (*clingo_main_function_t) (clingo_control_t *control, char const *const * files, size_t size, void *data);
3478 
3484 typedef bool (*clingo_default_model_printer_t) (void *data);
3485 
3494 typedef bool (*clingo_model_printer_t) (clingo_model_t const *model, clingo_default_model_printer_t printer, void *printer_data, void *data);
3495 
3497 typedef struct clingo_application {
3498  char const *(*program_name) (void *data);
3499  char const *(*version) (void *data);
3500  unsigned (*message_limit) (void *data);
3504  bool (*register_options)(clingo_options_t *options, void *data);
3505  bool (*validate_options)(void *data);
3507 
3527 CLINGO_VISIBILITY_DEFAULT bool clingo_options_add(clingo_options_t *options, char const *group, char const *option, char const *description, bool (*parse) (char const *value, void *data), void *data, bool multi, char const *argument);
3539 CLINGO_VISIBILITY_DEFAULT bool clingo_options_add_flag(clingo_options_t *options, char const *group, char const *option, char const *description, bool *target);
3540 
3548 CLINGO_VISIBILITY_DEFAULT int clingo_main(clingo_application_t *application, char const *const * arguments, size_t size, void *data);
3549 
3551 
3552 // }}}1
3553 
3554 #ifdef __cplusplus
3555 }
3556 #endif
3557 
3558 #endif
CSP variable with unbounded domain.
Definition: clingo.h:165
int clingo_external_type_t
Corresponding type to clingo_external_type.
Definition: clingo.h:1360
Definition: clingo.h:2477
configure which sign to chose for an atom
Definition: clingo.h:1340
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_type(clingo_theory_atoms_t const *atoms, clingo_id_t term, clingo_theory_term_type_t *type)
Get the type of the given theory term.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_truth_value(clingo_assignment_t const *assignment, clingo_literal_t literal, clingo_truth_value_t *value)
Determine the truth value of a given literal.
bool(* clingo_propagator_check_callback_t)(clingo_propagate_control_t *, void *)
Typedef for clingo_propagator::check().
Definition: clingo.h:1208
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:2015
the entry is a (string) value
Definition: clingo.h:1509
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...
allow an external to be assigned freely
Definition: clingo.h:1353
set the level of an atom and choose a negative sign
Definition: clingo.h:1344
CLINGO_VISIBILITY_DEFAULT clingo_assignment_t const * clingo_propagate_control_assignment(clingo_propagate_control_t const *control)
Get the assignment associated with the underlying solver.
no longer treat an atom as external
Definition: clingo.h:1356
CLINGO_VISIBILITY_DEFAULT bool clingo_control_get_const(clingo_control_t const *control, char const *name, clingo_symbol_t *symbol)
Return the symbol for a constant definition of form: #const name = symbol.
Definition: clingo.h:2347
Definition: clingo.h:2494
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_is_assigned(clingo_configuration_t const *configuration, clingo_id_t key, bool *assigned)
Check whether a entry has a value.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_equal_to(clingo_symbol_t a, clingo_symbol_t b)
Check if two symbols are equal.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_is_conflicting(clingo_control_t const *control)
Check if the solver has determined that the internal program representation is conflicting.
Yield models in calls to clingo_solve_handle_model.
Definition: clingo.h:2061
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_push(clingo_statistics_t *statistics, uint64_t key, clingo_statistics_type_t type, uint64_t *subkey)
Create the subkey at the end of an array entry.
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:1858
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_at(clingo_statistics_t const *statistics, uint64_t key, char const *name, uint64_t *subkey)
Lookup a subkey under the given name.
errors unrelated to clingo
Definition: clingo.h:140
struct clingo_statistic clingo_statistics_t
Handle for the solver statistics.
Definition: clingo.h:1701
The last solve call completely exhausted the search space.
Definition: clingo.h:2018
Issued if a model is found.
Definition: clingo.h:2068
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_size(clingo_configuration_t const *configuration, clingo_id_t key, size_t *size)
Get the size of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_model(clingo_solve_handle_t *handle, clingo_model_t const **model)
Get the next model (or zero if there are no more models).
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_size(clingo_statistics_t const *statistics, uint64_t key, size_t *size)
Get the number of subkeys of a map entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_symbol(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbol_t *symbol)
Get the symbolic representation of an atom.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_elements(clingo_theory_atoms_t const *atoms, clingo_id_t atom, clingo_id_t const **elements, size_t *size)
Get the theory elements associated with the theory atom.
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_theory_atoms(clingo_propagate_init_t const *init, clingo_theory_atoms_t const **atoms)
Get an object to inspect the theory atoms.
Definition: clingo.h:2626
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_clause(clingo_propagate_init_t *init, clingo_literal_t const *clause, size_t size, bool *result)
Add the given clause to the solver.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string_size(clingo_theory_atoms_t const *atoms, clingo_id_t term, size_t *size)
Get the size of the string representation of the given theory term (including the terminating 0)...
bool(* clingo_symbol_callback_t)(clingo_symbol_t const *symbols, size_t symbols_size, void *data)
Callback function to inject symbols.
Definition: clingo.h:655
Definition: clingo.h:2482
Definition: clingo.h:2577
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string_size(clingo_theory_atoms_t const *atoms, clingo_id_t element, size_t *size)
Get the size of the string representation of the given theory element (including the terminating 0)...
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_iterator_is_equal_to(clingo_symbolic_atoms_t const *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:2306
Definition: clingo.h:2605
a tuple term, e.g., (1,2,3)
Definition: clingo.h:700
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get(clingo_configuration_t const *configuration, clingo_id_t key, char *value, size_t size)
Get the string value of the given entry.
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:1343
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_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_VISIBILITY_DEFAULT bool clingo_control_symbolic_atoms(clingo_control_t const *control, clingo_symbolic_atoms_t const **atoms)
Get an object to inspect symbolic atoms (the relevant Herbrand base) used for grounding.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_level(clingo_assignment_t const *assignment, clingo_literal_t literal, uint32_t *level)
Determine the decision level of a given literal.
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
CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_size(clingo_assignment_t const *assignment)
The number of assigned literals in the assignment.
Issued if the search has completed.
Definition: clingo.h:2070
struct clingo_backend clingo_backend_t
Handle to the backend to add directives in aspif format.
Definition: clingo.h:1370
struct clingo_control clingo_control_t
Control object holding grounding and solving state.
Definition: clingo.h:3128
a list term, e.g., [1,2,3]
Definition: clingo.h:701
clingo_symbol_type
Enumeration of available symbol types.
Definition: clingo.h:306
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_control_symbolic_atoms(clingo_solve_control_t const *control, clingo_symbolic_atoms_t const **atoms)
Get an object to inspect the symbolic atoms.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_configuration(clingo_control_t *control, clingo_configuration_t **configuration)
Get a configuration object to change the solver configuration.
Definition: clingo.h:2656
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_add_subkey(clingo_statistics_t *statistics, uint64_t key, char const *name, clingo_statistics_type_t type, uint64_t *subkey)
Add a subkey with the given name.
The last solve call was interrupted.
Definition: clingo.h:2019
Definition: clingo.h:2415
This struct contains a set of functions to customize the clingo application.
Definition: clingo.h:3497
clingo_show_type
Enumeration of bit flags to select symbols in models.
Definition: clingo.h:1870
struct clingo_solve_handle clingo_solve_handle_t
Search handle to a solve call.
Definition: clingo.h:2094
a string symbol, e.g., "a"
Definition: clingo.h:309
a symbol term, e.g., c
Definition: clingo.h:705
int clingo_clause_type_t
Corresponding type to clingo_clause_type.
Definition: clingo.h:1114
Definition: clingo.h:2506
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.
a set term, e.g., {1,2,3}
Definition: clingo.h:702
modify the initial VSIDS score of an atom
Definition: clingo.h:1342
Definition: clingo.h:2553
the entry is a map
Definition: clingo.h:1511
clingo_logger_t logger
callback to override default logger
Definition: clingo.h:3502
Struct used to specify the program parts that have to be grounded.
Definition: clingo.h:3080
other kinds of warnings
Definition: clingo.h:167
do not call clingo_propagator::check() at all
Definition: clingo.h:1013
Definition: clingo.h:2312
bool(* init)(clingo_propagate_init_t *init, void *data)
This function is called once before each solving step.
Definition: clingo.h:1225
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_find(clingo_symbolic_atoms_t const *atoms, clingo_symbol_t symbol, clingo_symbolic_atom_iterator_t *iterator)
Find a symbolic atom given its symbolic representation.
uint64_t clingo_symbolic_atom_iterator_t
Object to iterate over symbolic atoms.
Definition: clingo.h:537
Definition: clingo.h:2399
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:3082
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.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_conflict(clingo_assignment_t const *assignment)
Check if the given assignment is conflicting.
struct clingo_propagate_control clingo_propagate_control_t
This object can be used to add clauses and propagate literals while solving.
Definition: clingo.h:1117
Definition: clingo.h:2270
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_subkey_name(clingo_configuration_t const *configuration, clingo_id_t key, size_t offset, char const **name)
Get the name associated with the offset-th subkey.
CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols_size(clingo_model_t const *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_options_add_flag(clingo_options_t *options, char const *group, char const *option, char const *description, bool *target)
Add an option that is a simple flag.
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:1341
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_external(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, bool *external)
Check whether an atom is external.
Definition: clingo.h:2333
int clingo_propagator_check_mode_t
Corresponding type to clingo_propagator_check_mode.
Definition: clingo.h:1018
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
int clingo_symbol_type_t
Corresponding type to clingo_symbol_type.
Definition: clingo.h:314
Definition: clingo.h:2463
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_has_subkey(clingo_configuration_t const *configuration, clingo_id_t key, char const *name, bool *result)
Query whether the map has a key.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_decision(clingo_assignment_t const *assignment, uint32_t level, clingo_literal_t *literal)
Determine the decision literal given a decision level.
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_root(clingo_statistics_t const *statistics, uint64_t *key)
Get the root key of the statistics.
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 uint32_t clingo_assignment_root_level(clingo_assignment_t const *assignment)
Get the current root level.
CLINGO_VISIBILITY_DEFAULT bool clingo_model_number(clingo_model_t const *model, uint64_t *number)
Get the running number of the model.
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_cancel(clingo_solve_handle_t *handle)
Stop the running search and block until done.
Definition: clingo.h:2375
Definition: clingo.h:2425
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_symbol_t *symbol, clingo_atom_t *atom)
Get a fresh atom to be used in aspif directives.
Enable non-blocking search.
Definition: clingo.h:2060
struct clingo_propagate_init clingo_propagate_init_t
Object to initialize a user-defined propagator before each solving step.
Definition: clingo.h:1029
CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_max_size(clingo_assignment_t const *assignment)
The maximum size of the assignment (if all literals are assigned).
Issued when the statistics can be updated.
Definition: clingo.h:2069
CLINGO_VISIBILITY_DEFAULT size_t clingo_symbol_hash(clingo_symbol_t symbol)
Calculate a hash code of a symbol.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_assign_external(clingo_control_t *control, clingo_literal_t literal, clingo_truth_value_t value)
Assign a truth value to an external atom.
Select all terms.
Definition: clingo.h:1874
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:1861
Definition: clingo.h:2499
Definition: clingo.h:2300
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_theory_atoms_element_tuple(clingo_theory_atoms_t const *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.
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_propagate_init_symbolic_atoms(clingo_propagate_init_t const *init, clingo_symbolic_atoms_t const **atoms)
Get an object to inspect the symbolic atoms.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_to_string(clingo_theory_atoms_t const *atoms, clingo_id_t element, char *string, size_t size)
Get the string representation of the given theory element.
Definition: clingo.h:2679
struct clingo_assignment clingo_assignment_t
Represents a (partial) assignment of a particular solver.
Definition: clingo.h:921
CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost_size(clingo_model_t const *model, size_t *size)
Get the number of cost values of a model.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_solve(clingo_control_t *control, clingo_solve_mode_bitset_t mode, clingo_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.
Definition: clingo.h:2591
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_guard(clingo_theory_atoms_t const *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...
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:3125
global variable in tuple of aggregate element
Definition: clingo.h:166
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_solver_literal(clingo_propagate_init_t const *init, clingo_literal_t aspif_literal, clingo_literal_t *solver_literal)
Map the given program literal or condition id to its solver literal.
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_element_condition(clingo_theory_atoms_t const *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.
assign an external to false
Definition: clingo.h:1355
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...
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_term(clingo_theory_atoms_t const *atoms, clingo_id_t atom, clingo_id_t *term)
Get the theory term associated with the theory atom.
unsigned clingo_configuration_type_bitset_t
Bitset for values of type clingo_configuration_type.
Definition: clingo.h:1514
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_assignment_is_true(clingo_assignment_t const *assignment, clingo_literal_t literal, bool *is_true)
Check if a literal is true.
Definition: clingo.h:2647
CLINGO_VISIBILITY_DEFAULT bool clingo_model_extend(clingo_model_t *model, clingo_symbol_t const *symbols, size_t size)
Add symbols to 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.
int clingo_statistics_type_t
Corresponding type to clingo_statistics_type.
Definition: clingo.h:1698
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_literal(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_literal_t *literal)
Returns the (numeric) aspif literal corresponding to the given symbolic atom.
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:1109
Definition: clingo.h:2511
clingo_truth_value
Represents three-valued truth values.
Definition: clingo.h:192
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_total(clingo_assignment_t const *assignment)
Check if the assignmen is total, i.e.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_number(clingo_symbol_t symbol, int *number)
Get the number of a symbol.
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_map_at(clingo_configuration_t const *configuration, clingo_id_t key, char const *name, clingo_id_t *subkey)
Lookup a subkey under the given name.
CLINGO_VISIBILITY_DEFAULT clingo_error_t clingo_error_code()
Get the last error code set by a clingo API call.
size_t end_column
the column where the location ends
Definition: clingo.h:210
Definition: clingo.h:2662
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_signatures_size(clingo_symbolic_atoms_t const *atoms, size_t *size)
Get the number of different predicate signatures used in the program.
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_symbolic_atoms_signatures(clingo_symbolic_atoms_t const *atoms, clingo_signature_t *signatures, size_t size)
Get the predicate signatures occurring in a logic program.
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_has_watch(clingo_propagate_control_t const *control, clingo_literal_t literal)
Check whether a literal is watched in the current solver thread.
wrong usage of the clingo API
Definition: clingo.h:138
struct clingo_application clingo_application_t
This struct contains a set of functions to customize the clingo application.
clingo_solve_event_type
Enumeration of solve events.
Definition: clingo.h:2067
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:711
CLINGO_VISIBILITY_DEFAULT void clingo_version(int *major, int *minor, int *revision)
Obtain the clingo version.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_theory_atoms(clingo_control_t const *control, clingo_theory_atoms_t const **atoms)
Get an object to inspect theory atoms that occur in the grounding.
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_root(clingo_configuration_t const *configuration, clingo_id_t *key)
Get the root key of the configuration.
int clingo_error_t
Corresponding type to clingo_error.
Definition: clingo.h:143
CLINGO_VISIBILITY_DEFAULT bool clingo_control_load(clingo_control_t *control, char const *file)
Extend the logic program with a program in a file.
Definition: clingo.h:2317
CLINGO_VISIBILITY_DEFAULT clingo_id_t clingo_propagate_control_thread_id(clingo_propagate_control_t const *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_assignment_has_literal(clingo_assignment_t const *assignment, clingo_literal_t literal)
Check if the given literal is part of a (partial) assignment.
Definition: clingo.h:2614
int clingo_truth_value_t
Corresponding type to clingo_truth_value.
Definition: clingo.h:198
Select everything.
Definition: clingo.h:1875
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:2293
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_begin(clingo_program_builder_t *builder)
Begin building a program.
Definition: clingo.h:2370
Definition: clingo.h:2432
CLINGO_VISIBILITY_DEFAULT bool clingo_model_contains(clingo_model_t const *model, clingo_symbol_t atom, bool *contained)
Constant time lookup to test whether an atom is in a model.
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:3083
like clingo_clause_type_learnt but the clause is deleted after a solving step
Definition: clingo.h:1110
clingo_theory_term_type
Enumeration of theory term types.
Definition: clingo.h:699
CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_supremum(clingo_symbol_t *symbol)
Construct a symbol representing #sup.
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_watch_to_thread(clingo_propagate_init_t *init, clingo_literal_t solver_literal, clingo_id_t thread_id)
Add a watch for the solver literal in the given phase to the given solver thread. ...
CLINGO_VISIBILITY_DEFAULT bool clingo_model_context(clingo_model_t const *model, clingo_solve_control_t **control)
Get the associated solve control object of a model.
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_is_valid(clingo_symbolic_atoms_t const *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 char const * clingo_error_string(clingo_error_t code)
Convert error code into string.
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_has_subkey(clingo_statistics_t const *statistics, uint64_t key, char const *name, bool *result)
Test if the given map contains a specific subkey.
Definition: clingo.h:2225
Definition: clingo.h:2749
clingo_model_printer_t printer
callback to override default model printing
Definition: clingo.h:3503
clingo_main_function_t main
callback to override clingo&#39;s main function
Definition: clingo.h:3501
The model represents a set of cautious consequences.
Definition: clingo.h:1864
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_end(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t *iterator)
Iterator pointing to the end of the sequence of symbolic atoms.
char const * name
name of the program part
Definition: clingo.h:3081
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_begin(clingo_symbolic_atoms_t const *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...
The model represents a stable model.
Definition: clingo.h:1862
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_map_subkey_name(clingo_statistics_t const *statistics, uint64_t key, size_t offset, char const **name)
Get the name associated with the offset-th subkey.
bool(* clingo_propagator_init_callback_t)(clingo_propagate_init_t *, void *)
Typedef for clingo_propagator::init().
Definition: clingo.h:1199
clingo_external_type
Enumeration of different external statements.
Definition: clingo.h:1352
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_VISIBILITY_DEFAULT bool clingo_configuration_map_size(clingo_configuration_t const *configuration, clingo_id_t key, size_t *size)
Get the number of subkeys of a map entry.
clingo_error
Enumeration of error codes.
Definition: clingo.h:135
Definition: clingo.h:2723
the entry is a (double) value
Definition: clingo.h:1693
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.
assign an external to true
Definition: clingo.h:1354
Represents a source code location marking its beginnig and end.
Definition: clingo.h:204
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_has_guard(clingo_theory_atoms_t const *atoms, clingo_id_t atom, bool *has_guard)
Whether the theory atom has a guard.
clingo_statistics_type
Enumeration for entries of the statistics.
Definition: clingo.h:1691
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_next(clingo_symbolic_atoms_t const *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_symbol_name(clingo_symbol_t symbol, char const **name)
Get the name of a symbol.
Definition: clingo.h:2326
a function term, e.g., f(1,2,3)
Definition: clingo.h:703
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:527
the #sup symbol
Definition: clingo.h:311
clingo_solve_mode
Enumeration of solve modes.
Definition: clingo.h:2059
clingo_heuristic_type
Enumeration of different heuristic modifiers.
Definition: clingo.h:1338
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:1694
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_control_statistics(clingo_control_t const *control, clingo_statistics_t const **statistics)
Get a statistics object to inspect solver statistics.
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_VISIBILITY_DEFAULT int clingo_main(clingo_application_t *application, char const *const *arguments, size_t size, void *data)
Run clingo with a customized main function (similar to python and lua embedding). ...
clingo_configuration_type
Enumeration for entries of the configuration.
Definition: clingo.h:1508
CLINGO_VISIBILITY_DEFAULT bool clingo_model_thread_id(clingo_model_t const *model, clingo_id_t *id)
Get the id of the solver thread that found the model.
Definition: clingo.h:2642
int clingo_heuristic_type_t
Corresponding type to clingo_heuristic_type.
Definition: clingo.h:1348
int clingo_theory_term_type_t
Corresponding type to clingo_theory_term_type.
Definition: clingo.h:708
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.
unsigned clingo_solve_mode_bitset_t
Corresponding type to clingo_solve_mode.
Definition: clingo.h:2064
bool(* clingo_default_model_printer_t)(void *data)
Callback to print a model in default format.
Definition: clingo.h:3484
false
Definition: clingo.h:195
Select shown atoms and terms.
Definition: clingo.h:1872
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.
call clingo_propagator::check() on propagation fixpoints
Definition: clingo.h:1015
struct clingo_options clingo_options_t
Object to add command-line options.
Definition: clingo.h:3467
The last solve call did not find a solution.
Definition: clingo.h:2017
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_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:1695
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:2021
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string_size(clingo_theory_atoms_t const *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_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:2285
bool(* clingo_main_function_t)(clingo_control_t *control, char const *const *files, size_t size, void *data)
Callback to customize clingo main function.
Definition: clingo.h:3477
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_configuration_description(clingo_configuration_t const *configuration, clingo_id_t key, char const **description)
Get the description of an entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_model_optimality_proven(clingo_model_t const *model, bool *proven)
Whether the optimality of a model has been proven.
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_false(clingo_assignment_t const *assignment, clingo_literal_t literal, bool *is_false)
Check if a literal has a fixed truth value.
Definition: clingo.h:2409
An instance of this struct has to be registered with a solver to observe ground directives as they ar...
Definition: clingo.h:2838
Definition: clingo.h:2634
clause is subject to the solvers deletion policy
Definition: clingo.h:1108
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:1012
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_symbolic_atoms_is_fact(clingo_symbolic_atoms_t const *atoms, clingo_symbolic_atom_iterator_t iterator, bool *fact)
Check whether an atom is a fact.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_to_string(clingo_theory_atoms_t const *atoms, clingo_id_t term, char *string, size_t size)
Get the string representation of the given theory term.
the entry is invalid (has neither of the types below)
Definition: clingo.h:1692
CLINGO_VISIBILITY_DEFAULT bool clingo_control_has_const(clingo_control_t const *control, char const *name, bool *exists)
Check if there is a constant definition for the given constant.
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_set(clingo_statistics_t *statistics, uint64_t key, double value)
Set the value of the given entry.
call clingo_propagator::check() on total assignment
Definition: clingo.h:1014
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_array_at(clingo_configuration_t const *configuration, clingo_id_t key, size_t offset, clingo_id_t *subkey)
Get the subkey at the given offset of an array entry.
Definition: clingo.h:2529
memory could not be allocated
Definition: clingo.h:139
Definition: clingo.h:2383
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_options_add(clingo_options_t *options, char const *group, char const *option, char const *description, bool(*parse)(char const *value, void *data), void *data, bool multi, char const *argument)
Add an option that is processed with a custom parser.
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_positive(clingo_signature_t signature)
Whether the signature is positive (is not classically negated).
Definition: clingo.h:2703
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:1202
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_name(clingo_theory_atoms_t const *atoms, clingo_id_t term, char const **name)
Get the name of the given constant or function theory term.
CLINGO_VISIBILITY_DEFAULT clingo_assignment_t const * clingo_propagate_init_assignment(clingo_propagate_init_t const *init)
Get the top level assignment solver.
CLINGO_VISIBILITY_DEFAULT bool clingo_model_cost(clingo_model_t const *model, int64_t *costs, size_t size)
Get the cost vector of a model.
Select CSP assignments.
Definition: clingo.h:1871
A Literal with an associated weight.
Definition: clingo.h:1364
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_at(clingo_statistics_t const *statistics, uint64_t key, size_t offset, uint64_t *subkey)
Get the subkey at the given offset of an array entry.
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:1876
like clingo_clause_type_static but the clause is deleted after a solving step
Definition: clingo.h:1111
CLINGO_VISIBILITY_DEFAULT clingo_propagator_check_mode_t clingo_propagate_init_get_check_mode(clingo_propagate_init_t const *init)
Get the current check mode of the propagator.
An instance of this struct has to be registered with a solver to implement a custom propagator...
Definition: clingo.h:1214
same file included multiple times
Definition: clingo.h:164
a numeric symbol, e.g., 1
Definition: clingo.h:308
CLINGO_VISIBILITY_DEFAULT char const * clingo_warning_string(clingo_warning_t code)
Convert warning code into string.
Definition: clingo.h:2278
Definition: clingo.h:2686
int clingo_model_type_t
Corresponding type to clingo_model_type.
Definition: clingo.h:1867
struct clingo_solve_control clingo_solve_control_t
Object to add clauses during search.
Definition: clingo.h:1855
CLINGO_VISIBILITY_DEFAULT bool clingo_model_symbols(clingo_model_t const *model, clingo_show_type_bitset_t show, clingo_symbol_t *symbols, size_t size)
Get the symbols of the selected types in the model.
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
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_element_condition_id(clingo_theory_atoms_t const *atoms, clingo_id_t element, clingo_literal_t *condition)
Get the id of the condition of the given theory element.
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:2089
unsigned clingo_show_type_bitset_t
Corresponding type to clingo_show_type.
Definition: clingo.h:1879
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:1863
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_end(clingo_backend_t *backend)
Finalize the backend after using it.
struct clingo_program_builder clingo_program_builder_t
Object to build non-ground programs.
Definition: clingo.h:2794
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_to_string(clingo_theory_atoms_t const *atoms, clingo_id_t atom, char *string, size_t size)
Get the string representation of the given theory atom.
The last solve call found a solution.
Definition: clingo.h:2016
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:1510
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_model_is_true(clingo_model_t const *model, clingo_literal_t literal, bool *result)
Check if a program literal is true in a model.
no truth value
Definition: clingo.h:193
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_fixed(clingo_assignment_t const *assignment, clingo_literal_t literal, bool *is_fixed)
Check if a literal has a fixed truth value.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_arguments(clingo_theory_atoms_t const *atoms, clingo_id_t term, clingo_id_t const **arguments, size_t *size)
Get the arguments of the given function theory term.
bool(* clingo_propagator_undo_callback_t)(clingo_propagate_control_t const *, clingo_literal_t const *, size_t, void *)
Typedef for clingo_propagator::undo().
Definition: clingo.h:1205
Definition: clingo.h:2584
set the level of an atom
Definition: clingo.h:1339
Definition: clingo.h:2392
CLINGO_VISIBILITY_DEFAULT bool clingo_control_clasp_facade(clingo_control_t *control, void **clasp)
Get low-level access to clasp.
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_get(clingo_statistics_t const *statistics, uint64_t key, double *value)
Get the value of the given entry.
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:1107
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.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_size(clingo_theory_atoms_t const *atoms, size_t *size)
Get the total number of theory atoms.
struct clingo_weighted_literal clingo_weighted_literal_t
A Literal with an associated weight.
a number term, e.g., 42
Definition: clingo.h:704
CLINGO_VISIBILITY_DEFAULT bool clingo_symbolic_atoms_size(clingo_symbolic_atoms_t const *atoms, size_t *size)
Get the number of different atoms occurring in a logic program.
undefined atom in program
Definition: clingo.h:163
CLINGO_VISIBILITY_DEFAULT int clingo_propagate_init_number_of_threads(clingo_propagate_init_t const *init)
Get the number of threads used in subsequent solving.
successful API calls
Definition: clingo.h:136
Definition: clingo.h:2694
CLINGO_VISIBILITY_DEFAULT char const * clingo_signature_name(clingo_signature_t signature)
Get the name of a signature.
Definition: clingo.h:2441
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_array_size(clingo_statistics_t const *statistics, uint64_t key, size_t *size)
Get the size of an array entry.
CLINGO_VISIBILITY_DEFAULT bool clingo_control_release_external(clingo_control_t *control, clingo_literal_t literal)
Release an external atom.
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_atom_literal(clingo_theory_atoms_t const *atoms, clingo_id_t atom, clingo_literal_t *literal)
Get the aspif literal associated with the given theory atom.
unsigned clingo_solve_event_type_t
Corresponding type to clingo_solve_event_type.
Definition: clingo.h:2073
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_term_number(clingo_theory_atoms_t const *atoms, clingo_id_t term, int *number)
Get the number of the given numeric theory term.
CLINGO_VISIBILITY_DEFAULT uint32_t clingo_assignment_decision_level(clingo_assignment_t const *assignment)
Get the current decision level.
errors only detectable at runtime like invalid input
Definition: clingo.h:137
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_value_get_size(clingo_configuration_t const *configuration, clingo_id_t key, size_t *size)
Get the size of the string value of the given entry.
the #inf symbol
Definition: clingo.h:307
struct clingo_configuration clingo_configuration_t
Handle for to the solver configuration.
Definition: clingo.h:1517
Definition: clingo.h:2712
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:1873
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:2249
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.
bool(* clingo_model_printer_t)(clingo_model_t const *model, clingo_default_model_printer_t printer, void *printer_data, void *data)
Callback to customize model printing.
Definition: clingo.h:3494
true
Definition: clingo.h:194
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
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_begin(clingo_backend_t *backend)
Prepare the backend for usage.