Skip to content

Commit

Permalink
Add serde support to BddValuation, BddPartialValuation and `Bdd…
Browse files Browse the repository at this point in the history
…VariableSet`.
  • Loading branch information
daemontus committed May 15, 2024
1 parent c0aabb2 commit de91767
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ pub struct BddVariable(u16);
/// 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.
#[derive(Clone, Debug, Eq, Hash, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BddValuation(Vec<bool>);

/// Describes assignment of some arbitrary number of `Bdd` variables.
Expand All @@ -130,6 +131,7 @@ pub struct BddValuation(Vec<bool>);
/// 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`.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BddPartialValuation(Vec<Option<bool>>);

/// Exhaustively iterates over all valuations with a certain number of variables.
Expand Down Expand Up @@ -186,6 +188,7 @@ pub struct ValuationsOfClauseIterator {
/// Maintains the set of variables that can appear in a `Bdd`.
/// Used to create new `Bdd`s for basic formulas.
#[derive(Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct BddVariableSet {
num_vars: u16,
var_names: Vec<String>,
Expand Down

0 comments on commit de91767

Please sign in to comment.