Clingo
Loading...
Searching...
No Matches
observe.h
1#ifndef CLINGO_OBSERVE_H
2#define CLINGO_OBSERVE_H
3
4#include <clingo/base.h>
5#include <clingo/core.h>
6#include <clingo/shared.h>
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12typedef struct clingo_control clingo_control_t;
13
17
30
41typedef struct clingo_observer {
49 bool (*init_program)(bool incremental, void *data);
56 bool (*begin_step)(void *data);
66 bool (*end_step)(clingo_base_t const *base, void *data);
67
77 bool (*rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_literal_t const *body,
78 size_t body_size, void *data);
89 bool (*weight_rule)(bool choice, clingo_atom_t const *head, size_t head_size, clingo_weight_t lower_bound,
90 clingo_weighted_literal_t const *body, size_t body_size, void *data);
98 bool (*minimize)(clingo_weight_t priority, clingo_weighted_literal_t const *literals, size_t size, void *data);
105 bool (*project)(clingo_atom_t const *atoms, size_t size, void *data);
112 bool (*external)(clingo_atom_t atom, clingo_external_type_t type, void *data);
120 bool (*assume)(clingo_literal_t const *literals, size_t size, void *data);
131 bool (*heuristic)(clingo_atom_t atom, clingo_heuristic_type_t type, int bias, unsigned priority,
132 clingo_literal_t const *condition, size_t size, void *data);
141 bool (*acyc_edge)(int node_u, int node_v, clingo_literal_t const *condition, size_t size, void *data);
143
155CLINGO_VISIBILITY_DEFAULT bool clingo_control_observe(clingo_control_t *control, clingo_observer_t const *observer,
156 void *data, bool preprocess);
157
172CLINGO_VISIBILITY_DEFAULT bool clingo_control_write_aspif(clingo_control_t *control, char const *path, size_t size,
174
176
177#ifdef __cplusplus
178}
179#endif
180
181#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:75
int32_t clingo_literal_t
Signed integer type used for aspif and solver literals.
Definition core.h:73
int32_t clingo_weight_t
Signed integer type for weights in sum aggregates and minimize constraints.
Definition core.h:79
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:29
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:21
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:23
@ clingo_write_aspif_mode_symbols
Whether to write symbols in a structured format.
Definition observe.h:26
@ clingo_write_aspif_mode_preamble
Write preamble.
Definition observe.h:22
@ clingo_write_aspif_mode_preprocess
Whether to preprocess the program before writing.
Definition observe.h:25
@ clingo_write_aspif_mode_append
Append to an existing file (or create it).
Definition observe.h:24
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:41
bool(* begin_step)(void *data)
Marks the beginning of a block of directives passed to the solver.
Definition observe.h:56
bool(* assume)(clingo_literal_t const *literals, size_t size, void *data)
Observe assumption directives passed to the solver.
Definition observe.h:120
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:66
bool(* init_program)(bool incremental, void *data)
Called once in the beginning.
Definition observe.h:49
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:131
bool(* project)(clingo_atom_t const *atoms, size_t size, void *data)
Observe projection directives passed to the solver.
Definition observe.h:105
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:77
bool(* external)(clingo_atom_t atom, clingo_external_type_t type, void *data)
Observe external statements passed to the solver.
Definition observe.h:112
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:98
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:141
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:89
A literal with an associated weight.
Definition core.h:81