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

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

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

See: end_step()

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: begin_step()

Returns whether the call was successful

Observe rules passed to the solver.

Arguments

  • choice - determines if the head is a choice or a disjunction
  • head - the head atoms
  • body - the body literals

Returns whether the call was successful

Observe weight rules passed to the solver.

Arguments

  • choice - determines if the head is a choice or a disjunction
  • head - the head atoms
  • lower_bound - the lower bound of the weight rule
  • body - the weighted body literals

Returns whether the call was successful

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

Arguments

  • priority - the priority of the constraint
  • literals - the weighted literals whose sum to minimize

Returns whether the call was successful

Observe projection directives passed to the solver.

Arguments

  • atoms - the atoms to project on

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.

Arguments

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

Returns whether the call was successful

Observe shown terms passed to the solver.

Arguments

  • symbol - the symbolic representation of the term
  • condition - the literals of the condition

Returns whether the call was successful

Observe shown csp variables passed to the solver.

Arguments

  • symbol - the symbolic representation of the variable
  • value - the value of the variable
  • condition - the literals of the condition

Returns whether the call was successful

Observe external statements passed to the solver.

Arguments

  • atom - the external atom
  • type - the type of the external statement

Returns whether the call was successful

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

Observe heuristic directives passed to the solver.

Arguments

  • 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

Returns whether the call was successful

Observe edge directives passed to the solver.

Arguments

  • 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

Returns whether the call was successful

Observe numeric theory terms.

Arguments

  • term_id - the id of the term
  • number - the value of the term

Returns whether the call was successful

Observe string theory terms.

Arguments

  • term_id - the id of the term
  • name - the value of the term

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)

Arguments

  • term_id - the id of the term
  • name_id_or_type - the name or type of the term
  • arguments - the arguments of the term

Returns whether the call was successful

Observe theory elements.

Arguments

  • element_id - the id of the element
  • terms - the term tuple of the element
  • condition - the condition of the element

Returns whether the call was successful

Observe theory atoms without guard.

Arguments

  • 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

Returns whether the call was successful

Observe theory atoms with guard.

Arguments

  • 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
  • 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

Returns whether the call was successful

Implementors