Presentation is loading. Please wait.

Presentation is loading. Please wait.

IT University of Copenhagen Lecture 7: BDD Construction and Manipulation 1. BDD construction 2. Boolean operations on BDDs 3. BDD-Based configuration.

Similar presentations


Presentation on theme: "IT University of Copenhagen Lecture 7: BDD Construction and Manipulation 1. BDD construction 2. Boolean operations on BDDs 3. BDD-Based configuration."— Presentation transcript:

1 IT University of Copenhagen Lecture 7: BDD Construction and Manipulation 1. BDD construction 2. Boolean operations on BDDs 3. BDD-Based configuration

2 IT University of Copenhagen Today’s Program [12:00-13:15] – Unique table – Build(t) – Apply(op,u 1,u 2 ) – BDD-Based configuration (SJHAHM04) [13:20-14:00] Henrik Hulgaard, Configit A/S – A configuration technology company  2011 Rune Møller Jensen 2

3 IT University of Copenhagen BDD Construction 3  2011 Rune Møller Jensen

4 IT University of Copenhagen Last week: 1.Make a Decision Tree of formula 2.Keep reducing it until no further reductions are possible This week: Reduce the decision tree to a BDD while building it BDD construction 4  2011 Rune Møller Jensen

5 IT University of Copenhagen Represent BDD by a table of unique nodes (UT) Build BDDs recursively, i.e. to add a new node u: 1.Compute high(u) and low(u) and store them in UT 2.Maintain BDD reductions when adding u to UT: a)Only extend UT with u if high(u)  low(u) (non-redundancy test) b)Only extend UT with u if u  UT (uniqueness) Reduce decision tree to BDD during construction 5  2011 Rune Møller Jensen

6 IT University of Copenhagen Unique Table Representation Node Attributes Represent Unique Table by two tables T and H T : u  (i,l,h) H: (i,l,h)  u 6  2011 Rune Møller Jensen H is the inverse of T: T(u) = (i,l,h)  H(i,l,h) = u u unique node identifier {0,1,2,3,…} i = var(u) variable index {1,2,…,n,n+1} l = low(u) node identifier of low h = high(u) node identifier of high u low(u)high(u) var(u)

7 IT University of Copenhagen Primitive Operations on T and H 7  2011 Rune Møller Jensen

8 IT University of Copenhagen Unique Table Interface: MakeNode (M K ) 8  2011 Rune Møller Jensen

9 IT University of Copenhagen Idea: Construct the BDD recursively using the Shannon Expansion t = x  t[1/x], t[0/x] Terminal cases Build(0) = 0 Build(1) = 1 Recursive case Build(t(x i,x i+1,…,x n )) = Mk( ) BuildBuild 9  2011 Rune Møller Jensen Build(t(0,x i+1,…,x n )) Build(t(1,x i+1,…,x n )) xixi

10 IT University of Copenhagen BuildBuild 10  2011 Rune Møller Jensen

11 IT University of Copenhagen BDD Manipulation 11  2011 Rune Møller Jensen

12 IT University of Copenhagen Multi-Rooted BDD  2011 Rune Møller Jensen 12 5 6 x1x1 x2x2 x3x3 2 34 10 Unique Table contains many BDDs x1  x3x1  x3 x1  x2x1  x2 x2x2

13 IT University of Copenhagen ApplyApply Apply(op,u 1,u 2 ): computes the BDD of u 1 op u 2 where op : any of the 16 Boolean operators u 1, u 2 : root nodes of BDDs Relies on the Shannon expansion properties: (x  t 1,t 0 ) op (x  t’ 1,t’ 0 )  x  (t 1 op t’ 1 ),(t 0 op t’ 0 ) (x  t 1,t 0 ) op t  x  (t 1 op t),(t 0 op t) 13  2011 Rune Møller Jensen

14 IT University of Copenhagen Terminal case: u  {0,1} u’  {0,1} App(u  u’) = u  u’ Recursive case: u = x v  u 1, u 0 u’ = x w  u’ 1, u’ 0 App(u  u’) = Mk(x v, App(u 0  u’ 0 ), App(u 1  u’ 1 ) )if v = w Mk(x v, App(u 0  u’), App(u 1  u’) ) if v < w Mk(x w, App(u  u’ 0 ), App(u  u’ 1 ) ) if w < v Apply with op =  14  2011 Rune Møller Jensen

15 IT University of Copenhagen 15  2011 Rune Møller Jensen

16 IT University of Copenhagen Construct BDDs from expression tree 16  2011 Rune Møller Jensen   x1x1 x2x2 x3x3 u 5  u 4 u 2  u 3 x1x1 x2x2 x3x3 u2u2 u3u3 u4u4 u5u5 u6u6

17 IT University of Copenhagen Properties of Apply Improvements? – Early termination. E.g., no reason to keep recursing if the left side in a conjunction is 0 Complexity : O(|u 1 ||u 2 |), due to dynamic programming So a BDD of any formula can be computed in poly time? 17  2011 Rune Møller Jensen

18 IT University of Copenhagen BDDsBDDs Compact Equality check easy Easy to evaluate the truth-value of an assignment Boolean operations efficient SAT check efficient Tautology check efficient Easy to implement 18  2011 Rune Møller Jensen

19 IT University of Copenhagen BDD-Based Configuration 19  2011 Rune Møller Jensen

20 IT University of Copenhagen A configuration problem C is a triple (Y,D,F) – Y is a set of variables y 1, y 2, …,y n – D is the Cartesian product of their finite domains D = D 1  D 2  …  D n – F = {f 1,f 2,…,f m } is a set of propositional formulas over atomic propositions y i = v, where v  D i, specifying the conditions that the variable assignments must satisfy. Each formula is inductively defined by f  y i = v | f  g | f  g |  f Configuration Problems 20  2011 Rune Møller Jensen

21 IT University of Copenhagen y 1  {black, white, red, blue}: Color y 2  {small, medium, large}: Size y 3  {“Men in black” - MIB, “Save the whales” -STW}: Print f 1  (y 3 = MIB)  (y 1 = black) f 2  (y 3 = STW)  (y 2  small) y 1 y 2 y 3 blacksmallMIB whitemediumSTW redlarge blue T-Shirt Example 1 21  2011 Rune Møller Jensen 1 : Due to Erik van der Meer, now at Microsoft

22 IT University of Copenhagen y 1  {black, white, red, blue}: Color y 2  {small, medium, large}: Size y 3  {“Men in black” - MIB, “Save the whales” -STW}: Print f 1  (y 3 = MIB)  (y 1 = black) f 2  (y 3 = STW)  (y 2  small) y 1 y 2 y 3 blacksmallMIB whitemediumSTW redlarge blue T-Shirt Example 1 22  2011 Rune Møller Jensen 1 : Due to Erik van der Meer, now at Microsoft

23 IT University of Copenhagen y 1  {black, white, red, blue}: Color y 2  {small, medium, large}: Size y 3  {“Men in black” - MIB, “Save the whales” -STW}: Print f 1  (y 3 = MIB)  (y 1 = black) f 2  (y 3 = STW)  (y 2  small) y 1 y 2 y 3 blacksmallMIB whitemediumSTW redlarge blue T-Shirt Example 1 23  2011 Rune Møller Jensen 1 : Due to Erik van der Meer, now at Microsoft

24 IT University of Copenhagen y 1  {black, white, red, blue}: Color y 2  {small, medium, large}: Size y 3  {“Men in black” - MIB, “Save the whales” -STW}: Print f 1  (y 3 = MIB)  (y 1 = black) f 2  (y 3 = STW)  (y 2  small) y 1 y 2 y 3 blacksmallMIB whitemediumSTW redlarge blue T-Shirt Example 1 24  2011 Rune Møller Jensen 1 : Due to Erik van der Meer, now at Microsoft

25 IT University of Copenhagen y 1  {black, white, red, blue}: Color y 2  {small, medium, large}: Size y 3  {“Men in black” - MIB, “Save the whales” -STW}: Print f 1  (y 3 = MIB)  (y 1 = black) f 2  (y 3 = STW)  (y 2  small) y 1 y 2 y 3 blacksmallMIB whitemediumSTW redlarge blue T-Shirt Example 1 25  2011 Rune Møller Jensen 1 : Due to Erik van der Meer, now at Microsoft

26 IT University of Copenhagen IPC(C) 1.R  C OMPILE (C) 2. while |R| > 1 do 3. choose (y i = v)  V ALID A SSIGNMENTS (R) 4. R  R  (y i = v) Interactive Product Configurator 26  2011 Rune Møller Jensen

27 IT University of Copenhagen Idea 1.Use a BDD to represent R 2.Use a polynomial-time BDD algorithm to compute V ALID A SSIGNMENTS (R) BDD-based configuration 27  2011 Rune Møller Jensen

28 IT University of Copenhagen 1.Define domains in binary 00 : black, 01 : white, 10 : red, 11 : blue 00 : small, 01 : medium, 10 : large 0 : MIB, 1 : STW 2.Build a BDD of the rules Represent R by a BDD 28

29 IT University of Copenhagen Trace paths for each variable layer in the BDD Compute V ALID A SSIGNMENTS (R) 29

30 IT University of Copenhagen Henrik Hulgaard configit 30  2011 Rune Møller Jensen


Download ppt "IT University of Copenhagen Lecture 7: BDD Construction and Manipulation 1. BDD construction 2. Boolean operations on BDDs 3. BDD-Based configuration."

Similar presentations


Ads by Google