Struct PropagateControl

Source
pub struct PropagateControl(/* private fields */);
Expand description

This object can be used to add clauses and propagate literals while solving.

Implementations§

Source§

impl PropagateControl

Source

pub fn thread_id(&self) -> u32

Get the id of the underlying solver thread.

Thread ids are consecutive numbers starting with zero.

Source

pub fn assignment(&self) -> Result<&Assignment, ClingoError>

Get the assignment associated with the underlying solver.

Source

pub fn assignment_mut(&self) -> Result<&mut Assignment, ClingoError>

Get the assignment associated with the underlying solver.

Source

pub fn add_literal( &mut self, result: &mut SolverLiteral, ) -> Result<(), ClingoError>

Adds a new volatile literal to the underlying solver thread.

Attention: The literal is only valid within the current solving step and solver thread. All volatile literals and clauses involving a volatile literal are deleted after the current search.

§Arguments
  • result - the (positive) solver literal

Errors:

Source

pub fn add_watch(&mut self, literal: SolverLiteral) -> Result<(), ClingoError>

Add a watch for the solver literal in the given phase.

Note: Unlike PropagateInit::add_watch() this does not add a watch to all solver threads but just the current one.

§Arguments
  • literal - the literal to watch

Errors:

See: PropagateControl::remove_watch()

Source

pub fn has_watch(&self, literal: SolverLiteral) -> bool

Check whether a literal is watched in the current solver thread.

§Arguments
  • literal - the literal to check
Source

pub fn remove_watch(&mut self, literal: SolverLiteral)

Removes the watch (if any) for the given solver literal.

Note: Similar to PropagateInit::add_watch() this just removes the watch in the current solver thread.

§Arguments
  • literal - the literal to remove
Source

pub fn add_clause( &mut self, clause: &[SolverLiteral], ctype: ClauseType, ) -> Result<bool, ClingoError>

Add the given clause to the solver.

This method sets its result to false if the current propagation must be stopped for the solver to backtrack.

Attention: No further calls on the control object or functions on the assignment should be called when the result of this method is false.

§Arguments
  • clause - the clause to add
  • ctype - the clause type determining its lifetime

Returns result indicating whether propagation has to be stopped

§Errors
Source

pub fn propagate(&mut self) -> Result<bool, ClingoError>

Propagate implied literals (resulting from added clauses).

This method sets its result to false if the current propagation must be stopped for the solver to backtrack.

Attention: No further calls on the control object or functions on the assignment should be called when the result of this method is false.

Returns result indicating whether propagation has to be stopped

§Errors

Trait Implementations§

Source§

impl Debug for PropagateControl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.