26
1 www.itu.dk Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University of Copenhagen Denmark Microsoft Research, Cambridge UK

Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

Embed Size (px)

Citation preview

Page 1: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

1www.itu.dk

Knowledge Compilation Properties of Tree-of-BDDs

Sathiamoorthy Subbarayan

AAAI-2007, Vancouver

Lucas Bordeaux, Youssef Hamadi

IT University of CopenhagenDenmark

Microsoft Research, Cambridge UK

Page 2: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

2www.itu.dk

Knowledge Compilation

• Compile a system model in to a form– Forms: BDD, DNNF, d-DNNF, Tree-of-BDDs

• Quickly answer interesting queries

• Applications: configuration, verification, fault-trees, Bayesian networks, model-based diagnosis, etc.,

Page 3: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

3www.itu.dk

Compilation Forms

Form Size Compiler

DNNF (JACM 2001)

Tree-of-BDDs (CPAIOR 2005)

d-DNNF (JAIR 2002)

BDD(IEEE Comp. 1986)

Tree-of-BDDs even 1000 times smaller than d-DNNF

Page 4: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

4www.itu.dk

Binary Decision Diagrams

A compressed representation of solutions

Answers many queries in polytime

Page 5: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

5www.itu.dk

CNF to BDD

bdd

CNF clauses

BDD

C1

C4

C2

C3

C5

C7

C6

c1 c2

c3

c4

c5

c6

c7

clause BDDs

AND

Page 6: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

6www.itu.dk

Tree-of-BDDs (ToB)

C1

C2C3

C4

C5C6

C7

Tree Decomposition

ToB

CNF clauses

C1

C4

C2

C3

C5

C7

C6

c1 c2

c3 c4

c5c6

c7clause BDDs

b1

b2

b3

AND+Propagate

Page 7: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

7www.itu.dk

Example: CNF to ToB: (¬a+¬e)

: (a+b)

: (b+¬c)

: (c+¬d)

: (¬b+¬d)

C1

C4

C2

C3

C5

c5

c3

c1

c2c4

C1

C2

C4

C5C3

Tree Decomposition

ToB

CNF clauses

Group clause-BDDs

AND+Propagate

Page 8: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

8www.itu.dk

Example Comparison

OBDD14 edges

d-DNNF15 edges

12 edgesToB

Exploits tree-width!

Page 9: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

9www.itu.dk

Some Interesting Queries

• Consistency (CO)• Validity (VA)• Clausal Entailment (CE)• Implicant Check (IM)• Equality (EQ)• Sentential Entailment (SE)• Model Counting (CT) • Model Enumeration (ME)

Page 10: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

10www.itu.dk

Conditioning ToB

Condition (ToB, term) //Restrict ToB by term

Restrict each BDD with term

Propagate

Worst case exponential in tree-width!

Page 11: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

11www.itu.dk

Clausal Entailment, Implicant Check

IsCE (ToB, clause) //Does ToB entails the clause

Condition (ToB, ¬clause)

if (ToB=false) return true

else return false

IsIM (ToB, term) //Does the term entails ToB

Condition (ToB, term)

if ( term entails each BDD ) return true

else return false

Page 12: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

12www.itu.dk

Complexity of Queries

Form CO VA CE IM EQ SE CT ME

DNNF

ToB

d-DNNF

OBDD

Polytime

Polytime if P=NP

Worst case exponential in w

Worst case exponential in (w1 + w2)

Page 13: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

13www.itu.dk

Query Complexity Vs. Size

Form CO VA CE IM EQ SE CT ME Size

DNNF

ToB

d-DNNF

OBDD

Realistic instances often have low treewidth !

ToB exploits it well !!

Page 14: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

14www.itu.dk

Experiments

• 91 realistic CNF instances– 35 Mercedes car configuration problems– 7 ISCAS85 circuits– 17 ISCAS89 circuits– 14 ISCAS93 Addendum circuits– 13 ISCAS99 circuits– 5 Bounded model checking circuits

• Compare with c2d, a d-DNNF compiler• Simulate CE and IM queries on ToBs

Page 15: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

15www.itu.dk

Tools, Instances, Presentation

http://www.itu.dk/~sathi/tob/

Page 16: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

16www.itu.dk

Compilation Overview

Form d-DNNF (hg) d-DNNF (mf) ToB

#compiled 79 83 91

#failed 12 8 0

Total time* 13656 13176 926

Total size* 412.7 m 602.2 m 17.6 m

*for successful compilations

We could not find any realistic instance where d-DNNF beats ToB in compilation !

Realistic: Industrial instance in SAT competition

Page 17: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

17www.itu.dk

Details: Cases hard for d-DNNF Instance d-DNNF (hg) d-DNNF (mf) ToB

Name |V| |C| w Time Size Time Size Time Size

c1908 751 2053 46 269 26.1 TO   0.1 0.02

c7552 3185 8588 44 371 28.9 TO   1.02 0.22

s1269 623 1616 40 119 10 TO   0.18 0.05

s3271 1714 4269 35 TO   TO   0.55 0.15

s4863 2495 6434 33   FSE   FSE 5.09 1.31

s6669 3392 8423 26 TO   348 57.53 0.44 0.16

cnt09 92073067

823 TO   168 0.01 1.86 0.09

cnt10 204706856

126 TO   TO   5.41 0.21

C168FW 1909 7477 110 TO   296 5.54 8.05 0.21

C170FR 18741061

0203 TO   365 5.9 15 0.58

C202FS 1990 8883 88 TO   TO   9.58 0.41

C202FW 20381134

299 TO   TO   65 0.94

C208FC 1922 7518 194 TO   243 9.56 18 0.93

C210FS 1990 7982 84 TO   2370 51.34 12 0.91

C210FW 2024 9705 98 TO   3352 71.63 663 3.64

Very low treewidth!

ToB even 1000 times smaller than d-DNNF!

Page 18: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

18www.itu.dk

CE and IM SimulationInstance ToB - CE Time ToB - IM Time

Name Mean Max >1s % Mean Max >1s %

c1908 0.01 0.06 0 0.01 0.04 0

c7552 0.06 0.46 0 0.06 0.49 0

s1269 0.02 0.13 0 0.02 0.14 0

s3271 0.04 0.19 0 0.04 0.19 0

s4863 0.29 6.13 6 0.31 4.49 5

s6669 0.03 0.31 0 0.05 0.33 0

cnt09 0.02 0.07 0 0.02 0.07 0

cnt10 0.04 0.17 0 0.04 0.16 0

C168FW 0.02 0.23 0 0.04 0.22 0

C170FR 0.04 0.77 0 0.11 0.75 0

C202FS 0.04 0.75 0 0.1 0.76 0

C202FW 0.09 2.62 2 0.21 2.26 4

C208FC 0.17 1.42 3 0.17 1.37 3

C210FS 0.09 2.16 2 0.22 2.17 5

C210FW 0.38 10.7 4 1.01 10.42 30

Quick responses!

Page 19: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

19www.itu.dk

Compilation Time: ToB vs. d-DNNF

ToB is much faster

than d-DNNF

Page 20: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

20www.itu.dk

Compilation Space: ToB vs. d-DNNF

ToB is much

smaller than d-DNNF

Page 21: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

21www.itu.dk

Conclusion

• ToBs often very small in time and space• Even 1000 times smaller than d-DNNF • Still quick response to many queries

• Future work:– EQ Check, usefulness in verification ?– Succinctness of ToB vs d-DNNF– Transformations supported by ToB– Adopting ToBs for multi-core CPUs

Page 22: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

22www.itu.dk

Thanks!

Page 23: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

23www.itu.dk

Form CO VA CE IM EQ SE CT ME Size

DNNF

ToB

d-DNNF

OBDD

Realistic instances often have low treewidth !

ToB exploits it well !!

Query Complexity Vs. Size

Page 24: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

24www.itu.dk

Propagation in ToB

• Use a rooted BFS tree

• Propagate up– Makes each parent

consistent with children

• Propagate down – Makes each child

consistent with parent

Page 25: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

25www.itu.dk

Projection in ToB

Project (ToB, K) //Project ToB over K variables

Conjoin BDDs from bottom to top Early quantification of non-K variables

Worst case exponential in (w+|K|)

Page 26: Www.itu.dk 1 Knowledge Compilation Properties of Tree-of-BDDs Sathiamoorthy Subbarayan AAAI-2007, Vancouver Lucas Bordeaux, Youssef Hamadi IT University

26www.itu.dk

Equivalence Checking

IsEQ (ToB1, ToB2)

Project ToB1 over vars in each node of ToB2

-Check whether the two BDDs agree

Project ToB2 over vars in each node of ToB1

-Check whether the two BDDs agree

Worst case exponential in (w1+w2)