Struct rustsat::types::constraints::Clause
source · pub struct Clause { /* private fields */ }
Expand description
Type representing a clause. Wrapper around a std collection to allow for changing the data structure. Optional clauses as sets will be included in the future.
Implementations§
source§impl Clause
impl Clause
sourcepub fn evaluate(&self, assignment: &Assignment) -> TernaryVal
pub fn evaluate(&self, assignment: &Assignment) -> TernaryVal
Evaluates a clause under a given assignment
sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Lit>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Lit>
Gets a mutable iterator over the clause
sourcepub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> Drain<'_, Lit>
pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> Drain<'_, Lit>
Like Vec::drain
sourcepub fn normalize(self) -> Option<Self>
pub fn normalize(self) -> Option<Self>
Normalizes the clause. This includes sorting the literals, removing duplicates and removing the entire clause if it is a tautology. Comparing two normalized clauses checks their logical equivalence.
sourcepub fn sanitize(self) -> Option<Self>
pub fn sanitize(self) -> Option<Self>
Sanitizes the clause. This includes removing duplicates and removing the entire clause if it is a tautology. This preserves the order of the literals in the clause.
pub fn is_sat(&self, assign: &Assignment) -> bool
Trait Implementations§
source§impl Extend<Clause> for Cnf
impl Extend<Clause> for Cnf
source§fn extend<Iter: IntoIterator<Item = Clause>>(&mut self, iter: Iter)
fn extend<Iter: IntoIterator<Item = Clause>>(&mut self, iter: Iter)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl Extend<Lit> for Clause
impl Extend<Lit> for Clause
source§fn extend<T: IntoIterator<Item = Lit>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Lit>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl FromIterator<Clause> for Cnf
impl FromIterator<Clause> for Cnf
source§impl<VM: ManageVars + Default> FromIterator<Clause> for SatInstance<VM>
impl<VM: ManageVars + Default> FromIterator<Clause> for SatInstance<VM>
source§impl FromIterator<Lit> for Clause
impl FromIterator<Lit> for Clause
source§impl<'a> IntoIterator for &'a Clause
impl<'a> IntoIterator for &'a Clause
source§impl<'a> IntoIterator for &'a mut Clause
impl<'a> IntoIterator for &'a mut Clause
source§impl IntoIterator for Clause
impl IntoIterator for Clause
source§impl Ord for Clause
impl Ord for Clause
source§impl PartialEq for Clause
impl PartialEq for Clause
source§impl PartialOrd for Clause
impl PartialOrd for Clause
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Clause
impl StructuralEq for Clause
Auto Trait Implementations§
impl RefUnwindSafe for Clause
impl Send for Clause
impl Sync for Clause
impl Unpin for Clause
impl UnwindSafe for Clause
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
Mutably borrows from an owned value. Read more