pub type clingo_ground_program_observer_t = clingo_ground_program_observer;
Expand 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, 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()

Aliased Type§

struct clingo_ground_program_observer_t {
Show 19 fields pub init_program: Option<unsafe extern "C" fn(_: bool, _: *mut c_void) -> bool>, pub begin_step: Option<unsafe extern "C" fn(_: *mut c_void) -> bool>, pub end_step: Option<unsafe extern "C" fn(_: *mut c_void) -> bool>, pub rule: Option<unsafe extern "C" fn(_: bool, _: *const u32, _: usize, _: *const i32, _: usize, _: *mut c_void) -> bool>, pub weight_rule: Option<unsafe extern "C" fn(_: bool, _: *const u32, _: usize, _: i32, _: *const clingo_weighted_literal, _: usize, _: *mut c_void) -> bool>, pub minimize: Option<unsafe extern "C" fn(_: i32, _: *const clingo_weighted_literal, _: usize, _: *mut c_void) -> bool>, pub project: Option<unsafe extern "C" fn(_: *const u32, _: usize, _: *mut c_void) -> bool>, pub output_atom: Option<unsafe extern "C" fn(_: u64, _: u32, _: *mut c_void) -> bool>, pub output_term: Option<unsafe extern "C" fn(_: u64, _: *const i32, _: usize, _: *mut c_void) -> bool>, pub external: Option<unsafe extern "C" fn(_: u32, _: i32, _: *mut c_void) -> bool>, pub assume: Option<unsafe extern "C" fn(_: *const i32, _: usize, _: *mut c_void) -> bool>, pub heuristic: Option<unsafe extern "C" fn(_: u32, _: i32, _: i32, _: u32, _: *const i32, _: usize, _: *mut c_void) -> bool>, pub acyc_edge: Option<unsafe extern "C" fn(_: i32, _: i32, _: *const i32, _: usize, _: *mut c_void) -> bool>, pub theory_term_number: Option<unsafe extern "C" fn(_: u32, _: i32, _: *mut c_void) -> bool>, pub theory_term_string: Option<unsafe extern "C" fn(_: u32, _: *const i8, _: *mut c_void) -> bool>, pub theory_term_compound: Option<unsafe extern "C" fn(_: u32, _: i32, _: *const u32, _: usize, _: *mut c_void) -> bool>, pub theory_element: Option<unsafe extern "C" fn(_: u32, _: *const u32, _: usize, _: *const i32, _: usize, _: *mut c_void) -> bool>, pub theory_atom: Option<unsafe extern "C" fn(_: u32, _: u32, _: *const u32, _: usize, _: *mut c_void) -> bool>, pub theory_atom_with_guard: Option<unsafe extern "C" fn(_: u32, _: u32, _: *const u32, _: usize, _: u32, _: u32, _: *mut c_void) -> bool>,
}

Fields§

§init_program: Option<unsafe extern "C" fn(_: bool, _: *mut c_void) -> bool>

! Called once in the beginning. ! ! If the incremental flag is true, there can be multiple calls to @ref clingo_control_solve(). ! ! @param[in] incremental whether the program is incremental ! @param[in] data user data for the callback ! @return whether the call was successful

§begin_step: Option<unsafe extern "C" fn(_: *mut c_void) -> bool>

! Marks the beginning of a block of directives passed to the solver. ! ! @see @ref end_step ! ! @param[in] data user data for the callback ! @return whether the call was successful

§end_step: Option<unsafe extern "C" fn(_: *mut c_void) -> bool>

! Marks the end of a block of directives passed to the solver. ! ! This function is called before solving starts. ! ! @see @ref begin_step ! ! @param[in] data user data for the callback ! @return whether the call was successful

§rule: Option<unsafe extern "C" fn(_: bool, _: *const u32, _: usize, _: *const i32, _: usize, _: *mut c_void) -> bool>

! Observe rules passed to the solver. ! ! @param[in] choice determines if the head is a choice or a disjunction ! @param[in] head the head atoms ! @param[in] head_size the number of atoms in the head ! @param[in] body the body literals ! @param[in] body_size the number of literals in the body ! @param[in] data user data for the callback ! @return whether the call was successful

§weight_rule: Option<unsafe extern "C" fn(_: bool, _: *const u32, _: usize, _: i32, _: *const clingo_weighted_literal, _: usize, _: *mut c_void) -> bool>

! Observe weight rules passed to the solver. ! ! @param[in] choice determines if the head is a choice or a disjunction ! @param[in] head the head atoms ! @param[in] head_size the number of atoms in the head ! @param[in] lower_bound the lower bound of the weight rule ! @param[in] body the weighted body literals ! @param[in] body_size the number of weighted literals in the body ! @param[in] data user data for the callback ! @return whether the call was successful

§minimize: Option<unsafe extern "C" fn(_: i32, _: *const clingo_weighted_literal, _: usize, _: *mut c_void) -> bool>

! Observe minimize constraints (or weak constraints) passed to the solver. ! ! @param[in] priority the priority of the constraint ! @param[in] literals the weighted literals whose sum to minimize ! @param[in] size the number of weighted literals ! @param[in] data user data for the callback ! @return whether the call was successful

§project: Option<unsafe extern "C" fn(_: *const u32, _: usize, _: *mut c_void) -> bool>

! Observe projection directives passed to the solver. ! ! @param[in] atoms the atoms to project on ! @param[in] size the number of atoms ! @param[in] data user data for the callback ! @return whether the call was successful

§output_atom: Option<unsafe extern "C" fn(_: u64, _: u32, _: *mut c_void) -> bool>

! 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. ! ! @param[in] symbol the symbolic representation of the atom ! @param[in] atom the aspif atom (0 for facts) ! @param[in] data user data for the callback ! @return whether the call was successful

§output_term: Option<unsafe extern "C" fn(_: u64, _: *const i32, _: usize, _: *mut c_void) -> bool>

! Observe shown terms passed to the solver. ! ! @param[in] symbol the symbolic representation of the term ! @param[in] condition the literals of the condition ! @param[in] size the size of the condition ! @param[in] data user data for the callback ! @return whether the call was successful

§external: Option<unsafe extern "C" fn(_: u32, _: i32, _: *mut c_void) -> bool>

! Observe external statements passed to the solver. ! ! @param[in] atom the external atom ! @param[in] type the type of the external statement ! @param[in] data user data for the callback ! @return whether the call was successful

§assume: Option<unsafe extern "C" fn(_: *const i32, _: usize, _: *mut c_void) -> bool>

! Observe assumption directives passed to the solver. ! ! @param[in] literals the literals to assume (positive literals are true and negative literals false for the next solve call) ! @param[in] size the number of atoms ! @param[in] data user data for the callback ! @return whether the call was successful

§heuristic: Option<unsafe extern "C" fn(_: u32, _: i32, _: i32, _: u32, _: *const i32, _: usize, _: *mut c_void) -> bool>

! Observe heuristic directives passed to the solver. ! ! @param[in] atom the target atom ! @param[in] type the type of the heuristic modification ! @param[in] bias the heuristic bias ! @param[in] priority the heuristic priority ! @param[in] condition the condition under which to apply the heuristic modification ! @param[in] size the number of atoms in the condition ! @param[in] data user data for the callback ! @return whether the call was successful

§acyc_edge: Option<unsafe extern "C" fn(_: i32, _: i32, _: *const i32, _: usize, _: *mut c_void) -> bool>

! Observe edge directives passed to the solver. ! ! @param[in] node_u the start vertex of the edge ! @param[in] node_v the end vertex of the edge ! @param[in] condition the condition under which the edge is part of the graph ! @param[in] size the number of atoms in the condition ! @param[in] data user data for the callback ! @return whether the call was successful

§theory_term_number: Option<unsafe extern "C" fn(_: u32, _: i32, _: *mut c_void) -> bool>

! Observe numeric theory terms. ! ! @param[in] term_id the id of the term ! @param[in] number the value of the term ! @param[in] data user data for the callback ! @return whether the call was successful

§theory_term_string: Option<unsafe extern "C" fn(_: u32, _: *const i8, _: *mut c_void) -> bool>

! Observe string theory terms. ! ! @param[in] term_id the id of the term ! @param[in] name the value of the term ! @param[in] data user data for the callback ! @return whether the call was successful

§theory_term_compound: Option<unsafe extern "C" fn(_: u32, _: i32, _: *const u32, _: usize, _: *mut c_void) -> bool>

! 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) ! ! @param[in] term_id the id of the term ! @param[in] name_id_or_type the name or type of the term ! @param[in] arguments the arguments of the term ! @param[in] size the number of arguments ! @param[in] data user data for the callback ! @return whether the call was successful

§theory_element: Option<unsafe extern "C" fn(_: u32, _: *const u32, _: usize, _: *const i32, _: usize, _: *mut c_void) -> bool>

! Observe theory elements. ! ! @param element_id the id of the element ! @param terms the term tuple of the element ! @param terms_size the number of terms in the tuple ! @param condition the condition of the elemnt ! @param condition_size the number of literals in the condition ! @param[in] data user data for the callback ! @return whether the call was successful

§theory_atom: Option<unsafe extern "C" fn(_: u32, _: u32, _: *const u32, _: usize, _: *mut c_void) -> bool>

! Observe theory atoms without guard. ! ! @param[in] atom_id_or_zero the id of the atom or zero for directives ! @param[in] term_id the term associated with the atom ! @param[in] elements the elements of the atom ! @param[in] size the number of elements ! @param[in] data user data for the callback ! @return whether the call was successful

§theory_atom_with_guard: Option<unsafe extern "C" fn(_: u32, _: u32, _: *const u32, _: usize, _: u32, _: u32, _: *mut c_void) -> bool>

! Observe theory atoms with guard. ! ! @param[in] atom_id_or_zero the id of the atom or zero for directives ! @param[in] term_id the term associated with the atom ! @param[in] elements the elements of the atom ! @param[in] size the number of elements ! @param[in] operator_id the id of the operator (a string term) ! @param[in] right_hand_side_id the id of the term on the right hand side of the atom ! @param[in] data user data for the callback ! @return whether the call was successful