340 likes | 546 Views
Binary Decision Diagrams (BDD). What are they?. BDDs are an advanced form of a binary tree. What’s wrong with representing data with Binary Trees?. Binary trees require a lot of data to represent Boolean functions Binary Trees require 2 n -1 nodes
E N D
What are they? • BDDs are an advanced form of a binary tree
What’s wrong with representing data with Binary Trees? • Binary trees require a lot of data to represent Boolean functions • Binary Trees require 2n -1 nodes • When dealing with large databases that contain millions of variables, it’s very inefficient and memory consuming.
How does a BDD remedy this memory problem? • BDDs use reduction process in order to eliminate redundant nodes and terminals.
Variable Ordering • Assign arbitrary total ordering to variables • e.g., x1 < x2 < x3 • Variables must appear in ascending order along all paths OK Not OK • Properties • No conflicting variable assignments along path • Simplifies manipulation
Decision Structures Truth Table Decision Tree • Vertex represents decision • Follow green (dashed) line for value 0 • Follow red (solid) line for value 1 • Function value determined by leaf value.
a a a Reduction Rule #1 Merge equivalent leaves
x x x x x x y z y z y z Reduction Rule #2 Merge isomorphic nodes
x y y Reduction Rule #3 Eliminate Redundant Tests
Example BDD Initial Graph Reduced Graph (x1+x2)x3
What’s go great about BDDs? • BDDs are a memory-efficient storage and convenient processing media for Boolean or multi-valued functions • They can lead to new, implicit and efficient formulas. • They provide canonical representations of data • for every object, there is only one representation • for given variable ordering • Two functions are equivalent if and only if the graphs are isomorphic • Can be tested in linear time
Binary Decision Diagrams • Graphical encoding of a truth table. x1 0 edge 1 edge x2 x2 x3 x3 x3 x3 x4 x4 x4 x4 x4 x4 x4 x4 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0
Binary Decision Diagrams • Collapse redundant nodes. x1 x2 x2 x3 x3 x3 x3 x4 x4 x4 x4 x4 x4 x4 x4 0 1 1 1 0 0 0 1 0 0 0 1 0 0 0 0
Binary Decision Diagrams • Collapse redundant nodes. x1 x2 x2 x3 x3 x3 x3 x4 x4 x4 x4 x4 x4 x4 x4 0 1
Binary Decision Diagrams • Collapse redundant nodes. x1 x2 x2 x3 x3 x3 x3 x4 x4 x4 0 1
Binary Decision Diagrams • Collapse redundant nodes. x1 x2 x2 x3 x3 x3 x4 x4 x4 0 1
Binary Decision Diagrams • Eliminate unnecessary nodes. x1 x2 x2 x3 x3 x3 x4 x4 x4 0 1
Binary Decision Diagrams • Eliminate unnecessary nodes. x1 x2 x2 x3 x3 x4 0 1
What’s a Boolean function? B(F, G) = F*G if(F&&G) A(F,G) = F + G if(F||G) OR(F, G) And(F, G )
a a b b b a b c b c c 0 1 0 1 0 1 0 1 0 1 0 1 Generating BDD from a Circuit Task:Represent output functions of gate network as BDDs. A new_var ("a"); B new_var ("b"); C new_var ("c"); T1 And (A, B); T2 And (B, C); O1 Or (T1, T2); Network Evaluation A T1 B O1 C T2 O1 Resulting Graphs T1 T2 A B C
T3 A C O2 B a b b a b c c c 0 1 0 1 0 1 Checking Circuit Equivalence Determine: Do 2 networks compute same Boolean function? Method: Compute BDDs for both networks and compare Evaluation T3 Or (A, C); O2 And (T3, B); if (O2 == O1) then Equivalent else Different Alternate Circuit O2 Resulting Graphs T3 A B C a 0 1 0 1
T3 A C O2 B BDDs can simplify problems • These two are actually equivalent, however the second one is reduced. AB + BC (A + C)B AB + BC = B(A + C) A T1 B O1 C T2
What are BDDs Used For? • BDDs are useful for signatures when storing objects in hash tables. • BDDs are extensively used in CAD software which is used to synthesize circuits • It’s becoming more frequently used for gathering data and storing it in sets.
BDDs Can Still Be Improved • While BDDs are much more efficient memory wise, they still require lots of memory when working with sparse sets • A set is sparse when the number of elements are much smaller than the total number of elements that may appear in a set.
ZBDD(Zero-Suppressed Binary Decision Diagram) • The Zero-Suppressed Binary Decision Diagram resolves the issue with dealing with sparse data
What’s different about ZBDDs? • For BDDs, the node is removed from the decision tree if both its edges point to the same node. • For ZBDDs, the node is removed if its positive edge (then-edge) points to the terminal node 0
ZBDD Importance • ZBDDs are important because they further reduce the memory consumption that the BDD requires. • Because of this, we can deal with much larger amounts of data • Function • Set • ….
That’s All! • Thanks for listening!
Credits • MaciejCiesielski, Electrical & Computer Engineering, University of Massachusetts, Amherst, USA • http://en.wikipedia.org/wiki/Binary_decision_diagram • http://www.eecs.berkeley.edu/~alanmi/publications/2001/tech01_zdd.pdf • http://en.wikipedia.org/wiki/Binary_decision_diagram • http://en.wikipedia.org/wiki/Binary_decision_diagram • http://www.ecs.umass.edu/ece/labs/vlsicad/slides/BDD.ppt • http://sp09.pbworks.com/f/pointer-analysis2.ppt