· Algorithm to reduce OBDD É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1 É...
Transcript of · Algorithm to reduce OBDD É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1 É...
Unit-11: Binary Decision Diagrams (BDDs)
B. Srivathsan
Chennai Mathematical Institute
NPTEL-course
July - November 2015
1/20
Module 2:Ordered BDDs
2/20
f (x1,x2,x3,x4) =
(
1 if an even number of variables is 10 otherwise
Ordered BDD for f with order [x1,x2,x3,x4]
x1
x2 x2
x3 x3 x3 x3
x4 x4 x4 x4 x4 x4 x4 x4
0 1
3/20
f (x1,x2,x3,x4) =
(
1 if an even number of variables is 10 otherwise
Ordered BDD for f with order [x1,x2,x3,x4]
x1
x2 x2
x3 x3 x3 x3
x4 x4 x4 x4 x4 x4 x4 x4
0 1
3/20
f (x1,x2,x3,x4) =
(
1 if an even number of variables is 10 otherwise
Reduced Ordered BDD for f with order [x1,x2,x3,x4]
x1
x2 x2
x3 x3
x4 x4
0 1
4/20
f (x1,x2,x3,x4) =
(
1 if an even number of variables is 10 otherwise
Ordered BDD for f with order [x3,x1,x4,x2]
x3
x1 x1
x4 x4 x4 x4
x2 x2 x2 x2 x2 x2 x2 x2
0 1
5/20
f (x1,x2,x3,x4) =
(
1 if an even number of variables is 10 otherwise
Reduced Ordered BDD for f with order [x3,x1,x4,x2]
f is not sensitive
to ordering
x3
x1 x1
x4 x4
x2 x2
0 1
6/20
f (x1,x2,x3,x4) =
(
1 if an even number of variables is 10 otherwise
Reduced Ordered BDD for f with order [x3,x1,x4,x2]
f is not sensitive
to ordering
x3
x1 x1
x4 x4
x2 x2
0 1
6/20
g(x1,x2,x3,x4,x5,x6) = (x1 + x2) · (x3 + x4) · (x5 + x6)
Reduced Ordered BDD (ROBDD) for g with order [x1,x2,x3,x4,x5,x6]
x1
x2
x3
x4
x5
x6
0 1
7/20
g(x1,x2,x3,x4,x5,x6) = (x1 + x2) · (x3 + x4) · (x5 + x6)
ROBDD for g with order [x1,x3,x5,x2,x4,x6]
g is sensitive
to ordering
x1
x3
x5 x5
x2 x2 x2 x2
x3
x5 x5
x4 x4
x6
0 1
8/20
g(x1,x2,x3,x4,x5,x6) = (x1 + x2) · (x3 + x4) · (x5 + x6)
ROBDD for g with order [x1,x3,x5,x2,x4,x6]
g is sensitive
to ordering
x1
x3
x5 x5
x2 x2 x2 x2
x3
x5 x5
x4 x4
x6
0 1
8/20
Ordered BDDs
É BDDs with a specified ordering of variables
É For a given ordering, the reduced OBDD is unique
É Size of OBDD depends on the chosen ordering
É In practice, heuristics exist to find good orderings
Coming next: Operations on OBDDs
9/20
Ordered BDDs
É BDDs with a specified ordering of variables
É For a given ordering, the reduced OBDD is unique
É Size of OBDD depends on the chosen ordering
É In practice, heuristics exist to find good orderings
Coming next: Operations on OBDDs
9/20
Algorithm to reduce an OBDD
10/20
x1
x2 x2
x3 x3
0 1 0 1
#0 #1 #0 #1
#2 #2
#3 #2
#4
REDUCE
x1
x2
x3
0 1
#0 #1
#2
#3
#4
11/20
x1
x2 x2
x3 x3
0 1 0 1
#0 #1 #0 #1
#2 #2
#3 #2
#4
REDUCE
x1
x2
x3
0 1
#0 #1
#2
#3
#4
11/20
x1
x2 x2
x3 x3
0 1 0 1
#0 #1 #0 #1
#2
#2
#3 #2
#4
REDUCE
x1
x2
x3
0 1
#0 #1
#2
#3
#4
11/20
x1
x2 x2
x3 x3
0 1 0 1
#0 #1 #0 #1
#2 #2
#3 #2
#4
REDUCE
x1
x2
x3
0 1
#0 #1
#2
#3
#4
11/20
x1
x2 x2
x3 x3
0 1 0 1
#0 #1 #0 #1
#2 #2
#3
#2
#4
REDUCE
x1
x2
x3
0 1
#0 #1
#2
#3
#4
11/20
x1
x2 x2
x3 x3
0 1 0 1
#0 #1 #0 #1
#2 #2
#3 #2
#4
REDUCE
x1
x2
x3
0 1
#0 #1
#2
#3
#4
11/20
x1
x2 x2
x3 x3
0 1 0 1
#0 #1 #0 #1
#2 #2
#3 #2
#4
REDUCE
x1
x2
x3
0 1
#0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1 1 1#0 #1 #0 #0 #0 #1 #1 #1
#2 #0 #2 #1
#5
#3 #4REDUCE
x
y y
z
0 1
12/20
Algorithm to reduce OBDD
É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1
É Intermediate node n
É If 0-child and 1-child of n have same label, set label of n to bethat label
É If there is another node m such that m has the same variable xiand the children of n and m have same label, then set label of nto be the label of m
É Otherwise set label of n to be next unused integer
Reference: Logic in Computer Science, 2nd edition, by Huth and RyanSection 6.2.1
13/20
Algorithm to reduce OBDD
É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1
É Intermediate node n
É If 0-child and 1-child of n have same label, set label of n to bethat label
É If there is another node m such that m has the same variable xiand the children of n and m have same label, then set label of nto be the label of m
É Otherwise set label of n to be next unused integer
Reference: Logic in Computer Science, 2nd edition, by Huth and RyanSection 6.2.1
13/20
Algorithm to reduce OBDD
É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1
É Intermediate node n
É If 0-child and 1-child of n have same label, set label of n to bethat label
É If there is another node m such that m has the same variable xiand the children of n and m have same label, then set label of nto be the label of m
É Otherwise set label of n to be next unused integer
Reference: Logic in Computer Science, 2nd edition, by Huth and RyanSection 6.2.1
13/20
Algorithm to reduce OBDD
É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1
É Intermediate node n
É If 0-child and 1-child of n have same label, set label of n to bethat label
É If there is another node m such that m has the same variable xiand the children of n and m have same label, then set label of nto be the label of m
É Otherwise set label of n to be next unused integer
Reference: Logic in Computer Science, 2nd edition, by Huth and RyanSection 6.2.1
13/20
Algorithm to reduce OBDD
É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1
É Intermediate node n
É If 0-child and 1-child of n have same label, set label of n to bethat label
É If there is another node m such that m has the same variable xiand the children of n and m have same label, then set label of nto be the label of m
É Otherwise set label of n to be next unused integer
Reference: Logic in Computer Science, 2nd edition, by Huth and RyanSection 6.2.1
13/20
Algorithm to reduce OBDD
É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1
É Intermediate node n
É If 0-child and 1-child of n have same label, set label of n to bethat label
É If there is another node m such that m has the same variable xiand the children of n and m have same label, then set label of nto be the label of m
É Otherwise set label of n to be next unused integer
Reference: Logic in Computer Science, 2nd edition, by Huth and RyanSection 6.2.1
13/20
Algorithm to reduce OBDD
É Leaves: Label all 0 leaves with #0 and all 1 leaves with #1
É Intermediate node n
É If 0-child and 1-child of n have same label, set label of n to bethat label
É If there is another node m such that m has the same variable xiand the children of n and m have same label, then set label of nto be the label of m
É Otherwise set label of n to be next unused integer
Reference: Logic in Computer Science, 2nd edition, by Huth and RyanSection 6.2.1
13/20
Coming next: Algorithm for OBDD1 + OBDD2
14/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y
y
z z z z
0 1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z
z z z
0 1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z
z z
0 1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z
z z
0
1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z
z z
0 1
1 1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z
z z
0 1 1
1 0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z
z z
0 1 1 1
0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z
z
0 1 1 1
0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1
0 1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1 0
1 1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1 0 1
1 1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1 0 1 1
1
+
15/20
x
y y
z z z z
0 1 0 0 0 1 1 1
x
y y
z z z z
0 0 1 1 0 1 0 1
x
y y
z z z z
0 1 1 1 0 1 1 1
+
15/20
x
y y
z z z z
R1
R2 R3
R4 R5 R6 R7
0 1 0 0 0 1 1 1
x
y z
S1
S2 S3
0 1
x
y y
z z z z
(R1,S1)
(R2,S2) (R3,S3)
(R4, 0) (R5, 1) (R6,S3) (R7,S3)
0 1 1 1 0 1 1 1
16/20
x
y y
z z z z
R1
R2 R3
R4 R5 R6 R7
0 1 0 0 0 1 1 1
x
y z
S1
S2 S3
0 1
x
y y
z z z z
(R1,S1)
(R2,S2) (R3,S3)
(R4, 0) (R5, 1) (R6,S3) (R7,S3)
0 1 1 1 0 1 1 1
16/20
x
y y
z z z z
R1
R2 R3
R4 R5 R6 R7
0 1 0 0 0 1 1 1
x
y z
S1
S2 S3
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 x4
x4
0 1
0 1 1 1
0
1
1
(R1 ,S1)
(R2 ,S3) (R3 ,S2)
(R4 ,S3) (R3 ,S3)
(R4 ,S3) (1,S3)
(R4 ,S3)
Reduce the resulting OBDD
17/20
x1
x2
x3
x4
0 1
R1
R2
R3
R4
x1
x3
x4
0 1
S1
S3
S2
17/17
x1
x2
x3
x4
0 1
R1
R2
R3
R4
x1
x3
x4
0 1
S1
S3
S2
17/17
x1
x2 x3
x4 x3
x4 x4
x4
0 1
0 1 1 1
0 1
1
(R1 ,S1)
(R2 ,S3) (R3 ,S2)
(R4 ,S3) (R3 ,S3)
(R4 ,S3) (1,S3)
(R4 ,S3)
Reduce the resulting OBDD
17/20
x1
x2
x3
x4
0 1
R1
R2
R3
R4
x1
x3
x4
0 1
S1
S3
S2
17/17
x1
x2
x3
x4
0 1
R1
R2
R3
R4
x1
x3
x4
0 1
S1
S3
S2
17/17
x1
x2 x3
x4 x3
x4 x4
x4
0 1
0 1 1 1
0 1
1
(R1 ,S1)
(R2 ,S3) (R3 ,S2)
(R4 ,S3) (R3 ,S3)
(R4 ,S3) (1,S3)
(R4 ,S3)
Reduce the resulting OBDD17/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))
É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)
É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Algorithm for OBDD1 + OBDD2
apply(+, r, s)
É If both r and s are terminals, create a terminal node r + s
É If both r and s are xi nodes, create an xi node with:
É left child: apply(+,left(r),left(s))É right child: apply(+,right(r),right(s))
É If r is xi node and s is a terminal or an xj node with j > i, create an xi
node with:
É left child: apply(+,left(r), s)É right child: apply(+,right(r), s)
É If s is xi node and r is a terminal: similar to Case 3
OBDD1 +OBDD2: apply(+, root1, root2) and then reduce
18/20
Operations on BDDs
É OR: apply(+ , root1, root2)
É AND: apply(· , root1, root2)
É XOR: apply(XOR ,root1, root2)
É NOT: Use the fact that f = f XOR 1
19/20
OBDDs
Reduction algorithm
Operations on OBDDs
20/20