Struct biodivine_lib_bdd::BddPartialValuation
source · [−]Expand description
Describes assignment of some arbitrary number of Bdd
variables.
A partial valuation can be used to quickly construct simple conjunctive/disjunctive clauses.
It also exactly describes one path in a Bdd
and hence can be used as an intermediate
value when traversing the valuations of a Bdd
.
Tuple Fields
0: Vec<Option<bool>>
Implementations
sourceimpl BddPartialValuation
impl BddPartialValuation
sourcepub fn empty() -> BddPartialValuation
pub fn empty() -> BddPartialValuation
Creates an empty valuation without any variables set.
sourcepub fn cardinality(&self) -> u16
pub fn cardinality(&self) -> u16
Return the number of fixed variables in this valuation.
sourcepub fn last_fixed_variable(&self) -> Option<BddVariable>
pub fn last_fixed_variable(&self) -> Option<BddVariable>
Return the identifier of the last fixed variable in this valuation. Returns None
if
no variable is fixed.
sourcepub fn from_values(values: &[(BddVariable, bool)]) -> BddPartialValuation
pub fn from_values(values: &[(BddVariable, bool)]) -> BddPartialValuation
Create a partial valuation from a list of variables and values.
The order of variables in the slice can be arbitrary. The operation does not perform any uniqueness checking. If the slice contains multiple copies of the same variable, the last value is accepted.
sourcepub fn to_values(&self) -> Vec<(BddVariable, bool)>
pub fn to_values(&self) -> Vec<(BddVariable, bool)>
Consume this valuation and turn it into a vector of values which are stored in it.
sourcepub fn get_value(&self, id: BddVariable) -> Option<bool>
pub fn get_value(&self, id: BddVariable) -> Option<bool>
Get a value stored for the given variable id, if any.
sourcepub fn has_value(&self, id: BddVariable) -> bool
pub fn has_value(&self, id: BddVariable) -> bool
Returns true
if this valuation has the value of id
variable set.
sourcepub fn set_value(&mut self, id: BddVariable, value: bool)
pub fn set_value(&mut self, id: BddVariable, value: bool)
Update value of the given id
variable.
sourcepub fn unset_value(&mut self, id: BddVariable)
pub fn unset_value(&mut self, id: BddVariable)
Remove value of a variable from this valuation.
If the value was not set, this operation has no effect.
fn mut_cell(&mut self, id: BddVariable) -> &mut Option<bool>
sourcepub fn extends(&self, valuation: &BddPartialValuation) -> bool
pub fn extends(&self, valuation: &BddPartialValuation) -> bool
Returns true if the values set in this partial valuation match the values fixed in the
other given valuation. I.e. the two valuations agree on fixed values in valuation
.
In other words this >= valuation
in terms of specificity.
Trait Implementations
sourceimpl Clone for BddPartialValuation
impl Clone for BddPartialValuation
sourcefn clone(&self) -> BddPartialValuation
fn clone(&self) -> BddPartialValuation
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 BddPartialValuation
impl Debug for BddPartialValuation
sourceimpl Default for BddPartialValuation
impl Default for BddPartialValuation
sourceimpl Hash for BddPartialValuation
impl Hash for BddPartialValuation
sourceimpl PartialEq<BddPartialValuation> for BddPartialValuation
impl PartialEq<BddPartialValuation> for BddPartialValuation
sourcefn eq(&self, other: &BddPartialValuation) -> bool
fn eq(&self, other: &BddPartialValuation) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &BddPartialValuation) -> bool
fn ne(&self, other: &BddPartialValuation) -> bool
This method tests for !=
.
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 BddPartialValuation
impl StructuralEq for BddPartialValuation
impl StructuralPartialEq for BddPartialValuation
Auto Trait Implementations
impl RefUnwindSafe for BddPartialValuation
impl Send for BddPartialValuation
impl Sync for BddPartialValuation
impl Unpin for BddPartialValuation
impl UnwindSafe for BddPartialValuation
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