Struct biodivine_lib_bdd::BddValuation
source · [−]Expand description
Exactly describes one assignment of boolean values to variables of a Bdd
.
It can be used as a witness of Bdd
non-emptiness, since one can evaluate every Bdd
in some corresponding valuation and get a true/false
result.
Tuple Fields
0: Vec<bool>
Implementations
sourceimpl BddValuation
impl BddValuation
sourcepub fn new(values: Vec<bool>) -> BddValuation
pub fn new(values: Vec<bool>) -> BddValuation
Create a new valuation from a vector of variables.
sourcepub fn all_false(num_vars: u16) -> BddValuation
pub fn all_false(num_vars: u16) -> BddValuation
Create a valuation with all variables set to false.
sourcepub fn all_true(num_vars: u16) -> BddValuation
pub fn all_true(num_vars: u16) -> BddValuation
Create a valuation with all variables set to true.
sourcepub fn flip_value(&mut self, variable: BddVariable)
pub fn flip_value(&mut self, variable: BddVariable)
Flip the value of a given Bdd variable.
sourcepub fn clear(&mut self, variable: BddVariable)
pub fn clear(&mut self, variable: BddVariable)
Set the value of the given variable
to false
.
sourcepub fn set(&mut self, variable: BddVariable)
pub fn set(&mut self, variable: BddVariable)
Set the value of the given variable
to true
.
sourcepub fn set_value(&mut self, variable: BddVariable, value: bool)
pub fn set_value(&mut self, variable: BddVariable, value: bool)
Update value
of the given variable
.
sourcepub fn value(&self, variable: BddVariable) -> bool
pub fn value(&self, variable: BddVariable) -> bool
Get a value of a specific BDD variable in this valuation.
sourcepub fn num_vars(&self) -> u16
pub fn num_vars(&self) -> u16
Number of variables in this valuation (used mostly for consistency checks).
sourcepub fn extends(&self, valuation: &BddPartialValuation) -> bool
pub fn extends(&self, valuation: &BddPartialValuation) -> bool
Returns true if the values set in this valuation match the values fixed in the given partial valuation. I.e. the two valuations agree on fixed values.
In other words this >= valuation
in terms of specificity.
sourcepub(crate) fn next(&self, clause: &BddPartialValuation) -> Option<BddValuation>
pub(crate) fn next(&self, clause: &BddPartialValuation) -> Option<BddValuation>
(internal) “Increment” this valuation if possible. Interpret the valuation as bit-vector and perform a standard increment. This can be used to iterate over all valuations.
You can provide a clause
which restricts which variables of the valuation can change.
That is, any variable that has a fixed value in clause
is considered to be fixed.
Note that the method also checks whether the fixed values are the same as in the
clause
(i.e. the valuation and clause are mutually compatible) and panics if
inconsistencies are found.
Trait Implementations
sourceimpl Clone for BddValuation
impl Clone for BddValuation
sourcefn clone(&self) -> BddValuation
fn clone(&self) -> BddValuation
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for BddValuation
impl Debug for BddValuation
sourceimpl Display for BddValuation
impl Display for BddValuation
sourceimpl From<BddValuation> for Bdd
impl From<BddValuation> for Bdd
Convert a BddValuation to a Bdd with, well, exactly that one valuation.
sourcefn from(valuation: BddValuation) -> Self
fn from(valuation: BddValuation) -> Self
Performs the conversion.
sourceimpl Hash for BddValuation
impl Hash for BddValuation
sourceimpl Index<BddVariable> for BddValuation
impl Index<BddVariable> for BddValuation
Allow indexing of BddValuation
using BddVariables
.
sourceimpl Ord for BddValuation
impl Ord for BddValuation
sourceimpl PartialEq<BddValuation> for BddValuation
impl PartialEq<BddValuation> for BddValuation
sourcefn eq(&self, other: &BddValuation) -> bool
fn eq(&self, other: &BddValuation) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &BddValuation) -> bool
fn ne(&self, other: &BddValuation) -> bool
This method tests for !=
.
sourceimpl PartialOrd<BddValuation> for BddValuation
impl PartialOrd<BddValuation> for BddValuation
sourcefn partial_cmp(&self, other: &BddValuation) -> Option<Ordering>
fn partial_cmp(&self, other: &BddValuation) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl TryFrom<BddPartialValuation> for BddValuation
impl TryFrom<BddPartialValuation> for BddValuation
If possible, convert the given partial valuation to valuation with the same number of variables. Partial valuation must contain values of all variables.
impl Eq for BddValuation
impl StructuralEq for BddValuation
impl StructuralPartialEq for BddValuation
Auto Trait Implementations
impl RefUnwindSafe for BddValuation
impl Send for BddValuation
impl Sync for BddValuation
impl Unpin for BddValuation
impl UnwindSafe for BddValuation
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more