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:
- Initialise it with a base model against which the individual reverse propagating clauses will be checked.
- Add reverse propagating clauses through
RpEngine::add_rp_clause. The order in which this happens matters. - 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).
- Remove the reverse propagating clauses with
RpEngine::remove_last_rp_clausein reverse order in which they were added.
Implementations§
source§impl RpEngine
impl RpEngine
sourcepub fn new(solver: Solver) -> Self
pub fn new(solver: Solver) -> Self
Create a new reverse propagating engine based on a Solver initialized with the model of
the problem.
sourcepub fn add_rp_clause(
&mut self,
clause: impl IntoIterator<Item = Literal>,
) -> Result<RpClauseHandle, ReversePropagationConflict>
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.
sourcepub fn remove_last_rp_clause(&mut self) -> Option<Vec<Literal>>
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.
sourcepub fn propagate_under_assumptions(
&mut self,
assumptions: impl IntoIterator<Item = Literal>,
) -> Result<(), Vec<ConflictReason>>
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§
Auto Trait Implementations§
impl Freeze for RpEngine
impl !RefUnwindSafe for RpEngine
impl !Send for RpEngine
impl !Sync for RpEngine
impl Unpin for RpEngine
impl !UnwindSafe for RpEngine
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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