Clingo
Loading...
Searching...
No Matches
observe.h
1#ifndef CLINGO_OBSERVE_H
2#define CLINGO_OBSERVE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <clingo/base.h>
9#include <clingo/core.h>
10#include <clingo/shared.h>
11#include <clingo/symbol.h>
12
13typedef struct clingo_control clingo_control_t;
14
18
31
42typedef struct clingo_observer {
50 bool (*init_program)(bool incremental, void *data);
57 bool (*begin_step)(void *data);
67 bool (*end_step)(clingo_base_t const *base, void *data);
68
78 bool (*rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_literal_t const *body,
79 size_t body_size, void *data);
90 bool (*weight_rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_weight_t lower_bound,
91 clingo_weighted_literal_t const *body, size_t body_size, void *data);
99 bool (*minimize)(clingo_weight_t priority, clingo_weighted_literal_t const *literals, size_t size, void *data);
106 bool (*project)(clingo_atom_t const *atoms, size_t size, void *data);
113 bool (*external)(clingo_atom_t atom, clingo_external_type_t type, void *data);
121 bool (*assume)(clingo_literal_t const *literals, size_t size, void *data);
132 bool (*heuristic)(clingo_atom_t atom, clingo_heuristic_type_t type, int bias, unsigned priority,
133 clingo_literal_t const *condition, size_t size, void *data);
142 bool (*acyc_edge)(int node_u, int node_v, clingo_literal_t const *condition, size_t size, void *data);
144
156CLINGO_VISIBILITY_DEFAULT bool clingo_control_observe(clingo_control_t *control, clingo_observer_t const *observer,
157 void *data, bool preprocess);
158
166CLINGO_VISIBILITY_DEFAULT bool clingo_control_write_aspif(clingo_control_t *control, char const *path, size_t size,
168
170
171#ifdef __cplusplus
172}
173#endif
174
175#endif
struct clingo_base clingo_base_t
Object to inspect symbolic atoms in a program—the relevant Herbrand base gringo uses to instantiate p...
Definition base.h:70
uint32_t clingo_atom_t
Unsigned integer type used for aspif atoms.
Definition core.h:80
int32_t clingo_literal_t
Signed integer type used for aspif and solver literals.
Definition core.h:78
int32_t clingo_weight_t
Signed integer type for weights in sum aggregates and minimize constraints.
Definition core.h:84
CLINGO_VISIBILITY_DEFAULT bool clingo_control_observe(clingo_control_t *control, clingo_observer_t const *observer, void *data, bool preprocess)
Get an observer to inspect the ground program.
unsigned clingo_write_aspif_mode_t
Corresponding type to clingo_write_aspif_mode_e.
Definition observe.h:30
CLINGO_VISIBILITY_DEFAULT bool clingo_control_write_aspif(clingo_control_t *control, char const *path, size_t size, clingo_write_aspif_mode_t mode)
Write the current logic program in aspif format to a file.
clingo_write_aspif_mode_e
Available write modes for aspif files (bitset).
Definition observe.h:22
struct clingo_observer clingo_observer_t
An instance of this struct has to be registered with a solver to observe ground directives as they ar...
@ clingo_write_aspif_mode_preamble_auto
Write preamble for newly created files.
Definition observe.h:24
@ clingo_write_aspif_mode_symbols
Whether to write symbols in a structured format.
Definition observe.h:27
@ clingo_write_aspif_mode_preamble
Write preamble.
Definition observe.h:23
@ clingo_write_aspif_mode_preprocess
Whether to preprocess the program before writing.
Definition observe.h:26
@ clingo_write_aspif_mode_append
Append to an existing file (or create it).
Definition observe.h:25
int clingo_external_type_t
Corresponding type to clingo_external_type_e.
Definition shared.h:32
int clingo_heuristic_type_t
Corresponding type to clingo_heuristic_type_e.
Definition shared.h:22
An instance of this struct has to be registered with a solver to observe ground directives as they ar...
Definition observe.h:42
bool(* begin_step)(void *data)
Marks the beginning of a block of directives passed to the solver.
Definition observe.h:57
bool(* assume)(clingo_literal_t const *literals, size_t size, void *data)
Observe assumption directives passed to the solver.
Definition observe.h:121
bool(* end_step)(clingo_base_t const *base, void *data)
Marks the end of a block of directives passed to the solver.
Definition observe.h:67
bool(* init_program)(bool incremental, void *data)
Called once in the beginning.
Definition observe.h:50
bool(* heuristic)(clingo_atom_t atom, clingo_heuristic_type_t type, int bias, unsigned priority, clingo_literal_t const *condition, size_t size, void *data)
Observe heuristic directives passed to the solver.
Definition observe.h:132
bool(* project)(clingo_atom_t const *atoms, size_t size, void *data)
Observe projection directives passed to the solver.
Definition observe.h:106
bool(* rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_literal_t const *body, size_t body_size, void *data)
Observe rules passed to the solver.
Definition observe.h:78
bool(* external)(clingo_atom_t atom, clingo_external_type_t type, void *data)
Observe external statements passed to the solver.
Definition observe.h:113
bool(* minimize)(clingo_weight_t priority, clingo_weighted_literal_t const *literals, size_t size, void *data)
Observe minimize constraints (or weak constraints) passed to the solver.
Definition observe.h:99
bool(* acyc_edge)(int node_u, int node_v, clingo_literal_t const *condition, size_t size, void *data)
Observe edge directives passed to the solver.
Definition observe.h:142
bool(* weight_rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_weight_t lower_bound, clingo_weighted_literal_t const *body, size_t body_size, void *data)
Observe weight rules passed to the solver.
Definition observe.h:90
A literal with an associated weight.
Definition core.h:86