Struct clingo_sys::clingo_ground_program_observer [] [src]

#[repr(C)]
pub struct clingo_ground_program_observer { pub init_program: Option<unsafe extern "C" fn(incremental: bool, data: *mut c_void) -> bool>, pub begin_step: Option<unsafe extern "C" fn(data: *mut c_void) -> bool>, pub end_step: Option<unsafe extern "C" fn(data: *mut c_void) -> bool>, pub rule: Option<unsafe extern "C" fn(choice: bool, head: *const clingo_atom_t, head_size: usize, body: *const clingo_literal_t, body_size: usize, data: *mut c_void) -> bool>, pub weight_rule: Option<unsafe extern "C" fn(choice: bool, head: *const clingo_atom_t, head_size: usize, lower_bound: clingo_weight_t, body: *const clingo_weighted_literal_t, body_size: usize, data: *mut c_void) -> bool>, pub minimize: Option<unsafe extern "C" fn(priority: clingo_weight_t, literals: *const clingo_weighted_literal_t, size: usize, data: *mut c_void) -> bool>, pub project: Option<unsafe extern "C" fn(atoms: *const clingo_atom_t, size: usize, data: *mut c_void) -> bool>, pub output_atom: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, atom: clingo_atom_t, data: *mut c_void) -> bool>, pub output_term: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>, pub output_csp: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, value: c_int, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>, pub external: Option<unsafe extern "C" fn(atom: clingo_atom_t, type_: clingo_external_type_t, data: *mut c_void) -> bool>, pub assume: Option<unsafe extern "C" fn(literals: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>, pub heuristic: Option<unsafe extern "C" fn(atom: clingo_atom_t, type_: clingo_heuristic_type_t, bias: c_int, priority: c_uint, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>, pub acyc_edge: Option<unsafe extern "C" fn(node_u: c_int, node_v: c_int, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>, pub theory_term_number: Option<unsafe extern "C" fn(term_id: clingo_id_t, number: c_int, data: *mut c_void) -> bool>, pub theory_term_string: Option<unsafe extern "C" fn(term_id: clingo_id_t, name: *const c_char, data: *mut c_void) -> bool>, pub theory_term_compound: Option<unsafe extern "C" fn(term_id: clingo_id_t, name_id_or_type: c_int, arguments: *const clingo_id_t, size: usize, data: *mut c_void) -> bool>, pub theory_element: Option<unsafe extern "C" fn(element_id: clingo_id_t, terms: *const clingo_id_t, terms_size: usize, condition: *const clingo_literal_t, condition_size: usize, data: *mut c_void) -> bool>, pub theory_atom: Option<unsafe extern "C" fn(atom_id_or_zero: clingo_id_t, term_id: clingo_id_t, elements: *const clingo_id_t, size: usize, data: *mut c_void) -> bool>, pub theory_atom_with_guard: Option<unsafe extern "C" fn(atom_id_or_zero: clingo_id_t, term_id: clingo_id_t, elements: *const clingo_id_t, size: usize, operator_id: clingo_id_t, right_hand_side_id: clingo_id_t, data: *mut c_void) -> bool>, }

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, grounding is stopped. If a non-recoverable clingo API call fails, a callback must return false. Otherwise ::clingo_error_unknown should be set and false returned.

@see clingo_control_register_observer()

Fields

Called once in the beginning.

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

Parameters:

  • incremental - whether the program is incremental
  • data - user data for the callback

Returns whether the call was successful

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

@see @ref end_step

Parameters:

  • data - user data for the callback

Returns whether the call was successful

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

This function is called before solving starts.

@see @ref begin_step

Parameters:

  • data - user data for the callback

Returns whether the call was successful

Observe rules passed to the solver.

Parameters:

  • choice - determines if the head is a choice or a disjunction
  • head - the head atoms
  • head_size - the number of atoms in the head
  • body - the body literals
  • body_size - the number of literals in the body
  • data - user data for the callback

Returns whether the call was successful

Observe weight rules passed to the solver.

Parameters:

  • choice - determines if the head is a choice or a disjunction
  • head - the head atoms
  • head_size - the number of atoms in the head
  • lower_bound - the lower bound of the weight rule
  • body - the weighted body literals
  • body_size - the number of weighted literals in the body
  • data - user data for the callback

Returns whether the call was successful

Observe minimize constraints (or weak constraints) passed to the solver.

Parameters:

  • priority - the priority of the constraint
  • literals - the weighted literals whose sum to minimize
  • size - the number of weighted literals
  • data - user data for the callback

Returns whether the call was successful

Observe projection directives passed to the solver.

Parameters:

  • atoms - the atoms to project on
  • size - the number of atoms
  • data - user data for the callback

Returns whether the call was successful

Observe shown atoms passed to the solver. \note Facts do not have an associated aspif atom. The value of the atom is set to zero.

Parameters:

  • symbol - the symbolic representation of the atom
  • atom - the aspif atom (0 for facts)
  • data - user data for the callback

Returns whether the call was successful

Observe shown terms passed to the solver.

Parameters:

  • symbol - the symbolic representation of the term
  • condition - the literals of the condition
  • size - the size of the condition
  • data - user data for the callback

Returns whether the call was successful

Observe shown csp variables passed to the solver.

Parameters:

  • symbol - the symbolic representation of the variable
  • value - the value of the variable
  • condition - the literals of the condition
  • size - the size of the condition
  • data - user data for the callback

Returns whether the call was successful

Observe external statements passed to the solver.

Parameters:

  • atom - the external atom
  • type - the type of the external statement
  • data - user data for the callback

Returns whether the call was successful

Observe assumption directives passed to the solver.

Parameters:

  • literals - the literals to assume (positive literals are true and negative literals false for the next solve call)
  • size - the number of atoms
  • data - user data for the callback

Returns whether the call was successful

Observe heuristic directives passed to the solver.

Parameters:

  • atom - the target atom
  • type - the type of the heuristic modification
  • bias - the heuristic bias
  • priority - the heuristic priority
  • condition - the condition under which to apply the heuristic modification
  • size - the number of atoms in the condition
  • data - user data for the callback

Returns whether the call was successful

Observe edge directives passed to the solver.

Parameters:

  • node_u - the start vertex of the edge
  • node_v - the end vertex of the edge
  • condition - the condition under which the edge is part of the graph
  • size - the number of atoms in the condition
  • data - user data for the callback

Returns whether the call was successful

Observe numeric theory terms.

Parameters:

  • term_id - the id of the term
  • number - the value of the term
  • data - user data for the callback

Returns whether the call was successful

Observe string theory terms.

Parameters:

  • term_id - the id of the term
  • name - the value of the term
  • data - user data for the callback

Returns whether the call was successful

Observe compound theory terms.

The name_id_or_type gives the type of the compound term:

  • if it is -1, then it is a tuple
  • if it is -2, then it is a set
  • if it is -3, then it is a list
  • otherwise, it is a function and name_id_or_type refers to the id of the name (in form of a string term)

Parameters:

  • term_id - the id of the term
  • name_id_or_type - the name or type of the term
  • arguments - the arguments of the term
  • size - the number of arguments
  • data - user data for the callback

Returns whether the call was successful

Observe theory elements.

Parameters:

  • element_id - the id of the element
  • terms - the term tuple of the element
  • terms_size - the number of terms in the tuple
  • condition - the condition of the elemnt
  • condition_size - the number of literals in the condition
  • data - user data for the callback

Returns whether the call was successful

Observe theory atoms without guard.

Parameters:

  • atom_id_or_zero - the id of the atom or zero for directives
  • term_id - the term associated with the atom
  • elements - the elements of the atom
  • size - the number of elements
  • data - user data for the callback

Returns whether the call was successful

Observe theory atoms with guard.

Parameters:

  • atom_id_or_zero - the id of the atom or zero for directives
  • term_id - the term associated with the atom
  • elements - the elements of the atom
  • size - the number of elements
  • operator_id - the id of the operator (a string term)
  • right_hand_side_id - the id of the term on the right hand side of the atom
  • data - user data for the callback

Returns whether the call was successful

Trait Implementations

impl Debug for clingo_ground_program_observer
[src]

[src]

Formats the value using the given formatter. Read more

impl Copy for clingo_ground_program_observer
[src]

impl Clone for clingo_ground_program_observer
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations