Clingo
Loading...
Searching...
No Matches
clingo_observer Struct Reference

An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver. More...

#include <observe.h>

Public Attributes

bool(* init_program )(bool incremental, void *data)
 Called once in the beginning.
 
bool(* begin_step )(void *data)
 Marks the beginning of a block of directives passed to the solver.
 
bool(* end_step )(clingo_base_t const *base, void *data)
 Marks the end of a block of directives passed to the solver.
 
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.
 
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.
 
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.
 
bool(* project )(clingo_atom_t const *atoms, size_t size, void *data)
 Observe projection directives passed to the solver.
 
bool(* external )(clingo_atom_t atom, clingo_external_type_t type, void *data)
 Observe external statements passed to the solver.
 
bool(* assume )(clingo_literal_t const *literals, size_t size, void *data)
 Observe assumption directives passed to the solver.
 
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.
 
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.
 

Detailed Description

An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver.

Note
This interface is closely modeled after the aspif format. For more information, please refer to the specification of the aspif format.

Not all callbacks have to be implemented and can be set to NULL if not needed. If one of the callbacks in the struct fails, inspection is stopped.

See also
clingo_control_register_observer()

Member Data Documentation

◆ acyc_edge

bool(* clingo_observer::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.

Parameters
[in]node_uthe start vertex of the edge
[in]node_vthe end vertex of the edge
[in]conditionthe condition under which the edge is part of the graph
[in]sizethe number of atoms in the condition
[in]datauser data for the callback
Returns
the result code

◆ assume

bool(* clingo_observer::assume) (clingo_literal_t const *literals, size_t size, void *data)

Observe assumption directives passed to the solver.

Parameters
[in]literalsthe literals to assume (positive literals are true and negative literals false for the next solve call)
[in]sizethe number of atoms
[in]datauser data for the callback
Returns
the result code

◆ begin_step

bool(* clingo_observer::begin_step) (void *data)

Marks the beginning of a block of directives passed to the solver.

See also
end_step
Parameters
[in]datauser data for the callback
Returns
the result code

◆ end_step

bool(* clingo_observer::end_step) (clingo_base_t const *base, void *data)

Marks the end of a block of directives passed to the solver.

This function is called before solving starts.

See also
begin_step
Parameters
[in]basethe base of the program
[in]datauser data for the callback
Returns
the result code

◆ external

bool(* clingo_observer::external) (clingo_atom_t atom, clingo_external_type_t type, void *data)

Observe external statements passed to the solver.

Parameters
[in]atomthe external atom
[in]typethe type of the external statement
[in]datauser data for the callback
Returns
the result code

◆ heuristic

bool(* clingo_observer::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.

Parameters
[in]atomthe target atom
[in]typethe type of the heuristic modification
[in]biasthe heuristic bias
[in]prioritythe heuristic priority
[in]conditionthe condition under which to apply the heuristic modification
[in]sizethe number of atoms in the condition
[in]datauser data for the callback
Returns
the result code

◆ init_program

bool(* clingo_observer::init_program) (bool incremental, void *data)

Called once in the beginning.

If the incremental flag is true, there can be multiple calls to clingo_control_solve().

Parameters
[in]incrementalwhether the program is incremental
[in]datauser data for the callback
Returns
the result code

◆ minimize

bool(* clingo_observer::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.

Parameters
[in]prioritythe priority of the constraint
[in]literalsthe weighted literals whose sum to minimize
[in]sizethe number of weighted literals
[in]datauser data for the callback
Returns
the result code

◆ project

bool(* clingo_observer::project) (clingo_atom_t const *atoms, size_t size, void *data)

Observe projection directives passed to the solver.

Parameters
[in]atomsthe atoms to project on
[in]sizethe number of atoms
[in]datauser data for the callback
Returns
the result code

◆ rule

bool(* clingo_observer::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.

Parameters
[in]choicedetermines if the head is a choice or a disjunction
[in]headthe head atoms
[in]head_sizethe number of atoms in the head
[in]bodythe body literals
[in]body_sizethe number of literals in the body
[in]datauser data for the callback
Returns
the result code

◆ weight_rule

bool(* clingo_observer::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.

Parameters
[in]choicedetermines if the head is a choice or a disjunction
[in]headthe head atoms
[in]head_sizethe number of atoms in the head
[in]lower_boundthe lower bound of the weight rule
[in]bodythe weighted body literals
[in]body_sizethe number of weighted literals in the body
[in]datauser data for the callback
Returns
the result code

The documentation for this struct was generated from the following file: