Struct biodivine_lib_bdd::BddVariableSet
source · [−]pub struct BddVariableSet {
pub(crate) num_vars: u16,
pub(crate) var_names: Vec<String>,
pub(crate) var_index_mapping: HashMap<String, u16>,
}Expand description
Maintains the set of variables that can appear in a Bdd.
Used to create new Bdds for basic formulas.
Fields
num_vars: u16var_names: Vec<String>var_index_mapping: HashMap<String, u16>Implementations
sourceimpl BddVariableSet
impl BddVariableSet
Methods for evaluating boolean expressions.
sourcepub fn safe_eval_expression(
&self,
expression: &BooleanExpression
) -> Option<Bdd>
pub fn safe_eval_expression(
&self,
expression: &BooleanExpression
) -> Option<Bdd>
Evaluate the given BooleanExpression in the context of this BddVariableSet. Return None if some
variables are unknown.
sourcepub fn eval_expression(&self, expression: &BooleanExpression) -> Bdd
pub fn eval_expression(&self, expression: &BooleanExpression) -> Bdd
Evaluate the given BooleanExpression in the context of this BddVariableSet. Panic if some
variables are unknown.
sourcepub fn eval_expression_string(&self, expression: &str) -> Bdd
pub fn eval_expression_string(&self, expression: &str) -> Bdd
Evaluate the given String as a BooleanExpression in the context of this BddVariableSet.
Panics if the expression cannot be parsed or contains unknown variables.
sourceimpl BddVariableSet
impl BddVariableSet
sourcepub fn new_anonymous(num_vars: u16) -> BddVariableSet
pub fn new_anonymous(num_vars: u16) -> BddVariableSet
Create a new BddVariableSet with anonymous variables $(x_0, \ldots, x_n)$ where $n$ is
the num_vars parameter.
sourcepub fn new(vars: &[&str]) -> BddVariableSet
pub fn new(vars: &[&str]) -> BddVariableSet
Create a new BddVariableSet with the given named variables. Same as using the
BddVariablesBuilder with this name vector, but no BddVariable objects are returned.
Panics: vars must contain unique names which are allowed as variable names.
sourcepub fn var_by_name(&self, name: &str) -> Option<BddVariable>
pub fn var_by_name(&self, name: &str) -> Option<BddVariable>
Create a BddVariable based on a variable name. If the name does not appear
in this set, return None.
sourcepub fn variables(&self) -> Vec<BddVariable>
pub fn variables(&self) -> Vec<BddVariable>
Provides a vector of all BddVariables in this set.
sourcepub fn name_of(&self, variable: BddVariable) -> String
pub fn name_of(&self, variable: BddVariable) -> String
Obtain the name of a specific BddVariable.
sourcepub fn mk_var(&self, var: BddVariable) -> Bdd
pub fn mk_var(&self, var: BddVariable) -> Bdd
Create a Bdd corresponding to the $v$ formula where v is a specific variable in
this set.
Panics: var must be a valid variable in this set.
sourcepub fn mk_not_var(&self, var: BddVariable) -> Bdd
pub fn mk_not_var(&self, var: BddVariable) -> Bdd
Create a BDD corresponding to the $\neg v$ formula where v is a specific variable in
this set.
Panics: var must be a valid variable in this set.
sourcepub fn mk_literal(&self, var: BddVariable, value: bool) -> Bdd
pub fn mk_literal(&self, var: BddVariable, value: bool) -> Bdd
Create a BDD corresponding to the $v <=> \texttt{value}$ formula.
Panics: var must be a valid variable in this set.
sourcepub fn mk_var_by_name(&self, var: &str) -> Bdd
pub fn mk_var_by_name(&self, var: &str) -> Bdd
Create a BDD corresponding to the $v$ formula where v is a variable in this set.
Panics: var must be a name of a valid variable in this set.
sourcepub fn mk_not_var_by_name(&self, var: &str) -> Bdd
pub fn mk_not_var_by_name(&self, var: &str) -> Bdd
Create a BDD corresponding to the $\neg v$ formula where v is a variable in this set.
Panics: var must be a name of a valid variable in this set.
sourcepub fn mk_conjunctive_clause(&self, clause: &BddPartialValuation) -> Bdd
pub fn mk_conjunctive_clause(&self, clause: &BddPartialValuation) -> Bdd
Create a Bdd corresponding to the conjunction of literals in the given
BddPartialValuation.
For example, given a valuation x = true, y = false and z = true, create
a Bdd for the formula x & !y & z. An empty valuation evaluates to true.
Panics: All variables in the partial valuation must belong into this set.
sourcepub fn mk_disjunctive_clause(&self, clause: &BddPartialValuation) -> Bdd
pub fn mk_disjunctive_clause(&self, clause: &BddPartialValuation) -> Bdd
Create a Bdd corresponding to the disjunction of literals in the given
BddPartialValuation.
For example, given a valuation x = true, y = false and z = true, create
a Bdd for the formula x | !y | z. An empty valuation evaluates to false.
Panics: All variables in the valuation must belong into this set.
Trait Implementations
sourceimpl Clone for BddVariableSet
impl Clone for BddVariableSet
sourcefn clone(&self) -> BddVariableSet
fn clone(&self) -> BddVariableSet
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
Auto Trait Implementations
impl RefUnwindSafe for BddVariableSet
impl Send for BddVariableSet
impl Sync for BddVariableSet
impl Unpin for BddVariableSet
impl UnwindSafe for BddVariableSet
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