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 // {{{ GPL License
2 
3 // This file is part of gringo---a grounder for logic programs.
4 // Copyright Roland Kaminski
5 
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 // }}}
20 
25 
40 
41 #ifndef CLINGO_H
42 #define CLINGO_H
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #include <stddef.h>
49 #include <stdint.h>
50 #include <stdbool.h>
51 
52 // {{{1 basic types and error/warning handling
53 
65 
70 
73 
75 #define CLINGO_VERSION_MAJOR 5
76 #define CLINGO_VERSION_MINOR 0
78 #define CLINGO_VERSION_REVISION 0
80 #define CLINGO_VERSION #CLINGO_VERSION_MAJOR "." #CLINGO_VERSION_MINOR "." #CLINGO_VERSION_REVISION
82 
84 typedef int32_t clingo_literal_t;
86 typedef uint32_t clingo_atom_t;
88 typedef uint32_t clingo_id_t;
90 typedef int32_t clingo_weight_t;
91 
104 };
106 typedef int clingo_error_t;
108 char const *clingo_error_string(clingo_error_t code);
112 clingo_error_t clingo_error_code();
116 char const *clingo_error_message();
120 void clingo_set_error(clingo_error_t code, char const *message);
121 
131 };
133 typedef int clingo_warning_t;
135 char const *clingo_warning_string(clingo_warning_t code);
145 typedef void clingo_logger_t(clingo_warning_t code, char const *message, void *data);
146 
152 void clingo_version(int *major, int *minor, int *revision);
153 
159 };
162 
167 typedef struct clingo_location {
168  char const *begin_file;
169  char const *end_file;
170  size_t begin_line;
171  size_t end_line;
172  size_t begin_column;
173  size_t end_column;
175 
177 
178 // {{{1 signature and symbols
179 
196 
203 
206 
211 typedef uint64_t clingo_signature_t;
212 
215 
224 bool clingo_signature_create(char const *name, uint32_t arity, bool positive, clingo_signature_t *signature);
229 char const *clingo_signature_name(clingo_signature_t signature);
234 uint32_t clingo_signature_arity(clingo_signature_t signature);
239 bool clingo_signature_is_positive(clingo_signature_t signature);
244 bool clingo_signature_is_negative(clingo_signature_t signature);
250 bool clingo_signature_is_equal_to(clingo_signature_t a, clingo_signature_t b);
259 bool clingo_signature_is_less_than(clingo_signature_t a, clingo_signature_t b);
264 size_t clingo_signature_hash(clingo_signature_t signature);
265 
267 
275 };
278 
283 typedef uint64_t clingo_symbol_t;
284 
286 typedef struct clingo_symbolic_literal {
287  clingo_symbol_t symbol;
288  bool positive;
290 
293 
298 void clingo_symbol_create_number(int number, clingo_symbol_t *symbol);
302 void clingo_symbol_create_supremum(clingo_symbol_t *symbol);
306 void clingo_symbol_create_infimum(clingo_symbol_t *symbol);
313 bool clingo_symbol_create_string(char const *string, clingo_symbol_t *symbol);
324 bool clingo_symbol_create_id(char const *name, bool positive, clingo_symbol_t *symbol);
336 bool clingo_symbol_create_function(char const *name, clingo_symbol_t const *arguments, size_t arguments_size, bool positive, clingo_symbol_t *symbol);
337 
339 
342 
349 bool clingo_symbol_number(clingo_symbol_t symbol, int *number);
356 bool clingo_symbol_name(clingo_symbol_t symbol, char const **name);
363 bool clingo_symbol_string(clingo_symbol_t symbol, char const **string);
370 bool clingo_symbol_is_positive(clingo_symbol_t symbol, bool *positive);
377 bool clingo_symbol_is_negative(clingo_symbol_t symbol, bool *negative);
385 bool clingo_symbol_arguments(clingo_symbol_t symbol, clingo_symbol_t const **arguments, size_t *arguments_size);
390 clingo_symbol_type_t clingo_symbol_type(clingo_symbol_t symbol);
397 bool clingo_symbol_to_string_size(clingo_symbol_t symbol, size_t *size);
407 bool clingo_symbol_to_string(clingo_symbol_t symbol, char *string, size_t size);
408 
410 
413 
419 bool clingo_symbol_is_equal_to(clingo_symbol_t a, clingo_symbol_t b);
429 bool clingo_symbol_is_less_than(clingo_symbol_t a, clingo_symbol_t b);
434 size_t clingo_symbol_hash(clingo_symbol_t symbol);
435 
437 
448 bool clingo_add_string(char const *string, char const **result);
462 bool clingo_parse_term(char const *string, clingo_logger_t *logger, void *logger_data, unsigned message_limit, clingo_symbol_t *symbol);
463 
465 
466 // {{{1 model and solve control
467 
488 
494 
497 
499 typedef struct clingo_solve_control clingo_solve_control_t;
500 
502 typedef struct clingo_model clingo_model_t;
503 
509 };
512 
522 };
524 typedef unsigned clingo_show_type_bitset_t;
525 
528 
534 bool clingo_model_type(clingo_model_t *model, clingo_model_type_t *type);
540 bool clingo_model_number(clingo_model_t *model, uint64_t *number);
548 bool clingo_model_symbols_size(clingo_model_t *model, clingo_show_type_bitset_t show, size_t *size);
564 bool clingo_model_symbols(clingo_model_t *model, clingo_show_type_bitset_t show, clingo_symbol_t *symbols, size_t size);
571 bool clingo_model_contains(clingo_model_t *model, clingo_symbol_t atom, bool *contained);
577 bool clingo_model_cost_size(clingo_model_t *model, size_t *size);
589 bool clingo_model_cost(clingo_model_t *model, int64_t *costs, size_t size);
597 bool clingo_model_optimality_proven(clingo_model_t *model, bool *proven);
599 
602 
615 bool clingo_solve_control_thread_id(clingo_solve_control_t *control, clingo_id_t *id);
628 bool clingo_solve_control_add_clause(clingo_solve_control_t *control, clingo_symbolic_literal_t const *clause, size_t size);
630 
632 
633 // {{{1 solve result
634 
635 // NOTE: documented in Control Module
641 };
643 
644 
645 // {{{1 solve iter
646 
659 
668 
671 
675 typedef struct clingo_solve_iteratively clingo_solve_iteratively_t;
691 bool clingo_solve_iteratively_get(clingo_solve_iteratively_t *handle, clingo_solve_result_bitset_t *result);
701 
703 
704 // {{{1 solve async
705 
726 
736 
739 
743 typedef struct clingo_solve_async clingo_solve_async_t;
753 bool clingo_solve_async_get(clingo_solve_async_t *handle, clingo_solve_result_bitset_t *result);
765 bool clingo_solve_async_wait(clingo_solve_async_t *handle, double timeout, bool *result);
775 
777 
778 // {{{1 symbolic atoms
779 
794 
800 
803 
808 typedef struct clingo_symbolic_atoms clingo_symbolic_atoms_t;
824 bool clingo_symbolic_atoms_size(clingo_symbolic_atoms_t *atoms, size_t *size);
832 bool clingo_symbolic_atoms_begin(clingo_symbolic_atoms_t *atoms, clingo_signature_t const *signature, clingo_symbolic_atom_iterator_t *iterator);
838 bool clingo_symbolic_atoms_end(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t *iterator);
846 bool clingo_symbolic_atoms_find(clingo_symbolic_atoms_t *atoms, clingo_symbol_t symbol, clingo_symbolic_atom_iterator_t *iterator);
854 bool clingo_symbolic_atoms_iterator_is_equal_to(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t a, clingo_symbolic_atom_iterator_t b, bool *equal);
861 bool clingo_symbolic_atoms_symbol(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbol_t *symbol);
872 bool clingo_symbolic_atoms_is_fact(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *fact);
882 bool clingo_symbolic_atoms_is_external(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *external);
893 bool clingo_symbolic_atoms_literal(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_literal_t *literal);
910 bool clingo_symbolic_atoms_signatures(clingo_symbolic_atoms_t *atoms, clingo_signature_t *signatures, size_t size);
917 bool clingo_symbolic_atoms_next(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbolic_atom_iterator_t *next);
926 bool clingo_symbolic_atoms_is_valid(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *valid);
927 
929 
930 // {{{1 theory atoms
931 
953 
966 
969 
978 };
981 
983 typedef struct clingo_theory_atoms clingo_theory_atoms_t;
984 
987 
994 bool clingo_theory_atoms_term_type(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_theory_term_type_t *type);
1002 bool clingo_theory_atoms_term_number(clingo_theory_atoms_t *atoms, clingo_id_t term, int *number);
1010 bool clingo_theory_atoms_term_name(clingo_theory_atoms_t *atoms, clingo_id_t term, char const **name);
1019 bool clingo_theory_atoms_term_arguments(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_id_t const **arguments, size_t *size);
1027 bool clingo_theory_atoms_term_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t term, size_t *size);
1039 bool clingo_theory_atoms_term_to_string(clingo_theory_atoms_t *atoms, clingo_id_t term, char *string, size_t size);
1041 
1044 
1052 bool clingo_theory_atoms_element_tuple(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_id_t const **tuple, size_t *size);
1060 bool clingo_theory_atoms_element_condition(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t const **condition, size_t *size);
1072 bool clingo_theory_atoms_element_condition_id(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t *condition);
1080 bool clingo_theory_atoms_element_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t element, size_t *size);
1090 bool clingo_theory_atoms_element_to_string(clingo_theory_atoms_t *atoms, clingo_id_t element, char *string, size_t size);
1092 
1095 
1101 bool clingo_theory_atoms_size(clingo_theory_atoms_t *atoms, size_t *size);
1108 bool clingo_theory_atoms_atom_term(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t *term);
1116 bool clingo_theory_atoms_atom_elements(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t const **elements, size_t *size);
1123 bool clingo_theory_atoms_atom_has_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, bool *has_guard);
1131 bool clingo_theory_atoms_atom_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, char const **connective, clingo_id_t *term);
1138 bool clingo_theory_atoms_atom_literal(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_literal_t *literal);
1146 bool clingo_theory_atoms_atom_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t atom, size_t *size);
1156 bool clingo_theory_atoms_atom_to_string(clingo_theory_atoms_t *atoms, clingo_id_t atom, char *string, size_t size);
1158 
1160 
1161 // {{{1 propagator
1162 
1174 
1180 
1183 
1193 typedef struct clingo_propagate_init clingo_propagate_init_t;
1194 
1197 
1204 bool clingo_propagate_init_solver_literal(clingo_propagate_init_t *init, clingo_literal_t aspif_literal, clingo_literal_t *solver_literal);
1210 bool clingo_propagate_init_add_watch(clingo_propagate_init_t *init, clingo_literal_t solver_literal);
1229 
1231 
1241 typedef struct clingo_assignment clingo_assignment_t;
1242 
1245 
1261 bool clingo_assignment_has_literal(clingo_assignment_t *assignment, clingo_literal_t literal);
1268 bool clingo_assignment_level(clingo_assignment_t *assignment, clingo_literal_t literal, uint32_t *level);
1275 bool clingo_assignment_decision(clingo_assignment_t *assignment, uint32_t level, clingo_literal_t *literal);
1282 bool clingo_assignment_is_fixed(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_fixed);
1290 bool clingo_assignment_is_true(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_true);
1298 bool clingo_assignment_is_false(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_false);
1305 bool clingo_assignment_truth_value(clingo_assignment_t *assignment, clingo_literal_t literal, clingo_truth_value_t *value);
1306 
1308 
1318 };
1321 
1323 typedef struct clingo_propagate_control clingo_propagate_control_t;
1324 
1327 
1353 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);
1365 
1367 
1370 
1372 typedef bool (*clingo_propagator_propagate_callback_t) (clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *);
1373 
1375 typedef bool (*clingo_propagator_undo_callback_t) (clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *);
1376 
1378 typedef bool (*clingo_propagator_check_callback_t) (clingo_propagate_control_t *, void *);
1379 
1384 typedef struct clingo_propagator {
1395  bool (*init) (clingo_propagate_init_t *control, void *data);
1435  bool (*propagate) (clingo_propagate_control_t *control, clingo_literal_t const *changes, size_t size, void *data);
1447  bool (*undo) (clingo_propagate_control_t *control, clingo_literal_t const *changes, size_t size, void *data);
1455  bool (*check) (clingo_propagate_control_t *control, void *data);
1457 
1459 
1460 // {{{1 backend
1461 
1477 
1484 
1487 
1496 };
1499 
1506 };
1509 
1511 typedef struct clingo_weighted_literal {
1512  clingo_literal_t literal;
1513  clingo_weight_t weight;
1515 
1517 typedef struct clingo_backend clingo_backend_t;
1518 
1529 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);
1542 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);
1551 bool clingo_backend_minimize(clingo_backend_t *backend, clingo_weight_t priority, clingo_weighted_literal_t const* literals, size_t size);
1559 bool clingo_backend_project(clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size);
1567 bool clingo_backend_external(clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type);
1575 bool clingo_backend_assume(clingo_backend_t *backend, clingo_literal_t const *literals, size_t size);
1587 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);
1597 bool clingo_backend_acyc_edge(clingo_backend_t *backend, int node_u, int node_v, clingo_literal_t const *condition, size_t size);
1603 bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_atom_t *atom);
1604 
1606 
1607 // {{{1 configuration
1608 
1625 
1635 
1638 
1644 };
1647 
1649 typedef struct clingo_configuration clingo_configuration_t;
1650 
1656 bool clingo_configuration_root(clingo_configuration_t *configuration, clingo_id_t *key);
1665 bool clingo_configuration_type(clingo_configuration_t *configuration, clingo_id_t key, clingo_configuration_type_bitset_t *type);
1672 bool clingo_configuration_description(clingo_configuration_t *configuration, clingo_id_t key, char const **description);
1673 
1676 
1684 bool clingo_configuration_array_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size);
1694 bool clingo_configuration_array_at(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, clingo_id_t *subkey);
1696 
1699 
1707 bool clingo_configuration_map_size(clingo_configuration_t *configuration, clingo_id_t key, size_t* size);
1716 bool clingo_configuration_map_subkey_name(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, char const **name);
1726 bool clingo_configuration_map_at(clingo_configuration_t *configuration, clingo_id_t key, char const *name, clingo_id_t* subkey);
1728 
1731 
1739 bool clingo_configuration_value_is_assigned(clingo_configuration_t *configuration, clingo_id_t key, bool *assigned);
1747 bool clingo_configuration_value_get_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size);
1757 bool clingo_configuration_value_get(clingo_configuration_t *configuration, clingo_id_t key, char *value, size_t size);
1765 bool clingo_configuration_value_set(clingo_configuration_t *configuration, clingo_id_t key, char const *value);
1767 
1769 
1770 // {{{1 statistics
1771 
1802 
1808 
1811 
1818 };
1821 
1823 typedef struct clingo_statistic clingo_statistics_t;
1824 
1830 bool clingo_statistics_root(clingo_statistics_t *statistics, uint64_t *key);
1837 bool clingo_statistics_type(clingo_statistics_t *statistics, uint64_t key, clingo_statistics_type_t *type);
1838 
1841 
1849 bool clingo_statistics_array_size(clingo_statistics_t *statistics, uint64_t key, size_t *size);
1858 bool clingo_statistics_array_at(clingo_statistics_t *statistics, uint64_t key, size_t offset, uint64_t *subkey);
1860 
1863 
1871 bool clingo_statistics_map_size(clingo_statistics_t *statistics, uint64_t key, size_t *size);
1880 bool clingo_statistics_map_subkey_name(clingo_statistics_t *statistics, uint64_t key, size_t offset, char const **name);
1890 bool clingo_statistics_map_at(clingo_statistics_t *statistics, uint64_t key, char const *name, uint64_t *subkey);
1892 
1895 
1903 bool clingo_statistics_value_get(clingo_statistics_t *statistics, uint64_t key, double *value);
1905 
1907 
1908 // {{{1 ast
1909 
1927 
1938 
1941 
1942 enum clingo_ast_comparison_operator {
1943  clingo_ast_comparison_operator_greater_than = 0,
1944  clingo_ast_comparison_operator_less_than = 1,
1945  clingo_ast_comparison_operator_less_equal = 2,
1946  clingo_ast_comparison_operator_greater_equal = 3,
1947  clingo_ast_comparison_operator_not_equal = 4,
1948  clingo_ast_comparison_operator_equal = 5
1949 };
1950 typedef int clingo_ast_comparison_operator_t;
1951 
1952 enum clingo_ast_sign {
1953  clingo_ast_sign_none = 0,
1954  clingo_ast_sign_negation = 1,
1955  clingo_ast_sign_double_negation = 2
1956 };
1957 typedef int clingo_ast_sign_t;
1958 
1959 // {{{2 terms
1960 
1961 enum clingo_ast_term_type {
1962  clingo_ast_term_type_symbol = 0,
1963  clingo_ast_term_type_variable = 1,
1964  clingo_ast_term_type_unary_operation = 2,
1965  clingo_ast_term_type_binary_operation = 3,
1966  clingo_ast_term_type_interval = 4,
1967  clingo_ast_term_type_function = 5,
1968  clingo_ast_term_type_external_function = 6,
1969  clingo_ast_term_type_pool = 7
1970 };
1971 typedef int clingo_ast_term_type_t;
1972 
1977 typedef struct clingo_ast_pool clingo_ast_pool_t;
1978 typedef struct clingo_ast_term {
1979  clingo_location_t location;
1980  clingo_ast_term_type_t type;
1981  union {
1982  clingo_symbol_t symbol;
1983  char const *variable;
1984  clingo_ast_unary_operation_t const *unary_operation;
1985  clingo_ast_binary_operation_t const *binary_operation;
1986  clingo_ast_interval_t const *interval;
1987  clingo_ast_function_t const *function;
1988  clingo_ast_function_t const *external_function;
1989  clingo_ast_pool_t const *pool;
1990  };
1992 
1993 // unary operation
1994 
1995 enum clingo_ast_unary_operator {
1996  clingo_ast_unary_operator_minus = 0,
1997  clingo_ast_unary_operator_negation = 1,
1998  clingo_ast_unary_operator_absolute = 2
1999 };
2000 typedef int clingo_ast_unary_operator_t;
2001 
2003  clingo_ast_unary_operator_t unary_operator;
2004  clingo_ast_term_t argument;
2005 };
2006 
2007 // binary operation
2008 
2009 enum clingo_ast_binary_operator {
2010  clingo_ast_binary_operator_xor = 0,
2011  clingo_ast_binary_operator_or = 1,
2012  clingo_ast_binary_operator_and = 2,
2013  clingo_ast_binary_operator_plus = 3,
2014  clingo_ast_binary_operator_minus = 4,
2015  clingo_ast_binary_operator_multiplication = 5,
2016  clingo_ast_binary_operator_division = 6,
2017  clingo_ast_binary_operator_modulo = 7
2018 
2019 };
2020 typedef int clingo_ast_binary_operator_t;
2021 
2023  clingo_ast_binary_operator_t binary_operator;
2024  clingo_ast_term_t left;
2025  clingo_ast_term_t right;
2026 };
2027 
2028 // interval
2029 
2031  clingo_ast_term_t left;
2032  clingo_ast_term_t right;
2033 };
2034 
2035 // function
2036 
2038  char const *name;
2039  clingo_ast_term_t *arguments;
2040  size_t size;
2041 };
2042 
2043 // pool
2044 
2046  clingo_ast_term_t *arguments;
2047  size_t size;
2048 };
2049 
2050 // {{{2 csp
2051 
2053  clingo_location_t location;
2054  clingo_ast_term_t coefficient;
2055  clingo_ast_term_t const *variable;
2057 
2058 typedef struct clingo_ast_csp_sum_term {
2059  clingo_location_t location;
2061  size_t size;
2063 
2064 typedef struct clingo_ast_csp_guard {
2065  clingo_ast_comparison_operator_t comparison;
2068 
2069 typedef struct clingo_ast_csp_literal {
2071  clingo_ast_csp_guard_t const *guards;
2072  // NOTE: size must be at least one
2073  size_t size;
2075 
2076 // {{{2 ids
2077 
2078 typedef struct clingo_ast_id {
2079  clingo_location_t location;
2080  char const *id;
2081 } clingo_ast_id_t;
2082 
2083 // {{{2 literals
2084 
2085 typedef struct clingo_ast_comparison {
2086  clingo_ast_comparison_operator_t comparison;
2087  clingo_ast_term_t left;
2088  clingo_ast_term_t right;
2090 
2091 enum clingo_ast_literal_type {
2092  clingo_ast_literal_type_boolean = 0,
2093  clingo_ast_literal_type_symbolic = 1,
2094  clingo_ast_literal_type_comparison = 2,
2095  clingo_ast_literal_type_csp = 3
2096 };
2097 typedef int clingo_ast_literal_type_t;
2098 
2099 typedef struct clingo_ast_literal {
2100  clingo_location_t location;
2101  clingo_ast_sign_t sign;
2102  clingo_ast_literal_type_t type;
2103  union {
2104  bool boolean;
2105  clingo_ast_term_t const *symbol;
2106  clingo_ast_comparison_t const *comparison;
2107  clingo_ast_csp_literal_t const *csp_literal;
2108  };
2110 
2111 // {{{2 aggregates
2112 
2113 enum clingo_ast_aggregate_function {
2114  clingo_ast_aggregate_function_count = 0,
2115  clingo_ast_aggregate_function_sum = 1,
2116  clingo_ast_aggregate_function_sump = 2,
2117  clingo_ast_aggregate_function_min = 3,
2118  clingo_ast_aggregate_function_max = 4
2119 };
2120 typedef int clingo_ast_aggregate_function_t;
2121 
2123  clingo_ast_comparison_operator_t comparison;
2124  clingo_ast_term_t term;
2126 
2128  clingo_ast_literal_t literal;
2129  clingo_ast_literal_t const *condition;
2130  size_t size;
2132 
2133 // lparse-style aggregate
2134 
2135 typedef struct clingo_ast_aggregate {
2136  clingo_ast_conditional_literal_t const *elements;
2137  size_t size;
2138  clingo_ast_aggregate_guard_t const *left_guard;
2139  clingo_ast_aggregate_guard_t const *right_guard;
2141 
2142 // body aggregate
2143 
2145  clingo_ast_term_t *tuple;
2146  size_t tuple_size;
2147  clingo_ast_literal_t const *condition;
2148  size_t condition_size;
2150 
2152  clingo_ast_aggregate_function_t function;
2153  clingo_ast_body_aggregate_element_t const *elements;
2154  size_t size;
2155  clingo_ast_aggregate_guard_t const *left_guard;
2156  clingo_ast_aggregate_guard_t const *right_guard;
2158 
2159 // head aggregate
2160 
2162  clingo_ast_term_t const *tuple;
2163  size_t tuple_size;
2164  clingo_ast_conditional_literal_t conditional_literal;
2166 
2168  clingo_ast_aggregate_function_t function;
2169  clingo_ast_head_aggregate_element_t const *elements;
2170  size_t size;
2171  clingo_ast_aggregate_guard_t const *left_guard;
2172  clingo_ast_aggregate_guard_t const *right_guard;
2174 
2175 // disjunction
2176 
2177 typedef struct clingo_ast_disjunction {
2178  clingo_ast_conditional_literal_t const *elements;
2179  size_t size;
2181 
2182 // disjoint
2183 
2185  clingo_location_t location;
2186  clingo_ast_term_t const *tuple;
2187  size_t tuple_size;
2189  clingo_ast_literal_t const *condition;
2190  size_t condition_size;
2192 
2193 typedef struct clingo_ast_disjoint {
2194  clingo_ast_disjoint_element_t const *elements;
2195  size_t size;
2197 
2198 // {{{2 theory atom
2199 
2200 enum clingo_ast_theory_term_type {
2201  clingo_ast_theory_term_type_symbol = 0,
2202  clingo_ast_theory_term_type_variable = 1,
2203  clingo_ast_theory_term_type_tuple = 2,
2204  clingo_ast_theory_term_type_list = 3,
2205  clingo_ast_theory_term_type_set = 4,
2206  clingo_ast_theory_term_type_function = 5,
2207  clingo_ast_theory_term_type_unparsed_term = 6
2208 };
2209 typedef int clingo_ast_theory_term_type_t;
2210 
2211 typedef struct clingo_ast_theory_function clingo_ast_theory_function_t;
2212 typedef struct clingo_ast_theory_term_array clingo_ast_theory_term_array_t;
2213 typedef struct clingo_ast_theory_unparsed_term clingo_ast_theory_unparsed_term_t;
2214 
2215 typedef struct clingo_ast_theory_term {
2216  clingo_location_t location;
2217  clingo_ast_theory_term_type_t type;
2218  union {
2219  clingo_symbol_t symbol;
2220  char const *variable;
2221  clingo_ast_theory_term_array_t const *tuple;
2222  clingo_ast_theory_term_array_t const *list;
2223  clingo_ast_theory_term_array_t const *set;
2224  clingo_ast_theory_function_t const *function;
2225  clingo_ast_theory_unparsed_term_t const *unparsed_term;
2226  };
2228 
2230  clingo_ast_theory_term_t const *terms;
2231  size_t size;
2232 };
2233 
2235  char const *name;
2236  clingo_ast_theory_term_t const *arguments;
2237  size_t size;
2238 };
2239 
2241  char const *const *operators;
2242  size_t size;
2245 
2248  size_t size;
2249 };
2250 
2252  clingo_ast_theory_term_t const *tuple;
2253  size_t tuple_size;
2254  clingo_ast_literal_t const *condition;
2255  size_t condition_size;
2257 
2258 typedef struct clingo_ast_theory_guard {
2259  char const *operator_name;
2262 
2263 typedef struct clingo_ast_theory_atom {
2264  clingo_ast_term_t term;
2265  clingo_ast_theory_atom_element_t const *elements;
2266  size_t size;
2267  clingo_ast_theory_guard_t const *guard;
2269 
2270 // {{{2 head literals
2271 
2272 enum clingo_ast_head_literal_type {
2273  clingo_ast_head_literal_type_literal = 0,
2274  clingo_ast_head_literal_type_disjunction = 1,
2275  clingo_ast_head_literal_type_aggregate = 2,
2276  clingo_ast_head_literal_type_head_aggregate = 3,
2277  clingo_ast_head_literal_type_theory_atom = 4
2278 };
2279 typedef int clingo_ast_head_literal_type_t;
2280 
2281 typedef struct clingo_ast_head_literal {
2282  clingo_location_t location;
2283  clingo_ast_head_literal_type_t type;
2284  union {
2285  clingo_ast_literal_t const *literal;
2286  clingo_ast_disjunction_t const *disjunction;
2287  clingo_ast_aggregate_t const *aggregate;
2288  clingo_ast_head_aggregate_t const *head_aggregate;
2289  clingo_ast_theory_atom_t const *theory_atom;
2290  };
2292 
2293 // {{{2 body literals
2294 
2295 enum clingo_ast_body_literal_type {
2296  clingo_ast_body_literal_type_literal = 0,
2297  clingo_ast_body_literal_type_conditional = 1,
2298  clingo_ast_body_literal_type_aggregate = 2,
2299  clingo_ast_body_literal_type_body_aggregate = 3,
2300  clingo_ast_body_literal_type_theory_atom = 4,
2301  clingo_ast_body_literal_type_disjoint = 5
2302 };
2303 typedef int clingo_ast_body_literal_type_t;
2304 
2305 typedef struct clingo_ast_body_literal {
2306  clingo_location_t location;
2307  clingo_ast_sign_t sign;
2308  clingo_ast_body_literal_type_t type;
2309  union {
2310  clingo_ast_literal_t const *literal;
2311  // Note: conditional literals must not have signs!!!
2312  clingo_ast_conditional_literal_t const *conditional;
2313  clingo_ast_aggregate_t const *aggregate;
2314  clingo_ast_body_aggregate_t const *body_aggregate;
2315  clingo_ast_theory_atom_t const *theory_atom;
2316  clingo_ast_disjoint_t const *disjoint;
2317  };
2319 
2320 // {{{2 theory definitions
2321 
2322 enum clingo_ast_theory_operator_type {
2323  clingo_ast_theory_operator_type_unary = 0,
2324  clingo_ast_theory_operator_type_binary_left = 1,
2325  clingo_ast_theory_operator_type_binary_right = 2
2326 };
2327 typedef int clingo_ast_theory_operator_type_t;
2328 
2330  clingo_location_t location;
2331  char const *name;
2332  unsigned priority;
2333  clingo_ast_theory_operator_type_t type;
2335 
2337  clingo_location_t location;
2338  char const *name;
2339  clingo_ast_theory_operator_definition_t const *operators;
2340  size_t size;
2342 
2344  char const *term;
2345  char const *const *operators;
2346  size_t size;
2348 
2349 enum clingo_ast_theory_atom_definition_type {
2350  clingo_ast_theory_atom_definition_type_head = 0,
2351  clingo_ast_theory_atom_definition_type_body = 1,
2352  clingo_ast_theory_atom_definition_type_any = 2,
2353  clingo_ast_theory_atom_definition_type_directive = 3,
2354 };
2355 typedef int clingo_ast_theory_atom_definition_type_t;
2356 
2358  clingo_location_t location;
2359  clingo_ast_theory_atom_definition_type_t type;
2360  char const *name;
2361  unsigned arity;
2362  char const *elements;
2365 
2367  char const *name;
2369  size_t terms_size;
2371  size_t atoms_size;
2373 
2374 // {{{2 statements
2375 
2376 // rule
2377 
2378 typedef struct clingo_ast_rule {
2380  clingo_ast_body_literal_t const *body;
2381  size_t size;
2383 
2384 // definition
2385 
2386 typedef struct clingo_ast_definition {
2387  char const *name;
2388  clingo_ast_term_t value;
2389  bool is_default;
2391 
2392 // show
2393 
2395  clingo_signature_t signature;
2396  bool csp;
2398 
2399 typedef struct clingo_ast_show_term {
2400  clingo_ast_term_t term;
2401  clingo_ast_body_literal_t const *body;
2402  size_t size;
2403  bool csp;
2405 
2406 // minimize
2407 
2408 typedef struct clingo_ast_minimize {
2409  clingo_ast_term_t weight;
2410  clingo_ast_term_t priority;
2411  clingo_ast_term_t const *tuple;
2412  size_t tuple_size;
2413  clingo_ast_body_literal_t const *body;
2414  size_t body_size;
2416 
2417 // script
2418 
2419 enum clingo_ast_script_type {
2420  clingo_ast_script_type_lua = 0,
2421  clingo_ast_script_type_python = 1
2422 };
2423 typedef int clingo_ast_script_type_t;
2424 
2425 typedef struct clingo_ast_script {
2426  clingo_ast_script_type_t type;
2427  char const *code;
2429 
2430 // program
2431 
2432 typedef struct clingo_ast_program {
2433  char const *name;
2434  clingo_ast_id_t const *parameters;
2435  size_t size;
2437 
2438 // external
2439 
2440 typedef struct clingo_ast_external {
2441  clingo_ast_term_t atom;
2442  clingo_ast_body_literal_t const *body;
2443  size_t size;
2445 
2446 // edge
2447 
2448 typedef struct clingo_ast_edge {
2451  clingo_ast_body_literal_t const *body;
2452  size_t size;
2454 
2455 // heuristic
2456 
2457 typedef struct clingo_ast_heuristic {
2458  clingo_ast_term_t atom;
2459  clingo_ast_body_literal_t const *body;
2460  size_t size;
2461  clingo_ast_term_t bias;
2462  clingo_ast_term_t priority;
2463  clingo_ast_term_t modifier;
2465 
2466 // project
2467 
2468 typedef struct clingo_ast_project {
2469  clingo_ast_term_t atom;
2470  clingo_ast_body_literal_t const *body;
2471  size_t size;
2473 
2474 // statement
2475 
2476 enum clingo_ast_statement_type {
2477  clingo_ast_statement_type_rule = 0,
2478  clingo_ast_statement_type_const = 1,
2479  clingo_ast_statement_type_show_signature = 2,
2480  clingo_ast_statement_type_show_term = 3,
2481  clingo_ast_statement_type_minimize = 4,
2482  clingo_ast_statement_type_script = 5,
2483  clingo_ast_statement_type_program = 6,
2484  clingo_ast_statement_type_external = 7,
2485  clingo_ast_statement_type_edge = 8,
2486  clingo_ast_statement_type_heuristic = 9,
2487  clingo_ast_statement_type_project_atom = 10,
2488  clingo_ast_statement_type_project_atom_signature = 11,
2489  clingo_ast_statement_type_theory_definition = 12
2490 };
2491 typedef int clingo_ast_statement_type_t;
2492 
2493 typedef struct clingo_ast_statement {
2494  clingo_location_t location;
2495  clingo_ast_statement_type_t type;
2496  union {
2497  clingo_ast_rule_t const *rule;
2498  clingo_ast_definition_t const *definition;
2499  clingo_ast_show_signature_t const *show_signature;
2500  clingo_ast_show_term_t const *show_term;
2501  clingo_ast_minimize_t const *minimize;
2502  clingo_ast_script_t const *script;
2503  clingo_ast_program_t const *program;
2504  clingo_ast_external_t const *external;
2505  clingo_ast_edge_t const *edge;
2506  clingo_ast_heuristic_t const *heuristic;
2507  clingo_ast_project_t const *project_atom;
2508  clingo_signature_t project_signature;
2509  clingo_ast_theory_definition_t const *theory_definition;
2510  };
2512 
2513 // }}}2
2514 
2515 typedef bool clingo_ast_callback_t (clingo_ast_statement_t const *, void *);
2527 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);
2528 
2530 
2531 // {{{1 program builder
2532 
2535 
2537 typedef struct clingo_program_builder clingo_program_builder_t;
2538 
2558 
2560 
2561 // {{{1 control
2562 
2576 
2581 
2584 
2602 
2605 
2607 typedef struct clingo_control clingo_control_t;
2608 
2620 typedef struct clingo_part {
2621  char const *name;
2622  clingo_symbol_t const *params;
2623  size_t size;
2624 } clingo_part_t;
2625 
2634 typedef bool clingo_symbol_callback_t (clingo_symbol_t const *symbols, size_t symbols_size, void *data);
2635 
2678 
2679 typedef bool clingo_ground_callback_t (clingo_location_t 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);
2696 typedef bool clingo_model_callback_t (clingo_model_t *model, void *data, bool *goon);
2697 
2710 typedef bool clingo_finish_callback_t (clingo_solve_result_bitset_t result, void *data);
2711 
2731 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);
2732 
2735 void clingo_control_free(clingo_control_t *control);
2736 
2739 
2747 bool clingo_control_load(clingo_control_t *control, char const *file);
2748 
2763 bool clingo_control_add(clingo_control_t *control, char const *name, char const * const * parameters, size_t parameters_size, char const *program);
2764 
2783 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);
2784 
2786 
2789 
2802 bool clingo_control_solve(clingo_control_t *control, clingo_model_callback_t *model_callback, void *model_callback_data, clingo_symbolic_literal_t const * assumptions, size_t assumptions_size, clingo_solve_result_bitset_t *result);
2814 bool clingo_control_solve_iteratively(clingo_control_t *control, clingo_symbolic_literal_t const *assumptions, size_t assumptions_size, clingo_solve_iteratively_t **handle);
2830 bool clingo_control_solve_async(clingo_control_t *control, clingo_model_callback_t *model_callback, void *model_callback_data, clingo_finish_callback_t *finish_callback, void *finish_callback_data, clingo_symbolic_literal_t const * assumptions, size_t assumptions_size, clingo_solve_async_t **handle);
2852 bool clingo_control_assign_external(clingo_control_t *control, clingo_symbol_t atom, clingo_truth_value_t value);
2863 bool clingo_control_release_external(clingo_control_t *control, clingo_symbol_t atom);
2877 bool clingo_control_register_propagator(clingo_control_t *control, clingo_propagator_t propagator, void *data, bool sequential);
2900 
2902 
2905 
2931 
2934 
2941 bool clingo_control_get_const(clingo_control_t *control, char const *name, clingo_symbol_t *symbol);
2951 bool clingo_control_has_const(clingo_control_t *control, char const *name, bool *exists);
2970 
2973 
2982 bool clingo_control_backend(clingo_control_t *control, clingo_backend_t **backend);
2992 
2994 
2995 // }}}1
2996 
2997 #ifdef __cplusplus
2998 }
2999 #endif
3000 
3001 #endif
void clingo_control_free(clingo_control_t *control)
Free a control object created with clingo_control_new().
CSP variable with unbounded domain.
Definition: clingo.h:128
bool clingo_theory_atoms_atom_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t atom, size_t *size)
Get the size of the string representation of the given theory atom (including the terminating 0)...
bool clingo_model_context(clingo_model_t *model, clingo_solve_control_t **control)
Get the associated solve control object of a model.
Definition: clingo.h:2229
bool clingo_control_load(clingo_control_t *control, char const *file)
Extend the logic program with a program in a file.
bool(* clingo_propagator_check_callback_t)(clingo_propagate_control_t *, void *)
Typedef for clingo_propagator::check().
Definition: clingo.h:1378
clingo_solve_result
Enumeration of bit masks for solve call results.
Definition: clingo.h:636
the entry is a (string) value
Definition: clingo.h:1641
Represents a symbolic literal.
Definition: clingo.h:286
void clingo_logger_t(clingo_warning_t code, char const *message, void *data)
Callback to intercept warning messages.
Definition: clingo.h:145
bool clingo_solve_iteratively_close(clingo_solve_iteratively_t *handle)
Closes an active search.
Definition: clingo.h:2099
Definition: clingo.h:2246
struct clingo_model clingo_model_t
Object representing a model.
Definition: clingo.h:502
bool clingo_configuration_value_get_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size)
Get the size of the string value of the given entry.
bool clingo_program_builder_add(clingo_program_builder_t *builder, clingo_ast_statement_t const *statement)
Adds a statement to the program.
void clingo_symbol_create_infimum(clingo_symbol_t *symbol)
Construct a symbol representing #inf.
errors unrelated to clingo
Definition: clingo.h:103
struct clingo_statistic clingo_statistics_t
Handle for to the solver statistics.
Definition: clingo.h:1823
The last solve call completely exhausted the search space.
Definition: clingo.h:639
bool clingo_signature_is_negative(clingo_signature_t signature)
Whether the signature is negative (is classically negated).
int clingo_heuristic_type_t
Corresponding type to clingo_heuristic_type.
Definition: clingo.h:1498
bool clingo_control_register_propagator(clingo_control_t *control, clingo_propagator_t propagator, void *data, bool sequential)
Register a custom propagator with the control object.
bool clingo_statistics_map_size(clingo_statistics_t *statistics, uint64_t key, size_t *size)
Get the number of subkeys of a map entry.
bool clingo_solve_async_wait(clingo_solve_async_t *handle, double timeout, bool *result)
Wait for the specified amount of time to check if the search has finished.
bool clingo_theory_atoms_term_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t term, size_t *size)
Get the size of the string representation of the given theory term (including the terminating 0)...
Definition: clingo.h:2378
struct clingo_symbolic_literal clingo_symbolic_literal_t
Represents a symbolic literal.
bool clingo_symbolic_atoms_literal(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_literal_t *literal)
Returns the (numeric) aspif literal corresponding to the given symbolic atom.
Definition: clingo.h:2234
Definition: clingo.h:2329
Definition: clingo.h:2058
Definition: clingo.h:2357
a tuple term, e.g., (1,2,3)
Definition: clingo.h:972
bool clingo_control_solve_iteratively(clingo_control_t *control, clingo_symbolic_literal_t const *assumptions, size_t assumptions_size, clingo_solve_iteratively_t **handle)
Solve the currently grounded logic program enumerating models iteratively.
void clingo_symbol_create_number(int number, clingo_symbol_t *symbol)
Construct a symbol representing a number.
bool clingo_configuration_array_at(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, clingo_id_t *subkey)
Get the subkey at the given offset of an array entry.
bool clingo_propagate_init_theory_atoms(clingo_propagate_init_t *init, clingo_theory_atoms_t **atoms)
Get an object to inspect the theory atoms.
bool clingo_theory_atoms_element_condition(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t const **condition, size_t *size)
Get the condition (array of aspif literals) of the given theory element.
size_t begin_column
the column where the location begins
Definition: clingo.h:172
bool clingo_solve_async_cancel(clingo_solve_async_t *handle)
Stop the running search.
bool clingo_symbol_is_equal_to(clingo_symbol_t a, clingo_symbol_t b)
Check if two symbols are equal.
int32_t clingo_literal_t
Signed integer type used for aspif and solver literals.
Definition: clingo.h:84
bool clingo_control_backend(clingo_control_t *control, clingo_backend_t **backend)
Get an object to add ground directives to the program.
struct clingo_backend clingo_backend_t
Handle to the backend to add directives in aspif format.
Definition: clingo.h:1517
struct clingo_solve_iteratively clingo_solve_iteratively_t
Search handle to enumerate models iteratively.
Definition: clingo.h:675
struct clingo_control clingo_control_t
Control object holding grounding and solving state.
Definition: clingo.h:2607
a list term, e.g., [1,2,3]
Definition: clingo.h:973
clingo_symbol_type
Enumeration of available symbol types.
Definition: clingo.h:269
bool clingo_theory_atoms_size(clingo_theory_atoms_t *atoms, size_t *size)
Get the total number of theory atoms.
The last solve call was interrupted.
Definition: clingo.h:640
Definition: clingo.h:2167
clingo_show_type
Enumeration of bit flags to select symbols in models.
Definition: clingo.h:514
a string symbol, e.g., "a"
Definition: clingo.h:272
a symbol term, e.g., c
Definition: clingo.h:977
void clingo_version(int *major, int *minor, int *revision)
Obtain the clingo version.
modify VSIDS factor of an atom
Definition: clingo.h:1492
int clingo_clause_type_t
Corresponding type to clingo_clause_type.
Definition: clingo.h:1320
bool clingo_configuration_value_get(clingo_configuration_t *configuration, clingo_id_t key, char *value, size_t size)
Get the string value of the given entry.
Definition: clingo.h:2258
clingo_assignment_t * clingo_propagate_control_assignment(clingo_propagate_control_t *control)
Get the assignment associated with the underlying solver.
bool clingo_theory_atoms_term_name(clingo_theory_atoms_t *atoms, clingo_id_t term, char const **name)
Get the name of the given constant or function theory term.
a set term, e.g., {1,2,3}
Definition: clingo.h:974
Select symbols added by extensions.
Definition: clingo.h:519
Definition: clingo.h:2305
the entry is a map
Definition: clingo.h:1643
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.
Struct used to specify the program parts that have to be grounded.
Definition: clingo.h:2620
other kinds of warnings
Definition: clingo.h:130
clingo_id_t clingo_propagate_control_thread_id(clingo_propagate_control_t *control)
Get the id of the underlying solver thread.
Definition: clingo.h:2064
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.
uint64_t clingo_symbolic_atom_iterator_t
Object to iterate over symbolic atoms.
Definition: clingo.h:818
bool clingo_configuration_array_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size)
Get the size of an array entry.
Definition: clingo.h:2151
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.
bool clingo_model_symbols(clingo_model_t *model, clingo_show_type_bitset_t show, clingo_symbol_t *symbols, size_t size)
Get the symbols of the selected types in the model.
bool clingo_configuration_value_set(clingo_configuration_t *configuration, clingo_id_t key, char const *value)
Set the value of an entry.
bool clingo_model_contains(clingo_model_t *model, clingo_symbol_t atom, bool *contained)
Constant time lookup to test whether an atom is in a model.
struct clingo_weighted_literal clingo_weighted_literal_t
A Literal with an associated weight.
no longer treat an atom as external
Definition: clingo.h:1505
clingo_symbol_t const * params
array of parameters
Definition: clingo.h:2622
bool clingo_assignment_is_fixed(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_fixed)
Check if a literal has a fixed truth value.
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_propagate_control clingo_propagate_control_t
This object can be used to add clauses and propagate literals while solving.
Definition: clingo.h:1323
set the level of an atom
Definition: clingo.h:1490
Definition: clingo.h:2022
char const * clingo_warning_string(clingo_warning_t code)
Convert warning code into string.
bool clingo_add_string(char const *string, char const **result)
Internalize a string.
char const * begin_file
the file where the location begins
Definition: clingo.h:168
uint32_t clingo_atom_t
Unsigned integer type used for aspif atoms.
Definition: clingo.h:86
struct clingo_location clingo_location_t
Represents a source code location marking its beginnig and end.
char const * clingo_signature_name(clingo_signature_t signature)
Get the name of a signature.
Definition: clingo.h:2085
undefined arithmetic operation or weight of aggregate
Definition: clingo.h:124
bool clingo_control_has_const(clingo_control_t *control, char const *name, bool *exists)
Check if there is a constant definition for the given constant.
bool positive
whether the literal has a sign
Definition: clingo.h:288
int clingo_symbol_type_t
Corresponding type to clingo_symbol_type.
Definition: clingo.h:277
Definition: clingo.h:2215
assign an external to false
Definition: clingo.h:1504
bool clingo_configuration_map_at(clingo_configuration_t *configuration, clingo_id_t key, char const *name, clingo_id_t *subkey)
Lookup a subkey under the given name.
bool clingo_backend_rule(clingo_backend_t *backend, bool choice, clingo_atom_t const *head, size_t head_size, clingo_literal_t const *body, size_t body_size)
Add a rule to the program.
clingo_heuristic_type
Enumeration of different heuristic modifiers.
Definition: clingo.h:1489
Definition: clingo.h:2127
bool clingo_symbolic_atoms_iterator_is_equal_to(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t a, clingo_symbolic_atom_iterator_t b, bool *equal)
Check if two iterators point to the same element (or end of the sequence).
Definition: clingo.h:2177
struct clingo_propagate_init clingo_propagate_init_t
Object to initialize a used-defined propagator before each solving step.
Definition: clingo.h:1193
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.
set the level of an atom and choose a positive sign
Definition: clingo.h:1494
bool clingo_signature_is_equal_to(clingo_signature_t a, clingo_signature_t b)
Check if two signatures are equal.
Select all terms.
Definition: clingo.h:518
bool clingo_theory_atoms_atom_elements(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t const **elements, size_t *size)
Get the theory elements associated with the theory atom.
clingo_model_type
Enumeration for the different model types.
Definition: clingo.h:505
Definition: clingo.h:2251
Definition: clingo.h:2052
size_t end_line
the line where the location ends
Definition: clingo.h:171
char const * end_file
the file where the location ends
Definition: clingo.h:169
bool clingo_theory_atoms_term_type(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_theory_term_type_t *type)
Get the type of the given theory term.
bool clingo_theory_atoms_element_condition_id(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_literal_t *condition)
Get the id of the condition of the given theory element.
bool clingo_signature_is_less_than(clingo_signature_t a, clingo_signature_t b)
Check if a signature is less than another signature.
bool clingo_program_builder_end(clingo_program_builder_t *builder)
End building a program.
bool clingo_propagate_control_propagate(clingo_propagate_control_t *control, bool *result)
Propagate implied literals (resulting from added clauses).
bool clingo_model_cost(clingo_model_t *model, int64_t *costs, size_t size)
Get the cost vector of a model.
bool clingo_finish_callback_t(clingo_solve_result_bitset_t result, void *data)
Callback function called at the end of an asynchronous solve operation.
Definition: clingo.h:2710
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...
Definition: clingo.h:2425
struct clingo_assignment clingo_assignment_t
Represents a (partial) assignment of a particular solver.
Definition: clingo.h:1241
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.
Definition: clingo.h:2343
global variable in tuple of aggregate element
Definition: clingo.h:129
bool clingo_control_get_const(clingo_control_t *control, char const *name, clingo_symbol_t *symbol)
Return the symbol for a constant definition of form: #const name = symbol.
unsigned clingo_configuration_type_bitset_t
Bitset for values of type clingo_configuration_type.
Definition: clingo.h:1646
bool clingo_signature_create(char const *name, uint32_t arity, bool positive, clingo_signature_t *signature)
Create a new signature.
bool clingo_control_release_external(clingo_control_t *control, clingo_symbol_t atom)
Release an external atom.
Definition: clingo.h:2399
bool clingo_configuration_description(clingo_configuration_t *configuration, clingo_id_t key, char const **description)
Get the description of an entry.
clingo_external_type
Enumeration of different external statements.
Definition: clingo.h:1501
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.
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_ground_callback_t(clingo_location_t 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:2679
int clingo_statistics_type_t
Corresponding type to clingo_solve_result.
Definition: clingo.h:1820
bool(* clingo_propagator_undo_callback_t)(clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *)
Typedef for clingo_propagator::undo().
Definition: clingo.h:1375
bool clingo_symbol_callback_t(clingo_symbol_t const *symbols, size_t symbols_size, void *data)
Callback function to inject symbols.
Definition: clingo.h:2634
clause is not subject to the solvers deletion policy
Definition: clingo.h:1315
Definition: clingo.h:2263
clingo_truth_value
Represents three-valued truth values.
Definition: clingo.h:155
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).
bool clingo_configuration_map_subkey_name(clingo_configuration_t *configuration, clingo_id_t key, size_t offset, char const **name)
Get the name associated with the offset-th subkey.
bool clingo_backend_external(clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type)
Add an external statement.
size_t end_column
the column where the location ends
Definition: clingo.h:173
bool clingo_backend_add_atom(clingo_backend_t *backend, clingo_atom_t *atom)
Get a fresh atom to be used in aspif directives.
bool clingo_symbolic_atoms_symbol(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbol_t *symbol)
Get the symbolic representation of an atom.
Definition: clingo.h:2408
bool clingo_assignment_decision(clingo_assignment_t *assignment, uint32_t level, clingo_literal_t *literal)
Determine the decision literal given a decision level.
bool clingo_backend_assume(clingo_backend_t *backend, clingo_literal_t const *literals, size_t size)
Add an assumption directive.
bool clingo_propagate_init_solver_literal(clingo_propagate_init_t *init, clingo_literal_t aspif_literal, clingo_literal_t *solver_literal)
Map the given program literal or condition id to its solver literal.
bool clingo_control_solve_async(clingo_control_t *control, clingo_model_callback_t *model_callback, void *model_callback_data, clingo_finish_callback_t *finish_callback, void *finish_callback_data, clingo_symbolic_literal_t const *assumptions, size_t assumptions_size, clingo_solve_async_t **handle)
Solve the currently grounded logic program asynchronously in the background.
internal error that should not occur in practice
Definition: clingo.h:101
struct clingo_solve_async clingo_solve_async_t
Search handle to an asynchronous solve call.
Definition: clingo.h:743
struct clingo_theory_atoms clingo_theory_atoms_t
Container that stores theory atoms, elements, and terms (see clingo_control_theory_atoms()).
Definition: clingo.h:983
int clingo_external_type_t
Corresponding type to clingo_external_type.
Definition: clingo.h:1508
int clingo_error_t
Corresponding type to clingo_error.
Definition: clingo.h:106
Definition: clingo.h:2069
bool clingo_statistics_array_at(clingo_statistics_t *statistics, uint64_t key, size_t offset, uint64_t *subkey)
Get the subkey at the given offset of an array entry.
bool clingo_symbol_create_string(char const *string, clingo_symbol_t *symbol)
Construct a symbol representing a string.
void clingo_set_error(clingo_error_t code, char const *message)
Set a custom error code and message in the active thread.
Definition: clingo.h:2366
int clingo_truth_value_t
Corresponding type to clingo_truth_value.
Definition: clingo.h:161
Select everything.
Definition: clingo.h:520
uint64_t clingo_signature_t
Represents a predicate signature.
Definition: clingo.h:211
Definition: clingo.h:2045
bool clingo_symbolic_atoms_size(clingo_symbolic_atoms_t *atoms, size_t *size)
Get the number of different atoms occurring in a logic program.
bool clingo_control_configuration(clingo_control_t *control, clingo_configuration_t **configuration)
Get a configuration object to change the solver configuration.
modify the initial VSIDS score of an atom
Definition: clingo.h:1493
bool clingo_theory_atoms_atom_to_string(clingo_theory_atoms_t *atoms, clingo_id_t atom, char *string, size_t size)
Get the string representation of the given theory atom.
Definition: clingo.h:2122
Definition: clingo.h:2184
bool clingo_model_cost_size(clingo_model_t *model, size_t *size)
Get the number of cost values of a model.
bool clingo_configuration_map_size(clingo_configuration_t *configuration, clingo_id_t key, size_t *size)
Get the number of subkeys of a map entry.
void clingo_control_interrupt(clingo_control_t *control)
Interrupt the active solve call (or the following solve call right at the beginning).
bool clingo_symbolic_atoms_is_fact(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *fact)
Check whether an atom is a fact.
size_t size
number of parameters
Definition: clingo.h:2623
like clingo_clause_type_learnt but the clause is deleted after a solving step
Definition: clingo.h:1316
clingo_theory_term_type
Enumeration of theory term types.
Definition: clingo.h:971
bool clingo_symbol_number(clingo_symbol_t symbol, int *number)
Get the number of a symbol.
bool clingo_model_callback_t(clingo_model_t *model, void *data, bool *goon)
Callback function to intercept models.
Definition: clingo.h:2696
bool clingo_backend_project(clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size)
Add a projection directive.
bool clingo_theory_atoms_atom_term(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_id_t *term)
Get the theory term associated with the theory atom.
Definition: clingo.h:1978
Definition: clingo.h:2493
bool clingo_symbolic_atoms_is_external(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *external)
Check whether an atom is external.
bool clingo_symbolic_atoms_is_valid(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, bool *valid)
Check whether the given iterator points to some element with the sequence of symbolic atoms or to the...
bool clingo_control_assign_external(clingo_control_t *control, clingo_symbol_t atom, clingo_truth_value_t value)
Assign a truth value to an external atom.
The model represents a set of cautious consequences.
Definition: clingo.h:508
char const * name
name of the program part
Definition: clingo.h:2621
bool clingo_theory_atoms_element_to_string_size(clingo_theory_atoms_t *atoms, clingo_id_t element, size_t *size)
Get the size of the string representation of the given theory element (including the terminating 0)...
The model represents a stable model.
Definition: clingo.h:506
bool(* clingo_propagator_init_callback_t)(clingo_propagate_init_t *, void *)
Typedef for clingo_propagator::init().
Definition: clingo.h:1369
bool clingo_symbolic_atoms_find(clingo_symbolic_atoms_t *atoms, clingo_symbol_t symbol, clingo_symbolic_atom_iterator_t *iterator)
Find a symbolic atom given its symbolic representation.
clingo_error
Enumeration of error codes.
Definition: clingo.h:98
Definition: clingo.h:2468
the entry is a (string) value
Definition: clingo.h:1815
bool clingo_model_optimality_proven(clingo_model_t *model, bool *proven)
Whether the optimality of a model has been proven.
Represents a source code location marking its beginnig and end.
Definition: clingo.h:167
clingo_statistics_type
Enumeration for entries of the statistics.
Definition: clingo.h:1813
bool clingo_solve_control_add_clause(clingo_solve_control_t *control, clingo_symbolic_literal_t const *clause, size_t size)
Add a clause that applies to the current solving step during model enumeration.
bool clingo_model_symbols_size(clingo_model_t *model, clingo_show_type_bitset_t show, size_t *size)
Get the number of symbols of the selected types in the model.
bool clingo_control_solve(clingo_control_t *control, clingo_model_callback_t *model_callback, void *model_callback_data, clingo_symbolic_literal_t const *assumptions, size_t assumptions_size, clingo_solve_result_bitset_t *result)
Solve the currently grounded logic program.
bool clingo_control_theory_atoms(clingo_control_t *control, clingo_theory_atoms_t **atoms)
Get an object to inspect theory atoms that occur in the grounding.
bool clingo_control_use_enumeration_assumption(clingo_control_t *control, bool enable)
Configure how learnt constraints are handled during enumeration.
Definition: clingo.h:2078
a function term, e.g., f(1,2,3)
Definition: clingo.h:975
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:808
the #sup symbol
Definition: clingo.h:274
bool clingo_configuration_value_is_assigned(clingo_configuration_t *configuration, clingo_id_t key, bool *assigned)
Check whether a entry has a value.
bool clingo_theory_atoms_atom_literal(clingo_theory_atoms_t *atoms, clingo_id_t atom, clingo_literal_t *literal)
Get the aspif literal associated with the given theory atom.
bool clingo_assignment_is_true(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_true)
Check if a literal is true.
bool clingo_symbol_arguments(clingo_symbol_t symbol, clingo_symbol_t const **arguments, size_t *arguments_size)
Get the arguments of a symbol.
assign an external to true
Definition: clingo.h:1503
bool clingo_theory_atoms_element_tuple(clingo_theory_atoms_t *atoms, clingo_id_t element, clingo_id_t const **tuple, size_t *size)
Get the tuple (array of theory terms) of the given theory element.
uint32_t clingo_signature_arity(clingo_signature_t signature)
Get the arity of a signature.
the entry is an array
Definition: clingo.h:1816
struct clingo_part clingo_part_t
Struct used to specify the program parts that have to be grounded.
clingo_configuration_type
Enumeration for entries of the configuration.
Definition: clingo.h:1640
Definition: clingo.h:2394
int clingo_theory_term_type_t
Corresponding type to clingo_theory_term_type.
Definition: clingo.h:980
bool clingo_symbolic_atoms_signatures(clingo_symbolic_atoms_t *atoms, clingo_signature_t *signatures, size_t size)
Get the predicate signatures occurring in a logic program.
false
Definition: clingo.h:158
bool clingo_theory_atoms_atom_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, char const **connective, clingo_id_t *term)
Get the guard consisting of a theory operator and a theory term of the given theory atom...
bool clingo_statistics_value_get(clingo_statistics_t *statistics, uint64_t key, double *value)
Get the value of the given entry.
bool clingo_assignment_is_false(clingo_assignment_t *assignment, clingo_literal_t literal, bool *is_false)
Check if a literal has a fixed truth value.
Select shown atoms and terms.
Definition: clingo.h:516
bool clingo_theory_atoms_term_number(clingo_theory_atoms_t *atoms, clingo_id_t term, int *number)
Get the number of the given numeric theory term.
clingo_error_t clingo_error_code()
Get the last error code set by a clingo API call.
The last solve call did not find a solution.
Definition: clingo.h:638
bool clingo_theory_atoms_term_to_string(clingo_theory_atoms_t *atoms, clingo_id_t term, char *string, size_t size)
Get the string representation of the given theory term.
int32_t clingo_weight_t
Signed integer type for weights in sum aggregates and minimize constraints.
Definition: clingo.h:90
bool clingo_statistics_map_at(clingo_statistics_t *statistics, uint64_t key, char const *name, uint64_t *subkey)
Lookup a subkey under the given name.
bool clingo_symbol_is_less_than(clingo_symbol_t a, clingo_symbol_t b)
Check if a symbol is less than another symbol.
the entry is a map
Definition: clingo.h:1817
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:642
bool clingo_assignment_truth_value(clingo_assignment_t *assignment, clingo_literal_t literal, clingo_truth_value_t *value)
Determine the truth value of a given literal.
uint32_t clingo_id_t
Unsigned integer type used in various places.
Definition: clingo.h:88
Definition: clingo.h:2037
bool clingo_configuration_root(clingo_configuration_t *configuration, clingo_id_t *key)
Get the root key of the configuration.
bool clingo_statistics_map_subkey_name(clingo_statistics_t *statistics, uint64_t key, size_t offset, char const **name)
Get the name associated with the offset-th subkey.
bool clingo_control_symbolic_atoms(clingo_control_t *control, clingo_symbolic_atoms_t **atoms)
Get an object to inspect symbolic atoms (the relevant Herbrand base) used for grounding.
size_t clingo_symbol_hash(clingo_symbol_t symbol)
Calculate a hash code of a symbol.
Definition: clingo.h:2161
Definition: clingo.h:2386
char const * clingo_error_message()
Get the last error message set if an API call fails.
clause is subject to the solvers deletion policy
Definition: clingo.h:1314
set the level of an atom and choose a negative sign
Definition: clingo.h:1495
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...
bool clingo_statistics_array_size(clingo_statistics_t *statistics, uint64_t key, size_t *size)
Get the size of an array entry.
bool clingo_model_number(clingo_model_t *model, uint64_t *number)
Get the running number of the model.
the entry is invalid (has neither of the types below)
Definition: clingo.h:1814
char const * clingo_error_string(clingo_error_t code)
Convert error code into string.
Definition: clingo.h:2281
bool clingo_assignment_level(clingo_assignment_t *assignment, clingo_literal_t literal, uint32_t *level)
Determine the decision level of a given literal.
bool clingo_theory_atoms_term_arguments(clingo_theory_atoms_t *atoms, clingo_id_t term, clingo_id_t const **arguments, size_t *size)
Get the arguments of the given function theory term.
bool clingo_control_statistics(clingo_control_t *control, clingo_statistics_t **statistics)
Get a statistics object to inspect solver statistics.
memory could not be allocated
Definition: clingo.h:102
Definition: clingo.h:2135
clingo_symbol_t symbol
the associated symbol (must be a function)
Definition: clingo.h:287
Definition: clingo.h:2448
bool clingo_symbol_name(clingo_symbol_t symbol, char const **name)
Get the name of a symbol.
bool clingo_solve_iteratively_next(clingo_solve_iteratively_t *handle, clingo_model_t **model)
Get the next model.
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:1372
bool clingo_theory_atoms_element_to_string(clingo_theory_atoms_t *atoms, clingo_id_t element, char *string, size_t size)
Get the string representation of the given theory element.
configure which sign to chose for an atom
Definition: clingo.h:1491
size_t clingo_signature_hash(clingo_signature_t signature)
Calculate a hash code of a signature.
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.
bool clingo_symbolic_atoms_signatures_size(clingo_symbolic_atoms_t *atoms, size_t *size)
Get the number of different predicate signatures used in the program.
Select CSP assignments.
Definition: clingo.h:515
bool clingo_assignment_has_conflict(clingo_assignment_t *assignment)
Check if the given assignment is conflicting.
A Literal with an associated weight.
Definition: clingo.h:1511
uint32_t clingo_assignment_decision_level(clingo_assignment_t *assignment)
Get the current decision level.
Select false instead of true atoms (clingo_show_type_atoms) or terms (clingo_show_type_terms).
Definition: clingo.h:521
like clingo_clause_type_static but the clause is deleted after a solving step
Definition: clingo.h:1317
bool clingo_solve_control_thread_id(clingo_solve_control_t *control, clingo_id_t *id)
Get the id of the solver thread that found the model.
An instance of this struct has to be registered with a solver to implement a custom propagator...
Definition: clingo.h:1384
bool clingo_program_builder_begin(clingo_program_builder_t *builder)
Begin building a program.
bool clingo_symbol_is_negative(clingo_symbol_t symbol, bool *negative)
Check if a function is negative (has a sign).
bool clingo_symbol_create_id(char const *name, bool positive, clingo_symbol_t *symbol)
Construct a symbol representing an id.
same file included multiple times
Definition: clingo.h:127
a numeric symbol, e.g., 1
Definition: clingo.h:271
bool clingo_symbolic_atoms_begin(clingo_symbolic_atoms_t *atoms, clingo_signature_t const *signature, clingo_symbolic_atom_iterator_t *iterator)
Get a forward iterator to the beginning of the sequence of all symbolic atoms optionally restricted t...
bool clingo_signature_is_positive(clingo_signature_t signature)
Whether the signature is positive (is not classically negated).
Definition: clingo.h:2030
Definition: clingo.h:2432
int clingo_model_type_t
Corresponding type to clingo_model_type.
Definition: clingo.h:511
struct clingo_solve_control clingo_solve_control_t
Object to add clauses during search.
Definition: clingo.h:499
clingo_warning
Enumeration of warning codes.
Definition: clingo.h:123
to report multiple errors; a corresponding runtime error is raised later
Definition: clingo.h:125
unsigned clingo_show_type_bitset_t
Corresponding type to clingo_show_type.
Definition: clingo.h:524
The model represents a set of brave consequences.
Definition: clingo.h:507
bool clingo_symbol_string(clingo_symbol_t symbol, char const **string)
Get the string of a symbol.
struct clingo_program_builder clingo_program_builder_t
Object to build non-ground programs.
Definition: clingo.h:2537
allow an external to be assigned freely
Definition: clingo.h:1502
The last solve call found a solution.
Definition: clingo.h:637
the entry is an array
Definition: clingo.h:1642
int clingo_warning_t
Corresponding type to clingo_warning.
Definition: clingo.h:133
bool clingo_statistics_root(clingo_statistics_t *statistics, uint64_t *key)
Get the root key of the statistics.
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.
no truth value
Definition: clingo.h:156
Definition: clingo.h:2336
Definition: clingo.h:2144
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.
a numeric symbol, e.g., c, (1, "a"), or f(1,"a")
Definition: clingo.h:273
clingo_clause_type
Enumeration of clause types determining the lifetime of a clause.
Definition: clingo.h:1313
a number term, e.g., 42
Definition: clingo.h:976
undefined atom in program
Definition: clingo.h:126
successful API calls
Definition: clingo.h:99
Definition: clingo.h:2440
bool clingo_symbol_to_string(clingo_symbol_t symbol, char *string, size_t size)
Get the string representation of a symbol.
bool clingo_assignment_has_literal(clingo_assignment_t *assignment, clingo_literal_t literal)
Check if the given literal is part of a (partial) assignment.
Definition: clingo.h:2193
bool clingo_symbolic_atoms_next(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t iterator, clingo_symbolic_atom_iterator_t *next)
Get an iterator to the next element in the sequence of symbolic atoms.
bool clingo_propagate_init_symbolic_atoms(clingo_propagate_init_t *init, clingo_symbolic_atoms_t **atoms)
Get an object to inspect the symbolic atoms.
bool clingo_solve_iteratively_get(clingo_solve_iteratively_t *handle, clingo_solve_result_bitset_t *result)
Get the solve result.
bool clingo_theory_atoms_atom_has_guard(clingo_theory_atoms_t *atoms, clingo_id_t atom, bool *has_guard)
Whether the theory atom has a guard.
bool clingo_symbolic_atoms_end(clingo_symbolic_atoms_t *atoms, clingo_symbolic_atom_iterator_t *iterator)
Iterator pointing to the end of the sequence of symbolic atoms.
wrong usage of the clingo API or invalid input
Definition: clingo.h:100
the #inf symbol
Definition: clingo.h:270
bool clingo_symbol_is_positive(clingo_symbol_t symbol, bool *positive)
Check if a function is positive (does not have a sign).
struct clingo_configuration clingo_configuration_t
Handle for to the solver configuration.
Definition: clingo.h:1649
Definition: clingo.h:2457
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.
bool clingo_solve_async_get(clingo_solve_async_t *handle, clingo_solve_result_bitset_t *result)
Get the solve result.
size_t begin_line
the line where the location begins
Definition: clingo.h:170
Select all atoms.
Definition: clingo.h:517
int clingo_propagate_init_number_of_threads(clingo_propagate_init_t *init)
Get the number of threads used in subsequent solving.
Definition: clingo.h:2002
void clingo_symbol_create_supremum(clingo_symbol_t *symbol)
Construct a symbol representing #sup.
true
Definition: clingo.h:157
uint64_t clingo_symbol_t
Represents a symbol.
Definition: clingo.h:283