Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BDD variable swapping and reordering #160

Open
SHoltzen opened this issue Jul 24, 2023 · 0 comments
Open

BDD variable swapping and reordering #160

SHoltzen opened this issue Jul 24, 2023 · 0 comments

Comments

@SHoltzen
Copy link
Collaborator

Add a swap method to the BddBuilder trait:

pub trait BddBuilder<'a>: BottomUpBuilder<'a, BddPtr<'a>> {
   /// swaps variables `a` and `b` in the variable order.
   /// all pointers into the manager are invalidated. 
   /// returns a new manager and root list, where the order of roots in the returned list 
   /// matches the order provided by `roots.`
   fn swap(manager: BddManger<'a>, roots: Vec<BddPtr<'a>, a: VarLabel, b: VarLabel) -> (Manager<'b>, Vec<BddPtr<'b>>;

   /// reorders all BDDs to have the order `order`.
   /// all pointers into the manager are invalidated. 
   /// returns a new manager and root list, where the order of roots in the returned list 
   /// matches the order provided by `roots.`
   fn reorder(manager: BddManger<'a>, roots: Vec<BddPtr<'a>, order: VarOrder) -> (Manager<'b>, Vec<BddPtr<'b>>;
}
  • Swapping adjacent variables in a BDD is efficient. Swapping two arbitrary variables can be accomplished by repeated swapping of adjacent variables.
  • Here is a document visualizing swapping and describing how to efficiently implement it:
    variable-swap.pdf
  • reorder should be implemented in terms of swap.
  • This is blocked by Garbage collection #154.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant