Trait clingo::GroundProgramObserver
[−]
[src]
pub trait GroundProgramObserver { fn init_program(&mut self, incremental: bool) -> bool; fn begin_step(&mut self) -> bool; fn end_step(&mut self) -> bool; fn rule(&mut self, choice: bool, head: &[Atom], body: &[Literal]) -> bool; fn weight_rule(
&mut self,
choice: bool,
head: &[Atom],
lower_bound: i32,
body: &[WeightedLiteral]
) -> bool; fn minimize(&mut self, priority: i32, literals: &[WeightedLiteral]) -> bool; fn project(&mut self, atoms: &[Atom]) -> bool; fn output_atom(&mut self, symbol: Symbol, atom: Atom) -> bool; fn output_term(&mut self, symbol: Symbol, condition: &[Literal]) -> bool; fn output_csp(
&mut self,
symbol: Symbol,
value: i32,
condition: &[Literal]
) -> bool; fn external(&mut self, atom: Atom, type_: ExternalType) -> bool; fn assume(&mut self, literals: &[Literal]) -> bool; fn heuristic(
&mut self,
atom: Atom,
type_: HeuristicType,
bias: i32,
priority: u32,
condition: &[Literal]
) -> bool; fn acyc_edge(
&mut self,
node_u: i32,
node_v: i32,
condition: &[Literal]
) -> bool; fn theory_term_number(&mut self, term_id: Id, number: i32) -> bool; fn theory_term_string(&mut self, term_id: Id, name: &str) -> bool; fn theory_term_compound(
&mut self,
term_id: Id,
name_id_or_type: i32,
arguments: &[Id]
) -> bool; fn theory_element(
&mut self,
element_id: Id,
terms: &[Id],
condition: &[Literal]
) -> bool; fn theory_atom(
&mut self,
atom_id_or_zero: Id,
term_id: Id,
elements: &[Id]
) -> bool; fn theory_atom_with_guard(
&mut self,
atom_id_or_zero: Id,
term_id: Id,
elements: &[Id],
operator_id: Id,
right_hand_side_id: Id
) -> bool; }
Required Methods
fn init_program(&mut self, incremental: bool) -> bool
Called once in the beginning.
If the incremental flag is true, there can be multiple calls to
Control::solve()
.
Arguments
incremental
- whether the program is incremental
Returns whether the call was successful
fn begin_step(&mut self) -> bool
Marks the beginning of a block of directives passed to the solver.
See: end_step()
Returns whether the call was successful
fn end_step(&mut self) -> bool
Marks the end of a block of directives passed to the solver.
This function is called before solving starts.
See: begin_step()
Returns whether the call was successful
fn rule(&mut self, choice: bool, head: &[Atom], body: &[Literal]) -> bool
Observe rules passed to the solver.
Arguments
choice
- determines if the head is a choice or a disjunctionhead
- the head atomsbody
- the body literals
Returns whether the call was successful
fn weight_rule(
&mut self,
choice: bool,
head: &[Atom],
lower_bound: i32,
body: &[WeightedLiteral]
) -> bool
&mut self,
choice: bool,
head: &[Atom],
lower_bound: i32,
body: &[WeightedLiteral]
) -> bool
Observe weight rules passed to the solver.
Arguments
choice
- determines if the head is a choice or a disjunctionhead
- the head atomslower_bound
- the lower bound of the weight rulebody
- the weighted body literals
Returns whether the call was successful
fn minimize(&mut self, priority: i32, literals: &[WeightedLiteral]) -> bool
Observe minimize constraints (or weak constraints) passed to the solver.
Arguments
priority
- the priority of the constraintliterals
- the weighted literals whose sum to minimize
Returns whether the call was successful
fn project(&mut self, atoms: &[Atom]) -> bool
Observe projection directives passed to the solver.
Arguments
atoms
- the atoms to project on
Returns whether the call was successful
fn output_atom(&mut self, symbol: Symbol, atom: Atom) -> 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.
Arguments
symbol
- the symbolic representation of the atomatom
- the aspif atom (0 for facts)
Returns whether the call was successful
fn output_term(&mut self, symbol: Symbol, condition: &[Literal]) -> bool
Observe shown terms passed to the solver.
Arguments
symbol
- the symbolic representation of the termcondition
- the literals of the condition
Returns whether the call was successful
fn output_csp(
&mut self,
symbol: Symbol,
value: i32,
condition: &[Literal]
) -> bool
&mut self,
symbol: Symbol,
value: i32,
condition: &[Literal]
) -> bool
Observe shown csp variables passed to the solver.
Arguments
symbol
- the symbolic representation of the variablevalue
- the value of the variablecondition
- the literals of the condition
Returns whether the call was successful
fn external(&mut self, atom: Atom, type_: ExternalType) -> bool
Observe external statements passed to the solver.
Arguments
atom
- the external atomtype
- the type of the external statement
Returns whether the call was successful
fn assume(&mut self, literals: &[Literal]) -> bool
Observe assumption directives passed to the solver.
Arguments
literals
- the literals to assume (positive literals are true and negative literals false for the next solve call)
Returns whether the call was successful
fn heuristic(
&mut self,
atom: Atom,
type_: HeuristicType,
bias: i32,
priority: u32,
condition: &[Literal]
) -> bool
&mut self,
atom: Atom,
type_: HeuristicType,
bias: i32,
priority: u32,
condition: &[Literal]
) -> bool
Observe heuristic directives passed to the solver.
Arguments
atom
- the target atomtype
- the type of the heuristic modificationbias
- the heuristic biaspriority
- the heuristic prioritycondition
- the condition under which to apply the heuristic modification
Returns whether the call was successful
fn acyc_edge(&mut self, node_u: i32, node_v: i32, condition: &[Literal]) -> bool
Observe edge directives passed to the solver.
Arguments
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 graph
Returns whether the call was successful
fn theory_term_number(&mut self, term_id: Id, number: i32) -> bool
Observe numeric theory terms.
Arguments
term_id
- the id of the termnumber
- the value of the term
Returns whether the call was successful
fn theory_term_string(&mut self, term_id: Id, name: &str) -> bool
Observe string theory terms.
Arguments
term_id
- the id of the termname
- the value of the term
Returns whether the call was successful
fn theory_term_compound(
&mut self,
term_id: Id,
name_id_or_type: i32,
arguments: &[Id]
) -> bool
&mut self,
term_id: Id,
name_id_or_type: i32,
arguments: &[Id]
) -> 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)
Arguments
term_id
- the id of the termname_id_or_type
- the name or type of the termarguments
- the arguments of the term
Returns whether the call was successful
fn theory_element(
&mut self,
element_id: Id,
terms: &[Id],
condition: &[Literal]
) -> bool
&mut self,
element_id: Id,
terms: &[Id],
condition: &[Literal]
) -> bool
Observe theory elements.
Arguments
element_id
- the id of the elementterms
- the term tuple of the elementcondition
- the condition of the element
Returns whether the call was successful
fn theory_atom(
&mut self,
atom_id_or_zero: Id,
term_id: Id,
elements: &[Id]
) -> bool
&mut self,
atom_id_or_zero: Id,
term_id: Id,
elements: &[Id]
) -> bool
Observe theory atoms without guard.
Arguments
atom_id_or_zero
- the id of the atom or zero for directivesterm_id
- the term associated with the atomelements
- the elements of the atom
Returns whether the call was successful
fn theory_atom_with_guard(
&mut self,
atom_id_or_zero: Id,
term_id: Id,
elements: &[Id],
operator_id: Id,
right_hand_side_id: Id
) -> bool
&mut self,
atom_id_or_zero: Id,
term_id: Id,
elements: &[Id],
operator_id: Id,
right_hand_side_id: Id
) -> bool
Observe theory atoms with guard.
Arguments
atom_id_or_zero
- the id of the atom or zero for directivesterm_id
- the term associated with the atomelements
- the elements of the atomoperator_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
Returns whether the call was successful