pumpkin_solver::proof::rp_engine

Struct RpEngine

source
pub struct RpEngine { /* private fields */ }
Expand description

An API for performing backwards reverse propagation of a clausal proof. The API allows the reasons for all propagations that are used to derive the RP clause to be accessed.

To use the RpEngine, one can do the following:

  1. Initialise it with a base model against which the individual reverse propagating clauses will be checked.
  2. Add reverse propagating clauses through RpEngine::add_rp_clause. The order in which this happens matters.
  3. Check whether a propagation can derive a conflict under certain assumptions (probably the negation of a reverse propagating clause which is no-longer in the engine).
  4. Remove the reverse propagating clauses with RpEngine::remove_last_rp_clause in reverse order in which they were added.

Implementations§

source§

impl RpEngine

source

pub fn new(solver: Solver) -> Self

Create a new reverse propagating engine based on a Solver initialized with the model of the problem.

source

pub fn add_rp_clause( &mut self, clause: impl IntoIterator<Item = Literal>, ) -> Result<RpClauseHandle, ReversePropagationConflict>

Add a new reverse propagating clause to the engine. The clause should not be empty, and the engine should not be in an conflicting state.

If the new clause causes a conflict under propagation, the engine will be in a conflicting state. A call to RpEngine::remove_last_rp_clause will remove the newly added clause and reset the engine to a useable state.

source

pub fn remove_last_rp_clause(&mut self) -> Option<Vec<Literal>>

Remove the last clause in the proof from consideration and return the literals it contains.

source

pub fn propagate_under_assumptions( &mut self, assumptions: impl IntoIterator<Item = Literal>, ) -> Result<(), Vec<ConflictReason>>

Perform unit propagation under assumptions.

In case the engine discovers a conflict, the engine will be in a conflicting state. At this point, no new clauses can be added before a call to RpEngine::remove_last_rp_clause.

Trait Implementations§

source§

impl Debug for RpEngine

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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V