Binary Decision Diagrams (BDD)

32
Binary Decision Diagrams (BDD) 1

description

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 - PowerPoint PPT Presentation

Transcript of Binary Decision Diagrams (BDD)

Page 1: Binary Decision Diagrams (BDD)

Binary Decision Diagrams (BDD)

1

Page 2: Binary Decision Diagrams (BDD)

2

What are they?• BDDs are an advanced form of a binary tree

Page 3: Binary Decision Diagrams (BDD)

3

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.

Page 4: Binary Decision Diagrams (BDD)

4

Binary Tree Representation of Boolean Function

Page 5: Binary Decision Diagrams (BDD)

5

How does a BDD remedy this memory problem?

• BDDs use reduction process in order to eliminate redundant nodes and terminals.

Page 6: Binary Decision Diagrams (BDD)

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

x1

x2

x3

x1

x3

x3

x2

x1

x1

x1

Page 7: Binary Decision Diagrams (BDD)

Decision StructuresTruth 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.

0 0

x3

0 1

x3

x2

0 1

x3

0 1

x3

x2

x100001111

00110011

01010101

00010101

x1 x2 x3 f

Page 8: Binary Decision Diagrams (BDD)

Reduction Rule #1

Merge equivalent leaves

a a

0 0

x3

0 1

x3

x2

0 1

x3

0 1

x3

x2

x1

x3 x3

x2

x3

0 1

x3

x2

x1

a

Page 9: Binary Decision Diagrams (BDD)

Reduction Rule #2

y

x

z

x

Merge isomorphic nodes

x3 x3

x2

x3

0 1

x3

x2

x1

x3

x2

0 1

x3

x2

x1

y

x

z

x

y

x

z

x

Page 10: Binary Decision Diagrams (BDD)

Reduction Rule #3

x3

x2

0 1

x3

x2

x1

Eliminate Redundant Tests

y

x

y

x2

0 1

x3

x1

Page 11: Binary Decision Diagrams (BDD)

Example BDDInitial Graph Reduced Graph

x2

0 1

x3

x1

0 0

x3

0 1

x3

x2

0 1

x3

0 1

x3

x2

x1 (x1+x2)x3

Page 12: Binary Decision Diagrams (BDD)

12

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

Page 13: Binary Decision Diagrams (BDD)

13

Binary Decision Diagrams• Graphical encoding of a truth table.

x2

x4

x3 x3

x4 x4 x4

0 0 0 1 0 0 0 0

x2

x4

x3 x3

x4 x4 x4

0 1 1 1 0 0 0 1

x1 0 edge1 edge

Page 14: Binary Decision Diagrams (BDD)

14

Binary Decision Diagrams• Collapse redundant nodes.

x2

x4

x3 x3

x4 x4 x4

0 0 0 0 0 0 0

x2

x4

x3 x3

x4 x4 x4

0 0 0 0

x1

11 1 1 1

Page 15: Binary Decision Diagrams (BDD)

15

Binary Decision Diagrams• Collapse redundant nodes.

x2

x4

x3 x3

x4 x4 x4

x2

x4

x3 x3

x4 x4 x4

0

x1

1

Page 16: Binary Decision Diagrams (BDD)

16

Binary Decision Diagrams• Collapse redundant nodes.

x2

x4

x3 x3

x2

x3 x3

x4 x4

0

x1

1

Page 17: Binary Decision Diagrams (BDD)

17

Binary Decision Diagrams• Collapse redundant nodes.

x2

x4

x3 x3

x2

x3

x4 x4

0

x1

1

Page 18: Binary Decision Diagrams (BDD)

18

Binary Decision Diagrams• Eliminate unnecessary nodes.

x2

x4

x3 x3

x2

x3

x4 x4

0

x1

1

Page 19: Binary Decision Diagrams (BDD)

19

Binary Decision Diagrams• Eliminate unnecessary nodes.

x2

x3

x2

x3

x4

0

x1

1

Page 20: Binary Decision Diagrams (BDD)

20

Yoga BABY!!!

Page 21: Binary Decision Diagrams (BDD)

21

A(F,G) = F + G

if(F||G)

What’s a Boolean function?

F G A(F, G)0 0 00 1 11 0 11 1 1

OR(F, G )

F G B(F, G)

0 0 0

0 1 0

1 0 0

1 1 1

And(F, G )

B(F, G) = F*G

if(F&&G)

Page 22: Binary Decision Diagrams (BDD)

Generating BDD from a Circuit

Network Evaluation

Task: Represent output functions of gate network as BDDs.

Resulting Graphs

A new_var ("a");B new_var ("b");C new_var ("c");T1 And (A, B);T2 And (B, C);O1 Or (T1, T2);

A

B

C

T1

T2

O1

A B CT1 T2

O1

0 1

a

0 1

c

0 1

b

0 1

b

a

0 1

c

b

c

b

0 1

b

a

Page 23: Binary Decision Diagrams (BDD)

Checking Circuit Equivalence

Alternate Circuit

Evaluation

Resulting Graphs

Determine: Do 2 networks compute same Boolean function?Method: Compute BDDs for both networks and compare

A

B

C

T3

O2

A B CT3

O2

c

b

0 1

b

a

0 1

a c

0 10 1

b

0 1

a

c

T3 Or (A, C);O2 And (T3, B);if (O2 == O1)

then Equivalentelse Different

Page 24: Binary Decision Diagrams (BDD)

24

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

B

C

T1

T2

O1

A

B

C

T3

O2

Page 25: Binary Decision Diagrams (BDD)

25

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.

Page 26: Binary Decision Diagrams (BDD)

26

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.

Page 27: Binary Decision Diagrams (BDD)

27

ZBDD(Zero-Suppressed Binary Decision Diagram)

• The Zero-Suppressed Binary Decision Diagram resolves the issue with dealing with sparse data

Page 28: Binary Decision Diagrams (BDD)

28

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

Page 29: Binary Decision Diagrams (BDD)

ZBDD Representation

29

Page 30: Binary Decision Diagrams (BDD)

30

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– ….

Page 31: Binary Decision Diagrams (BDD)

31

That’s All!• Thanks for listening!

Page 32: Binary Decision Diagrams (BDD)

32

Credits• Maciej Ciesielski, Electrical & Computer Engineering,

University of Massachusetts, Amherst, USA

• http://en.wikipedia.org/wiki/Binary_decision_diagram• http://www.eecs.berkeley.edu/~alanmi/publications/2001/te

ch01_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