Skip to content

Commit

Permalink
implementing BDD::apply
Browse files Browse the repository at this point in the history
  • Loading branch information
shnarazk committed Feb 1, 2024
1 parent 4db6a43 commit 84d50e5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/bdd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl ToBinaryDecisionDiagram for Node {

pub trait BinaryDecisionDiagram {
fn reduce(&mut self);
fn apply(&self, op: Box<dyn Fn(bool, bool) -> bool>, _other: &Self) -> BDD;
}

impl BinaryDecisionDiagram for BDD {
Expand Down Expand Up @@ -167,6 +168,27 @@ impl BinaryDecisionDiagram for BDD {
.unwrap()
.clone();
}
fn apply(&self, _op: Box<dyn Fn(bool, bool) -> bool>, other: &Self) -> BDD {
let mut from_index: HashMap<usize, Node> = HashMap::new();
from_index.insert(0, Node::new_constant(false));
from_index.insert(1, Node::new_constant(true));
let mut to_index: HashMap<Node, usize> = HashMap::new();
for (i, node) in self
.graph
.all_nodes()
.iter()
.chain(other.graph.all_nodes().iter())
.enumerate()
{
from_index.insert(i + 2, (*node).clone());
to_index.insert((*node).clone(), i + 2);
}
fn apply_aux(_v1: Node, _v2: Node) -> BDD {
todo!()
}
apply_aux(self.graph.clone(), other.graph.clone());
todo!()
}
}

#[cfg(test)]
Expand Down

0 comments on commit 84d50e5

Please sign in to comment.