Binary Decision Diagrams (BDD)

Post on 23-Feb-2016

56 views 0 download

Tags:

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)

Binary Decision Diagrams (BDD)

1

2

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

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.

4

Binary Tree Representation of Boolean Function

5

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

x1

x2

x3

x1

x3

x3

x2

x1

x1

x1

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

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

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

Reduction Rule #3

x3

x2

0 1

x3

x2

x1

Eliminate Redundant Tests

y

x

y

x2

0 1

x3

x1

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

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

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

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

15

Binary Decision Diagrams• Collapse redundant nodes.

x2

x4

x3 x3

x4 x4 x4

x2

x4

x3 x3

x4 x4 x4

0

x1

1

16

Binary Decision Diagrams• Collapse redundant nodes.

x2

x4

x3 x3

x2

x3 x3

x4 x4

0

x1

1

17

Binary Decision Diagrams• Collapse redundant nodes.

x2

x4

x3 x3

x2

x3

x4 x4

0

x1

1

18

Binary Decision Diagrams• Eliminate unnecessary nodes.

x2

x4

x3 x3

x2

x3

x4 x4

0

x1

1

19

Binary Decision Diagrams• Eliminate unnecessary nodes.

x2

x3

x2

x3

x4

0

x1

1

20

Yoga BABY!!!

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)

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

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

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

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.

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.

27

ZBDD(Zero-Suppressed Binary Decision Diagram)

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

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

ZBDD Representation

29

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

31

That’s All!• Thanks for listening!

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