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
init_program: Option<unsafe extern "C" fn(incremental: bool, data: *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().
Parameters:
incremental
- whether the program is incrementaldata
- user data for the callback
Returns whether the call was successful
begin_step: Option<unsafe extern "C" fn(data: *mut c_void) -> bool>
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
end_step: Option<unsafe extern "C" fn(data: *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
Parameters:
data
- user data for the callback
Returns whether the call was successful
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>
Observe rules passed to the solver.
Parameters:
choice
- determines if the head is a choice or a disjunctionhead
- the head atomshead_size
- the number of atoms in the headbody
- the body literalsbody_size
- the number of literals in the bodydata
- user data for the callback
Returns whether the call was successful
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>
Observe weight rules passed to the solver.
Parameters:
choice
- determines if the head is a choice or a disjunctionhead
- the head atomshead_size
- the number of atoms in the headlower_bound
- the lower bound of the weight rulebody
- the weighted body literalsbody_size
- the number of weighted literals in the bodydata
- user data for the callback
Returns whether the call was successful
minimize: Option<unsafe extern "C" fn(priority: clingo_weight_t, literals: *const clingo_weighted_literal_t, size: usize, data: *mut c_void) -> bool>
Observe minimize constraints (or weak constraints) passed to the solver.
Parameters:
priority
- the priority of the constraintliterals
- the weighted literals whose sum to minimizesize
- the number of weighted literalsdata
- user data for the callback
Returns whether the call was successful
project: Option<unsafe extern "C" fn(atoms: *const clingo_atom_t, size: usize, data: *mut c_void) -> bool>
Observe projection directives passed to the solver.
Parameters:
atoms
- the atoms to project onsize
- the number of atomsdata
- user data for the callback
Returns whether the call was successful
output_atom: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, atom: clingo_atom_t, data: *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.
Parameters:
symbol
- the symbolic representation of the atomatom
- the aspif atom (0 for facts)data
- user data for the callback
Returns whether the call was successful
output_term: Option<unsafe extern "C" fn(symbol: clingo_symbol_t, condition: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>
Observe shown terms passed to the solver.
Parameters:
symbol
- the symbolic representation of the termcondition
- the literals of the conditionsize
- the size of the conditiondata
- user data for the callback
Returns whether the call was successful
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>
Observe shown csp variables passed to the solver.
Parameters:
symbol
- the symbolic representation of the variablevalue
- the value of the variablecondition
- the literals of the conditionsize
- the size of the conditiondata
- user data for the callback
Returns whether the call was successful
external: Option<unsafe extern "C" fn(atom: clingo_atom_t, type_: clingo_external_type_t, data: *mut c_void) -> bool>
Observe external statements passed to the solver.
Parameters:
atom
- the external atomtype
- the type of the external statementdata
- user data for the callback
Returns whether the call was successful
assume: Option<unsafe extern "C" fn(literals: *const clingo_literal_t, size: usize, data: *mut c_void) -> bool>
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 atomsdata
- user data for the callback
Returns whether the call was successful
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>
Observe heuristic directives passed to the solver.
Parameters:
atom
- the target atomtype
- the type of the heuristic modificationbias
- the heuristic biaspriority
- the heuristic prioritycondition
- the condition under which to apply the heuristic modificationsize
- the number of atoms in the conditiondata
- user data for the callback
Returns whether the call was successful
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>
Observe edge directives passed to the solver.
Parameters:
node_u
- the start vertex of the edgenode_v
- the end vertex of the edgecondition
- the condition under which the edge is part of the graphsize
- the number of atoms in the conditiondata
- user data for the callback
Returns whether the call was successful
theory_term_number: Option<unsafe extern "C" fn(term_id: clingo_id_t, number: c_int, data: *mut c_void) -> bool>
Observe numeric theory terms.
Parameters:
term_id
- the id of the termnumber
- the value of the termdata
- user data for the callback
Returns whether the call was successful
theory_term_string: Option<unsafe extern "C" fn(term_id: clingo_id_t, name: *const c_char, data: *mut c_void) -> bool>
Observe string theory terms.
Parameters:
term_id
- the id of the termname
- the value of the termdata
- user data for the callback
Returns whether the call was successful
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>
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 termname_id_or_type
- the name or type of the termarguments
- the arguments of the termsize
- the number of argumentsdata
- user data for the callback
Returns whether the call was successful
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>
Observe theory elements.
Parameters:
element_id
- the id of the elementterms
- the term tuple of the elementterms_size
- the number of terms in the tuplecondition
- the condition of the elemntcondition_size
- the number of literals in the conditiondata
- user data for the callback
Returns whether the call was successful
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>
Observe theory atoms without guard.
Parameters:
atom_id_or_zero
- the id of the atom or zero for directivesterm_id
- the term associated with the atomelements
- the elements of the atomsize
- the number of elementsdata
- user data for the callback
Returns whether the call was successful
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>
Observe theory atoms with guard.
Parameters:
atom_id_or_zero
- the id of the atom or zero for directivesterm_id
- the term associated with the atomelements
- the elements of the atomsize
- the number of elementsoperator_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 atomdata
- user data for the callback
Returns whether the call was successful
Trait Implementations
impl Debug for clingo_ground_program_observer
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[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]
fn clone(&self) -> clingo_ground_program_observer
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more