Clingo C API
C API for clingo providing high level functions to control grounding and solving.
Classes | Macros | Typedefs | Enumerations | Functions | Variables
clingo.h File Reference

Single header containing the whole clingo API. More...

Go to the source code of this file.

Classes

struct  clingo_weighted_literal
 A Literal with an associated weight. More...
 
struct  clingo_location
 Represents a source code location marking its beginnig and end. More...
 
struct  clingo_propagator
 An instance of this struct has to be registered with a solver to implement a custom propagator. More...
 
struct  clingo_ast_attribute_names
 Struct to map attributes to their string representation. More...
 
struct  clingo_ast_argument
 Struct to define an argument that consists of a name and a type. More...
 
struct  clingo_ast_constructor
 A lists of required attributes to construct an AST. More...
 
struct  clingo_ast_constructors
 Struct to map AST types to lists of required attributes to construct ASTs. More...
 
struct  clingo_ground_program_observer
 An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver. More...
 
struct  clingo_part
 Struct used to specify the program parts that have to be grounded. More...
 
struct  clingo_application
 This struct contains a set of functions to customize the clingo application. More...
 
struct  clingo_script
 Custom scripting language to run functions during grounding. More...
 

Macros

#define CLINGO_VISIBILITY_DEFAULT
 
#define CLINGO_VISIBILITY_PRIVATE
 
#define CLINGO_DEPRECATED
 
#define CLINGO_VERSION_MAJOR   5
 Major version number.
 
#define CLINGO_VERSION_MINOR   5
 Minor version number.
 
#define CLINGO_VERSION_REVISION   1
 Revision number.
 
#define CLINGO_VERSION   "5.5.1"
 String representation of version.
 

Typedefs

typedef int32_t clingo_literal_t
 Signed integer type used for aspif and solver literals.
 
typedef uint32_t clingo_atom_t
 Unsigned integer type used for aspif atoms.
 
typedef uint32_t clingo_id_t
 Unsigned integer type used in various places.
 
typedef int32_t clingo_weight_t
 Signed integer type for weights in sum aggregates and minimize constraints.
 
typedef struct clingo_weighted_literal clingo_weighted_literal_t
 A Literal with an associated weight.
 
typedef int clingo_error_t
 Corresponding type to clingo_error_e.
 
typedef int clingo_warning_t
 Corresponding type to clingo_warning_e.
 
typedef void(* clingo_logger_t) (clingo_warning_t code, char const *message, void *data)
 Callback to intercept warning messages. More...
 
typedef int clingo_truth_value_t
 Corresponding type to clingo_truth_value_e.
 
typedef struct clingo_location clingo_location_t
 Represents a source code location marking its beginnig and end. More...
 
typedef uint64_t clingo_signature_t
 Represents a predicate signature. More...
 
typedef int clingo_symbol_type_t
 Corresponding type to clingo_symbol_type.
 
typedef uint64_t clingo_symbol_t
 Represents a symbol. More...
 
typedef struct clingo_symbolic_atoms clingo_symbolic_atoms_t
 Object to inspect symbolic atoms in a program—the relevant Herbrand base gringo uses to instantiate programs. More...
 
typedef uint64_t clingo_symbolic_atom_iterator_t
 Object to iterate over symbolic atoms. More...
 
typedef bool(* clingo_symbol_callback_t) (clingo_symbol_t const *symbols, size_t symbols_size, void *data)
 Callback function to inject symbols. More...
 
typedef int clingo_theory_term_type_t
 Corresponding type to clingo_theory_term_type_e.
 
typedef struct clingo_theory_atoms clingo_theory_atoms_t
 Container that stores theory atoms, elements, and terms (see clingo_control_theory_atoms()).
 
typedef struct clingo_assignment clingo_assignment_t
 Represents a (partial) assignment of a particular solver. More...
 
typedef int clingo_propagator_check_mode_t
 Corresponding type to clingo_propagator_check_mode_e.
 
typedef int clingo_weight_constraint_type_t
 Corresponding type to clingo_weight_constraint_type_e.
 
typedef struct clingo_propagate_init clingo_propagate_init_t
 Object to initialize a user-defined propagator before each solving step. More...
 
typedef int clingo_clause_type_t
 Corresponding type to clingo_clause_type_e.
 
typedef struct clingo_propagate_control clingo_propagate_control_t
 This object can be used to add clauses and propagate literals while solving.
 
typedef bool(* clingo_propagator_init_callback_t) (clingo_propagate_init_t *, void *)
 Typedef for clingo_propagator::init().
 
typedef bool(* clingo_propagator_propagate_callback_t) (clingo_propagate_control_t *, clingo_literal_t const *, size_t, void *)
 Typedef for clingo_propagator::propagate().
 
typedef void(* clingo_propagator_undo_callback_t) (clingo_propagate_control_t const *, clingo_literal_t const *, size_t, void *)
 Typedef for clingo_propagator::undo().
 
typedef bool(* clingo_propagator_check_callback_t) (clingo_propagate_control_t *, void *)
 Typedef for clingo_propagator::check().
 
typedef struct clingo_propagator clingo_propagator_t
 An instance of this struct has to be registered with a solver to implement a custom propagator. More...
 
typedef int clingo_heuristic_type_t
 Corresponding type to clingo_heuristic_type_e.
 
typedef int clingo_external_type_t
 Corresponding type to clingo_external_type_e.
 
typedef struct clingo_backend clingo_backend_t
 Handle to the backend to add directives in aspif format.
 
typedef unsigned clingo_configuration_type_bitset_t
 Bitset for values of type clingo_configuration_type.
 
typedef struct clingo_configuration clingo_configuration_t
 Handle for to the solver configuration.
 
typedef int clingo_statistics_type_t
 Corresponding type to clingo_statistics_type.
 
typedef struct clingo_statistic clingo_statistics_t
 Handle for the solver statistics.
 
typedef struct clingo_solve_control clingo_solve_control_t
 Object to add clauses during search.
 
typedef struct clingo_model clingo_model_t
 Object representing a model.
 
typedef int clingo_model_type_t
 Corresponding type to clingo_model_type_e.
 
typedef unsigned clingo_show_type_bitset_t
 Corresponding type to clingo_show_type_e.
 
typedef unsigned clingo_solve_result_bitset_t
 Corresponding type to clingo_solve_result_e. More...
 
typedef unsigned clingo_solve_mode_bitset_t
 Corresponding type to clingo_solve_mode_e.
 
typedef unsigned clingo_solve_event_type_t
 Corresponding type to clingo_solve_event_type_e.
 
typedef 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. More...
 
typedef struct clingo_solve_handle clingo_solve_handle_t
 Search handle to a solve call. More...
 
typedef int clingo_ast_theory_sequence_type_t
 Corresponding type to clingo_ast_theory_sequence_type_e.
 
typedef int clingo_ast_comparison_operator_t
 Corresponding type to clingo_ast_comparison_operator_e.
 
typedef int clingo_ast_sign_t
 Corresponding type to clingo_ast_sign_t.
 
typedef int clingo_ast_unary_operator_t
 Corresponding type to clingo_ast_unary_operator_e.
 
typedef int clingo_ast_binary_operator_t
 Corresponding type to clingo_ast_binary_operator_e.
 
typedef int clingo_ast_aggregate_function_t
 Corresponding type to clingo_ast_aggregate_function_e.
 
typedef int clingo_ast_theory_operator_type_t
 Corresponding type to clingo_ast_theory_operator_type_e.
 
typedef int clingo_ast_theory_atom_definition_type_t
 Corresponding type to clingo_ast_theory_atom_definition_type_e.
 
typedef int clingo_ast_type_t
 Corresponding type to clingo_ast_type_e.
 
typedef int clingo_ast_attribute_type_t
 Corresponding type to clingo_ast_attribute_type.
 
typedef int clingo_ast_attribute_t
 Corresponding type to clingo_ast_attribute_e.
 
typedef struct clingo_ast_attribute_names clingo_ast_attribute_names_t
 Struct to map attributes to their string representation.
 
typedef struct clingo_ast_argument clingo_ast_argument_t
 Struct to define an argument that consists of a name and a type.
 
typedef struct clingo_ast_constructor clingo_ast_constructor_t
 A lists of required attributes to construct an AST.
 
typedef struct clingo_ast_constructors clingo_ast_constructors_t
 Struct to map AST types to lists of required attributes to construct ASTs.
 
typedef struct clingo_ast clingo_ast_t
 This struct provides a view to nodes in the AST.
 
typedef struct clingo_program_builder clingo_program_builder_t
 Object to build non-ground programs.
 
typedef 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 are passed to the solver. More...
 
typedef struct clingo_part clingo_part_t
 Struct used to specify the program parts that have to be grounded. More...
 
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)
 Callback function to implement external functions. More...
 
typedef struct clingo_control clingo_control_t
 Control object holding grounding and solving state.
 
typedef struct clingo_options clingo_options_t
 Object to add command-line options.
 
typedef bool(* clingo_main_function_t) (clingo_control_t *control, char const *const *files, size_t size, void *data)
 Callback to customize clingo main function. More...
 
typedef bool(* clingo_default_model_printer_t) (void *data)
 Callback to print a model in default format. More...
 
typedef 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. More...
 
typedef struct clingo_application clingo_application_t
 This struct contains a set of functions to customize the clingo application.
 
typedef struct clingo_script clingo_script_t
 Custom scripting language to run functions during grounding.
 

Enumerations

enum  clingo_error_e {
  clingo_error_success = 0, clingo_error_runtime = 1, clingo_error_logic = 2, clingo_error_bad_alloc = 3,
  clingo_error_unknown = 4
}
 Enumeration of error codes. More...
 
enum  clingo_warning_e {
  clingo_warning_operation_undefined = 0, clingo_warning_runtime_error = 1, clingo_warning_atom_undefined = 2, clingo_warning_file_included = 3,
  clingo_warning_variable_unbounded = 4, clingo_warning_global_variable = 5, clingo_warning_other = 6
}
 Enumeration of warning codes. More...
 
enum  clingo_truth_value_e { clingo_truth_value_free = 0, clingo_truth_value_true = 1, clingo_truth_value_false = 2 }
 Represents three-valued truth values. More...
 
enum  clingo_symbol_type_e {
  clingo_symbol_type_infimum = 0, clingo_symbol_type_number = 1, clingo_symbol_type_string = 4, clingo_symbol_type_function = 5,
  clingo_symbol_type_supremum = 7
}
 Enumeration of available symbol types. More...
 
enum  clingo_theory_term_type_e {
  clingo_theory_term_type_tuple = 0, clingo_theory_term_type_list = 1, clingo_theory_term_type_set = 2, clingo_theory_term_type_function = 3,
  clingo_theory_term_type_number = 4, clingo_theory_term_type_symbol = 5
}
 Enumeration of theory term types. More...
 
enum  clingo_propagator_check_mode_e { clingo_propagator_check_mode_none = 0, clingo_propagator_check_mode_total = 1, clingo_propagator_check_mode_fixpoint = 2, clingo_propagator_check_mode_both = 3 }
 Supported check modes for propagators. More...
 
enum  clingo_weight_constraint_type_e { clingo_weight_constraint_type_implication_left = -1, clingo_weight_constraint_type_implication_right = 1, clingo_weight_constraint_type_equivalence = 0 }
 Enumeration of weight_constraint_types. More...
 
enum  clingo_clause_type_e { clingo_clause_type_learnt = 0, clingo_clause_type_static = 1, clingo_clause_type_volatile = 2, clingo_clause_type_volatile_static = 3 }
 Enumeration of clause types determining the lifetime of a clause. More...
 
enum  clingo_heuristic_type_e {
  clingo_heuristic_type_level = 0, clingo_heuristic_type_sign = 1, clingo_heuristic_type_factor = 2, clingo_heuristic_type_init = 3,
  clingo_heuristic_type_true = 4, clingo_heuristic_type_false = 5
}
 Enumeration of different heuristic modifiers. More...
 
enum  clingo_external_type_e { clingo_external_type_free = 0, clingo_external_type_true = 1, clingo_external_type_false = 2, clingo_external_type_release = 3 }
 Enumeration of different external statements. More...
 
enum  clingo_configuration_type_e { clingo_configuration_type_value = 1, clingo_configuration_type_array = 2, clingo_configuration_type_map = 4 }
 Enumeration for entries of the configuration. More...
 
enum  clingo_statistics_type_e { clingo_statistics_type_empty = 0, clingo_statistics_type_value = 1, clingo_statistics_type_array = 2, clingo_statistics_type_map = 3 }
 Enumeration for entries of the statistics. More...
 
enum  clingo_model_type_e { clingo_model_type_stable_model = 0, clingo_model_type_brave_consequences = 1, clingo_model_type_cautious_consequences = 2 }
 Enumeration for the different model types. More...
 
enum  clingo_show_type_e {
  clingo_show_type_csp = 1, clingo_show_type_shown = 2, clingo_show_type_atoms = 4, clingo_show_type_terms = 8,
  clingo_show_type_theory = 16, clingo_show_type_all = 31, clingo_show_type_complement = 32
}
 Enumeration of bit flags to select symbols in models. More...
 
enum  clingo_solve_result_e { clingo_solve_result_satisfiable = 1, clingo_solve_result_unsatisfiable = 2, clingo_solve_result_exhausted = 4, clingo_solve_result_interrupted = 8 }
 Enumeration of bit masks for solve call results. More...
 
enum  clingo_solve_mode_e { clingo_solve_mode_async = 1, clingo_solve_mode_yield = 2 }
 Enumeration of solve modes. More...
 
enum  clingo_solve_event_type_e { clingo_solve_event_type_model = 0, clingo_solve_event_type_unsat = 1, clingo_solve_event_type_statistics = 2, clingo_solve_event_type_finish = 3 }
 Enumeration of solve events. More...
 
enum  clingo_ast_theory_sequence_type_e { clingo_ast_theory_sequence_type_tuple, clingo_ast_theory_sequence_type_list, clingo_ast_theory_sequence_type_set }
 Enumeration of theory sequence types. More...
 
enum  clingo_ast_comparison_operator_e {
  clingo_ast_comparison_operator_greater_than = 0, clingo_ast_comparison_operator_less_than = 1, clingo_ast_comparison_operator_less_equal = 2, clingo_ast_comparison_operator_greater_equal = 3,
  clingo_ast_comparison_operator_not_equal = 4, clingo_ast_comparison_operator_equal = 5
}
 Enumeration of comparison relations. More...
 
enum  clingo_ast_sign_e { clingo_ast_sign_no_sign = 0, clingo_ast_sign_negation = 1, clingo_ast_sign_double_negation = 2 }
 Enumeration of signs. More...
 
enum  clingo_ast_unary_operator_e { clingo_ast_unary_operator_minus = 0, clingo_ast_unary_operator_negation = 1, clingo_ast_unary_operator_absolute = 2 }
 Enumeration of unary operators. More...
 
enum  clingo_ast_binary_operator_e {
  clingo_ast_binary_operator_xor = 0, clingo_ast_binary_operator_or = 1, clingo_ast_binary_operator_and = 2, clingo_ast_binary_operator_plus = 3,
  clingo_ast_binary_operator_minus = 4, clingo_ast_binary_operator_multiplication = 5, clingo_ast_binary_operator_division = 6, clingo_ast_binary_operator_modulo = 7,
  clingo_ast_binary_operator_power = 8
}
 Enumeration of binary operators. More...
 
enum  clingo_ast_aggregate_function_e {
  clingo_ast_aggregate_function_count = 0, clingo_ast_aggregate_function_sum = 1, clingo_ast_aggregate_function_sump = 2, clingo_ast_aggregate_function_min = 3,
  clingo_ast_aggregate_function_max = 4
}
 Enumeration of aggregate functions. More...
 
enum  clingo_ast_theory_operator_type_e { clingo_ast_theory_operator_type_unary = 0, clingo_ast_theory_operator_type_binary_left = 1, clingo_ast_theory_operator_type_binary_right = 2 }
 Enumeration of theory operators. More...
 
enum  clingo_ast_theory_atom_definition_type_e { clingo_ast_theory_atom_definition_type_head = 0, clingo_ast_theory_atom_definition_type_body = 1, clingo_ast_theory_atom_definition_type_any = 2, clingo_ast_theory_atom_definition_type_directive = 3 }
 Enumeration of the theory atom types. More...
 
enum  clingo_ast_type_e {
  clingo_ast_type_id, clingo_ast_type_variable, clingo_ast_type_symbolic_term, clingo_ast_type_unary_operation,
  clingo_ast_type_binary_operation, clingo_ast_type_interval, clingo_ast_type_function, clingo_ast_type_pool,
  clingo_ast_type_csp_product, clingo_ast_type_csp_sum, clingo_ast_type_csp_guard, clingo_ast_type_boolean_constant,
  clingo_ast_type_symbolic_atom, clingo_ast_type_comparison, clingo_ast_type_csp_literal, clingo_ast_type_aggregate_guard,
  clingo_ast_type_conditional_literal, clingo_ast_type_aggregate, clingo_ast_type_body_aggregate_element, clingo_ast_type_body_aggregate,
  clingo_ast_type_head_aggregate_element, clingo_ast_type_head_aggregate, clingo_ast_type_disjunction, clingo_ast_type_disjoint_element,
  clingo_ast_type_disjoint, clingo_ast_type_theory_sequence, clingo_ast_type_theory_function, clingo_ast_type_theory_unparsed_term_element,
  clingo_ast_type_theory_unparsed_term, clingo_ast_type_theory_guard, clingo_ast_type_theory_atom_element, clingo_ast_type_theory_atom,
  clingo_ast_type_literal, clingo_ast_type_theory_operator_definition, clingo_ast_type_theory_term_definition, clingo_ast_type_theory_guard_definition,
  clingo_ast_type_theory_atom_definition, clingo_ast_type_rule, clingo_ast_type_definition, clingo_ast_type_show_signature,
  clingo_ast_type_show_term, clingo_ast_type_minimize, clingo_ast_type_script, clingo_ast_type_program,
  clingo_ast_type_external, clingo_ast_type_edge, clingo_ast_type_heuristic, clingo_ast_type_project_atom,
  clingo_ast_type_project_signature, clingo_ast_type_defined, clingo_ast_type_theory_definition
}
 Enumeration of AST types.
 
enum  clingo_ast_attribute_type_e {
  clingo_ast_attribute_type_number = 0, clingo_ast_attribute_type_symbol = 1, clingo_ast_attribute_type_location = 2, clingo_ast_attribute_type_string = 3,
  clingo_ast_attribute_type_ast = 4, clingo_ast_attribute_type_optional_ast = 5, clingo_ast_attribute_type_string_array = 6, clingo_ast_attribute_type_ast_array = 7
}
 Enumeration of attributes types used by the AST. More...
 
enum  clingo_ast_attribute_e {
  clingo_ast_attribute_argument, clingo_ast_attribute_arguments, clingo_ast_attribute_arity, clingo_ast_attribute_atom,
  clingo_ast_attribute_atoms, clingo_ast_attribute_atom_type, clingo_ast_attribute_bias, clingo_ast_attribute_body,
  clingo_ast_attribute_code, clingo_ast_attribute_coefficient, clingo_ast_attribute_comparison, clingo_ast_attribute_condition,
  clingo_ast_attribute_csp, clingo_ast_attribute_elements, clingo_ast_attribute_external, clingo_ast_attribute_external_type,
  clingo_ast_attribute_function, clingo_ast_attribute_guard, clingo_ast_attribute_guards, clingo_ast_attribute_head,
  clingo_ast_attribute_is_default, clingo_ast_attribute_left, clingo_ast_attribute_left_guard, clingo_ast_attribute_literal,
  clingo_ast_attribute_location, clingo_ast_attribute_modifier, clingo_ast_attribute_name, clingo_ast_attribute_node_u,
  clingo_ast_attribute_node_v, clingo_ast_attribute_operator_name, clingo_ast_attribute_operator_type, clingo_ast_attribute_operators,
  clingo_ast_attribute_parameters, clingo_ast_attribute_positive, clingo_ast_attribute_priority, clingo_ast_attribute_right,
  clingo_ast_attribute_right_guard, clingo_ast_attribute_sequence_type, clingo_ast_attribute_sign, clingo_ast_attribute_symbol,
  clingo_ast_attribute_term, clingo_ast_attribute_terms, clingo_ast_attribute_value, clingo_ast_attribute_variable,
  clingo_ast_attribute_weight
}
 Enumeration of attributes used by the AST.
 

Functions

CLINGO_VISIBILITY_DEFAULT char const * clingo_error_string (clingo_error_t code)
 Convert error code into string.
 
CLINGO_VISIBILITY_DEFAULT clingo_error_t clingo_error_code ()
 Get the last error code set by a clingo API call. More...
 
CLINGO_VISIBILITY_DEFAULT char const * clingo_error_message ()
 Get the last error message set if an API call fails. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT char const * clingo_warning_string (clingo_warning_t code)
 Convert warning code into string.
 
CLINGO_VISIBILITY_DEFAULT void clingo_version (int *major, int *minor, int *revision)
 Obtain the clingo version. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_add_string (char const *string, char const **result)
 Internalize a string. More...
 
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. More...
 
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. More...
 
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 to a given signature. More...
 
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. More...
 
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. More...
 
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). More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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 end of the sequence. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_begin (clingo_backend_t *backend)
 Prepare the backend for usage. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_end (clingo_backend_t *backend)
 Finalize the backend after using it. More...
 
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. More...
 
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. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_project (clingo_backend_t *backend, clingo_atom_t const *atoms, size_t size)
 Add a projection directive. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_external (clingo_backend_t *backend, clingo_atom_t atom, clingo_external_type_t type)
 Add an external statement. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_backend_assume (clingo_backend_t *backend, clingo_literal_t const *literals, size_t size)
 Add an assumption directive. More...
 
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. More...
 
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. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_root (clingo_configuration_t const *configuration, clingo_id_t *key)
 Get the root key of the configuration. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_configuration_type (clingo_configuration_t const *configuration, clingo_id_t key, clingo_configuration_type_bitset_t *type)
 Get the type of a key. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_root (clingo_statistics_t const *statistics, uint64_t *key)
 Get the root key of the statistics. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_type (clingo_statistics_t const *statistics, uint64_t key, clingo_statistics_type_t *type)
 Get the type of a key. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_get (clingo_solve_handle_t *handle, clingo_solve_result_bitset_t *result)
 Get the next solve result. More...
 
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. More...
 
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). More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_core (clingo_solve_handle_t *handle, clingo_literal_t const **core, size_t *size)
 When a problem is unsatisfiable, get a subset of the assumptions that made the problem unsatisfiable. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_cancel (clingo_solve_handle_t *handle)
 Stop the running search and block until done. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_solve_handle_close (clingo_solve_handle_t *handle)
 Stops the running search and releases the handle. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT void clingo_control_free (clingo_control_t *control)
 Free a control object created with clingo_control_new(). More...
 
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. More...
 
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. More...
 
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). More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_register_script (char const *name, clingo_script_t const *script, void *data)
 Add a custom scripting language to clingo. More...
 
CLINGO_VISIBILITY_DEFAULT char const * clingo_script_version (char const *name)
 Get the version of the registered scripting language. More...
 
Signature Functions
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_create (char const *name, uint32_t arity, bool positive, clingo_signature_t *signature)
 Create a new signature. More...
 
CLINGO_VISIBILITY_DEFAULT char const * clingo_signature_name (clingo_signature_t signature)
 Get the name of a signature. More...
 
CLINGO_VISIBILITY_DEFAULT uint32_t clingo_signature_arity (clingo_signature_t signature)
 Get the arity of a signature. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_positive (clingo_signature_t signature)
 Whether the signature is positive (is not classically negated). More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_negative (clingo_signature_t signature)
 Whether the signature is negative (is classically negated). More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_signature_is_equal_to (clingo_signature_t a, clingo_signature_t b)
 Check if two signatures are equal. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT size_t clingo_signature_hash (clingo_signature_t signature)
 Calculate a hash code of a signature. More...
 
Symbol Construction Functions
CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_number (int number, clingo_symbol_t *symbol)
 Construct a symbol representing a number. More...
 
CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_supremum (clingo_symbol_t *symbol)
 Construct a symbol representing #sup. More...
 
CLINGO_VISIBILITY_DEFAULT void clingo_symbol_create_infimum (clingo_symbol_t *symbol)
 Construct a symbol representing #inf. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_string (char const *string, clingo_symbol_t *symbol)
 Construct a symbol representing a string. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_create_id (char const *name, bool positive, clingo_symbol_t *symbol)
 Construct a symbol representing an id. More...
 
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. More...
 
Symbol Inspection Functions
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_number (clingo_symbol_t symbol, int *number)
 Get the number of a symbol. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_name (clingo_symbol_t symbol, char const **name)
 Get the name of a symbol. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_string (clingo_symbol_t symbol, char const **string)
 Get the string of a symbol. More...
 
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). More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_negative (clingo_symbol_t symbol, bool *negative)
 Check if a function is negative (has a sign). More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT clingo_symbol_type_t clingo_symbol_type (clingo_symbol_t symbol)
 Get the type of a symbol. More...
 
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). More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_to_string (clingo_symbol_t symbol, char *string, size_t size)
 Get the string representation of a symbol. More...
 
Symbol Comparison Functions
CLINGO_VISIBILITY_DEFAULT bool clingo_symbol_is_equal_to (clingo_symbol_t a, clingo_symbol_t b)
 Check if two symbols are equal. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT size_t clingo_symbol_hash (clingo_symbol_t symbol)
 Calculate a hash code of a symbol. More...
 
Theory Term Inspection
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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). More...
 
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. More...
 
Theory Element Inspection
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. More...
 
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. More...
 
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. More...
 
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). More...
 
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. More...
 
Theory Atom Inspection
CLINGO_VISIBILITY_DEFAULT bool clingo_theory_atoms_size (clingo_theory_atoms_t const *atoms, size_t *size)
 Get the total number of theory atoms. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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). More...
 
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. More...
 
Assignment Functions
CLINGO_VISIBILITY_DEFAULT uint32_t clingo_assignment_decision_level (clingo_assignment_t const *assignment)
 Get the current decision level. More...
 
CLINGO_VISIBILITY_DEFAULT uint32_t clingo_assignment_root_level (clingo_assignment_t const *assignment)
 Get the current root level. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_has_conflict (clingo_assignment_t const *assignment)
 Check if the given assignment is conflicting. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT size_t clingo_assignment_size (clingo_assignment_t const *assignment)
 The number of (positive) literals in the assignment. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_at (clingo_assignment_t const *assignment, size_t offset, clingo_literal_t *literal)
 The (positive) literal at the given offset in the assignment. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_is_total (clingo_assignment_t const *assignment)
 Check if the assignment is total, i.e. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_trail_size (clingo_assignment_t const *assignment, uint32_t *size)
 Returns the number of literals in the trail, i.e., the number of assigned literals. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_trail_begin (clingo_assignment_t const *assignment, uint32_t level, uint32_t *offset)
 Returns the offset of the decision literal with the given decision level in the trail. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_trail_end (clingo_assignment_t const *assignment, uint32_t level, uint32_t *offset)
 Returns the offset following the last literal with the given decision level. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_assignment_trail_at (clingo_assignment_t const *assignment, uint32_t offset, clingo_literal_t *literal)
 Returns the literal at the given position in the trail. More...
 
Initialization Functions
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. More...
 
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. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_remove_watch (clingo_propagate_init_t *init, clingo_literal_t solver_literal)
 Remove the watch for the solver literal in the given phase. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_remove_watch_from_thread (clingo_propagate_init_t *init, clingo_literal_t solver_literal, uint32_t thread_id)
 Remove the watch for the solver literal in the given phase from the given solver thread. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_freeze_literal (clingo_propagate_init_t *init, clingo_literal_t solver_literal)
 Freeze the given solver literal. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT clingo_assignment_t const * clingo_propagate_init_assignment (clingo_propagate_init_t const *init)
 Get the top level assignment solver. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_literal (clingo_propagate_init_t *init, bool freeze, clingo_literal_t *result)
 Add a literal to the solver. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_weight_constraint (clingo_propagate_init_t *init, clingo_literal_t literal, clingo_weighted_literal_t const *literals, size_t size, clingo_weight_t bound, clingo_weight_constraint_type_t type, bool compare_equal, bool *result)
 Add the given weight constraint to the solver. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_add_minimize (clingo_propagate_init_t *init, clingo_literal_t literal, clingo_weight_t weight, clingo_weight_t priority)
 Add the given literal to minimize to the solver. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_init_propagate (clingo_propagate_init_t *init, bool *result)
 Propagates consequences of the underlying problem excluding registered propagators. More...
 
Propagation Functions
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_propagate_control_propagate (clingo_propagate_control_t *control, bool *result)
 Propagate implied literals (resulting from added clauses). More...
 
Functions to access arrays
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Functions to access maps
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Functions to access values
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Functions to inspect and change values
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_statistics_value_set (clingo_statistics_t *statistics, uint64_t key, double value)
 Set the value of the given entry. More...
 
Functions for Inspecting Models
CLINGO_VISIBILITY_DEFAULT bool clingo_model_type (clingo_model_t const *model, clingo_model_type_t *type)
 Get the type of the model. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_model_number (clingo_model_t const *model, uint64_t *number)
 Get the running number of the model. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_model_optimality_proven (clingo_model_t const *model, bool *proven)
 Whether the optimality of a model has been proven. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_model_extend (clingo_model_t *model, clingo_symbol_t const *symbols, size_t size)
 Add symbols to the model. More...
 
Functions for Adding Clauses
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. More...
 
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. More...
 
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. More...
 
Functions to construct ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_build (clingo_ast_type_t type, clingo_ast_t **ast,...)
 Construct an AST of the given type. More...
 
Functions to manage life time of ASTs
CLINGO_VISIBILITY_DEFAULT void clingo_ast_acquire (clingo_ast_t *ast)
 Increment the reference count of an AST node. More...
 
CLINGO_VISIBILITY_DEFAULT void clingo_ast_release (clingo_ast_t *ast)
 Decrement the reference count of an AST node. More...
 
Functions to copy ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_copy (clingo_ast_t *ast, clingo_ast_t **copy)
 Deep copy an AST node. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_deep_copy (clingo_ast_t *ast, clingo_ast_t **copy)
 Create a shallow copy of an AST node. More...
 
Functions to compare ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_less_than (clingo_ast_t *a, clingo_ast_t *b)
 Less than compare two AST nodes. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_equal (clingo_ast_t *a, clingo_ast_t *b)
 Equality compare two AST nodes. More...
 
CLINGO_VISIBILITY_DEFAULT size_t clingo_ast_hash (clingo_ast_t *ast)
 Compute a hash for an AST node. More...
 
Functions to get convert ASTs to strings
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_to_string_size (clingo_ast_t *ast, size_t *size)
 Get the size of the string representation of an AST node. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_to_string (clingo_ast_t *ast, char *string, size_t size)
 Get the string representation of an AST node. More...
 
Functions to inspect ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_get_type (clingo_ast_t *ast, clingo_ast_type_t *type)
 Get the type of an AST node. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_has_attribute (clingo_ast_t *ast, clingo_ast_attribute_t attribute, bool *has_attribute)
 Check if an AST has the given attribute. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_type (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_attribute_type_t *type)
 Get the type of the given AST. More...
 
Functions to get/set numeric attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_number (clingo_ast_t *ast, clingo_ast_attribute_t attribute, int *value)
 Get the value of an attribute of type "clingo_ast_attribute_type_number". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_number (clingo_ast_t *ast, clingo_ast_attribute_t attribute, int value)
 Set the value of an attribute of type "clingo_ast_attribute_type_number". More...
 
Functions to get/set symbolic attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_symbol (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_symbol_t *value)
 Get the value of an attribute of type "clingo_ast_attribute_type_symbol". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_symbol (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_symbol_t value)
 Set the value of an attribute of type "clingo_ast_attribute_type_symbol". More...
 
Functions to get/set location attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_location (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_location_t *value)
 Get the value of an attribute of type "clingo_ast_attribute_type_location". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_location (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_location_t const *value)
 Set the value of an attribute of type "clingo_ast_attribute_type_location". More...
 
Functions to get/set string attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string (clingo_ast_t *ast, clingo_ast_attribute_t attribute, char const **value)
 Get the value of an attribute of type "clingo_ast_attribute_type_string". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_string (clingo_ast_t *ast, clingo_ast_attribute_t attribute, char const *value)
 Set the value of an attribute of type "clingo_ast_attribute_type_string". More...
 
Functions to get/set AST attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t **value)
 Get the value of an attribute of type "clingo_ast_attribute_type_ast". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t *value)
 Set the value of an attribute of type "clingo_ast_attribute_type_ast". More...
 
Functions to get/set optional AST attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_optional_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t **value)
 Get the value of an attribute of type "clingo_ast_attribute_type_optional_ast". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_optional_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t *value)
 Set the value of an attribute of type "clingo_ast_attribute_type_optional_ast". More...
 
Functions to get/set string array attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, char const **value)
 Get the value of an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, char const *value)
 Set the value of an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_delete_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index)
 Remove an element from an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_size_string_array (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t *size)
 Get the size of an attribute of type "clingo_ast_attribute_type_string_array". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_insert_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, char const *value)
 Insert a value into an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More...
 
Functions to get/set AST array attributes of ASTs
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, clingo_ast_t **value)
 Get the value of an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, clingo_ast_t *value)
 Set the value of an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_delete_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index)
 Remove an element from an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_size_ast_array (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t *size)
 Get the size of an attribute of type "clingo_ast_attribute_type_ast_array". More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_insert_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, clingo_ast_t *value)
 Insert a value into an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More...
 
Functions to add ASTs to logic programs
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_begin (clingo_program_builder_t *builder)
 Begin building a program. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_end (clingo_program_builder_t *builder)
 End building a program. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_add (clingo_program_builder_t *builder, clingo_ast_t *ast)
 Adds a statement to the program. More...
 
Grounding Functions
CLINGO_VISIBILITY_DEFAULT bool clingo_control_load (clingo_control_t *control, char const *file)
 Extend the logic program with a program in a file. More...
 
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. More...
 
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. More...
 
Solving Functions
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_cleanup (clingo_control_t *control)
 Clean up the domains of the grounding component using the solving component's top level assignment. More...
 
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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_release_external (clingo_control_t *control, clingo_literal_t literal)
 Release an external atom. More...
 
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. More...
 
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. More...
 
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. More...
 
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). More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_clasp_facade (clingo_control_t *control, void **clasp)
 Get low-level access to clasp. More...
 
Configuration Functions
CLINGO_VISIBILITY_DEFAULT bool clingo_control_configuration (clingo_control_t *control, clingo_configuration_t **configuration)
 Get a configuration object to change the solver configuration. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_set_enable_enumeration_assumption (clingo_control_t *control, bool enable)
 Configure how learnt constraints are handled during enumeration. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_get_enable_enumeration_assumption (clingo_control_t *control)
 Check whether the enumeration assumption is enabled. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_set_enable_cleanup (clingo_control_t *control, bool enable)
 Enable automatic cleanup after solving. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_get_enable_cleanup (clingo_control_t *control)
 Check whether automatic cleanup is enabled. More...
 
Program Inspection Functions
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
Program Modification Functions
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. More...
 
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. More...
 

Variables

CLINGO_VISIBILITY_DEFAULT clingo_ast_attribute_names_t g_clingo_ast_attribute_names
 A map from attributes to their string representation.
 
CLINGO_VISIBILITY_DEFAULT clingo_ast_constructors_t g_clingo_ast_constructors
 A map from AST types to their constructors. More...
 

Functions to construct ASTs from strings

typedef bool(* clingo_ast_callback_t) (clingo_ast_t *ast, void *data)
 Callback function to intercept AST nodes. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_string (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. More...
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_files (char const *const *files, size_t size, clingo_ast_callback_t callback, void *callback_data, clingo_logger_t logger, void *logger_data, unsigned message_limit)
 Parse the programs in the given list of files and return an abstract syntax tree for each statement via a callback. More...
 

Functions to unpool ASts

enum  clingo_ast_unpool_type_e { clingo_ast_unpool_type_condition = 1, clingo_ast_unpool_type_other = 2, clingo_ast_unpool_type_all = 3 }
 Enum to configure unpooling. More...
 
typedef int clingo_ast_unpool_type_bitset_t
 Corresponding type to clingo_ast_unpool_type_e.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_unpool (clingo_ast_t *ast, clingo_ast_unpool_type_bitset_t unpool_type, clingo_ast_callback_t callback, void *callback_data)
 Unpool the given AST. More...
 

Detailed Description

Single header containing the whole clingo API.

Author
Roland Kaminski