Presentation is loading. Please wait.

Presentation is loading. Please wait.

Combining Component Caching and Clause Learning for Effective Model Counting Tian Sang University of Washington Fahiem Bacchus (U Toronto), Paul Beame.

Similar presentations


Presentation on theme: "Combining Component Caching and Clause Learning for Effective Model Counting Tian Sang University of Washington Fahiem Bacchus (U Toronto), Paul Beame."— Presentation transcript:

1 Combining Component Caching and Clause Learning for Effective Model Counting Tian Sang University of Washington Fahiem Bacchus (U Toronto), Paul Beame (UW), Henry Kautz (UW), & Toniann Pitassi (U Toronto)

2 Why #SAT?  Prototypical #P complete problem  Natural encoding for counting problems  Test-set size  CMOS power consumption  Can encode probabilistic inference

3 Generality  SAT  #SAT  Bayesian Networks  Bounded-alternation Quantified Boolean formulas  Quantified Boolean formulas  Stochastic SAT #P complete NP complete PSPACE complete

4 Our Approach  Good old Davis-Putnam-Logemann- Loveland  Clause learning (“no good-caching”)  Bounded component analysis  Formula caching

5 DPLL( F ) while exists unit clause (y)  F F  F | y if F is empty, report satisfiable and halt if F contains the empty clause Add a conflict clause C to F return false choose a literal x return DPLL( F | x ) || DPLL( F |  x ) DPLL with Clause Learning

6 Conflict Graph Decision scheme (p  q   b) 1-UIP scheme (t) pp qq b a x1x1 x2x2 x3x3 y yy false tt Known Clauses (p  q  a) (  a   b   t) (t   x 1 ) (t   x 2 ) (t   x 3 ) (x 1  x 2  x 3  y) (x 2   y) Current decisions p  false q  false b  true

7 Component Analysis  Can use DPLL to count models  Just don’t stop when first assignment is found  If formula breaks into separate components (no shared variables), can count each separately and multiply results: #SAT(C  C) = #SAT(C) * #SAT(C) #SAT(C 1  C 2 ) = #SAT(C 1 ) * #SAT(C 2 ) (Bayardo & Shrag 1996)

8 Formula Caching  New idea: cache number of models of residual formulas at each node  Bacchus, Dalmao & Pitassi 2003  Beame, Impagliazzo, Pitassi, & Segerlind 2003  Matches time/space tradeoffs of best known exact probabilistic inference algorithms:

9 #SAT with Component Caching #SAT(F) // Returns fraction of all truth // assignments that satisfy F a = 1; a = 1; for each G  to_components(F) { if (G ==  ) m = 1; else if (   G) m = 0; else if (in_cache(G)) m = cache_value(G); else { select v  G; m = ½ * #SAT(G|v) + m = ½ * #SAT(G|v) + ½ * #SAT(G|  v); ½ * #SAT(G|  v); insert_cache(G,m); insert_cache(G,m);} if (m == 0) return 0; if (m == 0) return 0; a = a * m; } return a;

10 Putting it All Together  Goal: combine  Clause learning  Component analysis  Formula caching to create a practical #SAT algorithm to create a practical #SAT algorithm  Not quite as straightforward as it looks!

11 Issue 1: How Much to Cache?  Everything  Infeasible – often > 10,000,000 nodes  Only sub-formulas on current branch  Linear space  Similar to recursive conditioning [Darwiche 2002 ]  Can we do better?

12 Age versus Cumulative Hits age = time elapsed since the entry was cached

13 Efficient Cache Management  Age-bounded caching  Separate-chaining hash table  Lazy deletion of entries older than K when searching chains  Constant amortized time

14 Issue 2: Interaction of Component Analysis & Clause Learning  As clause learning progresses, formula becomes huge  1,000 clauses  1,000,000 learned clauses  Finding connected components becomes too costly  Components using learned clauses unlikely to reoccur!

15 Bounded Component Analysis  Use only clauses derived from original formula for  Component analysis  “Keys” for cached entries  Use all the learned clauses for unit propagation  Can this possibly be sound? Almost!

16 Safety Theorem Given: original formula F learned clauses G partial assignment  F|  is satisfiable A is a component of F|  A i is a component of F|   satisfies A  satisfies A i F|  G|  A2A2 A1A1 A3A3 Then:  can be extended to satisfy G|  It is safe to use learned clauses for unit propagation for SAT sub- formulas

17 UNSAT Sub-formulas  But if F|  is unsatisfiable, all bets are off...  Without component caching, there is still no problem – because the final value is 0 in any case  With component caching, could cause incorrect values to be cached  Solution: Flush siblings (& their descendents) of UNSAT components from cache

18 Safe Caching + Clause Learning Implementation... else if (   G) { m = 0; add a conflict clause; }... if (m==0) { flush_cache( siblings(G) ) if (G is not last child of F) flush_cache(G); return 0; } a = a * m;...

19 Evaluation  Implementation based on zChaff (Moskewicz, Madigan, Zhao, Zhang, & Malik 2001)  Benchmarks  Random formulas  Pebbling graph formulas  Circuit synthesis  Logistics planning

20 Random 3-SAT, 75 Variables sat/unsat threshhold

21 Random 3-SAT Results relsatCC+CL 3,8092 5,9975 5,8065 31,66020 75V, R=1.0 relsatCC+CL 17,82275 24,06670 24,60652 time out121 75V, R=1.4 relsatCC+CL 7,06035 15,047101 75V, R=1.6relsatCC+CL13,150179 32,998547 75V, R=2.0

22 Results: Pebbling Formulas layersvar/clausesolutionsrelsatCC+CLLinearCCCL756/927.79E+1010.010.070.040.27 872/1214.46E+14490.020.040.184 990/1545.94E+2314380.0660.5062 10110/1916.95E+18X0.060.670.926961 15240/4363.01E+54X0.53465106X 20420/7815.06E+95X3XXX 25650/12261.81E+151X35XXX 30930/17711.54E+218X37XXX X means time-out after 12 hours

23 Summary  A practical exact model-counting algorithm can be built by the careful combination of  Bounded component analysis  Component caching  Clause learning  Outperforms the best previous algorithm by orders of magnitude

24 What’s Next?  Better heuristics  component ordering  variable branching  Incremental component analysis  Currently consumes 10-50% of run time!  Applications to Bayesian networks  Compiler for discrete BN to weighted #SAT  Direct BN implementation  Applications to other #P problems  Testing, model-based diagnosis, …

25 Questions?

26 Results: Planning Formulas pddlvar/clausesolutionsrelsatCC+CLCCCLLinear1939/37855.64E+20<10.575880.75102 21337/247773.23E+10465643266245 31413/294872.80E+1141195545118261 42303/209632.34E+28200239X37662279 52701/295347.24E+3849571507XXX 122324/318578.29E+3612323950X3308216162 X means time-out after 12 hours

27 Results: Circuit Synthesis var/clausesolutionsrelsatCC+CLCCCLLinearra1236/114161.86E+286188998 rb1854/113245.39E+3718016172222 2bit_comp6150/3709.41E+20272201109746424 2bit_add10590/14220667475X509505 rand1304/5781.86E+5417313118613311128 rc2472/179427.71E+39322601485343513271747 X means time-out after 12 hours

28 Bayesian Nets to Weighted Counting  Introduce new vars so all internal vars are deterministic A B A~A B.2.6 A.1

29 Bayesian Nets to Weighted Counting  Introduce new vars so all internal vars are deterministic A B A~A B.2.6 A.1 A B PQ A.1P.2Q.6

30 Bayesian Nets to Weighted Counting  Weight of a model is product of variable weights  Weight of a formula is sum of weights of its models A B PQ A.1P.2Q.6

31 Bayesian Nets to Weighted Counting  Let F be the formula defining all internal variables  Pr(query) = weight(F & query) A B PQ A.1P.2Q.6

32 Bayesian Nets to Counting  Unweighted counting is case where all non-defined variables have weight 0.5  Introduce sets of variables to define other probabilities to desired accuracy  In practice: just modify #SAT algorithm to weighted #SAT


Download ppt "Combining Component Caching and Clause Learning for Effective Model Counting Tian Sang University of Washington Fahiem Bacchus (U Toronto), Paul Beame."

Similar presentations


Ads by Google