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

Slides:



Advertisements
Similar presentations
Lower Bounds for Exact Model Counting and Applications in Probabilistic Databases Paul Beame Jerry Li Sudeepa Roy Dan Suciu University of Washington.
Advertisements

NP-Hard Nattee Niparnan.
Time-Space Tradeoffs in Resolution: Superpolynomial Lower Bounds for Superlinear Space Chris Beck Princeton University Joint work with Paul Beame & Russell.
Chaff: Engineering an Efficient SAT Solver Matthew W.Moskewicz, Concor F. Madigan, Ying Zhao, Lintao Zhang, Sharad Malik Princeton University Modified.
Presented by Monissa Mohan 1.  A highly optimized BCP algorithm  Two watched literals  Fast Backtracking  Efficient Decision Heuristic  Focused on.
Chaff: Engineering an Efficient SAT Solver Matthew W.Moskewicz, Concor F. Madigan, Ying Zhao, Lintao Zhang, Sharad Malik Princeton University Presenting:
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Max Cut Problem Daniel Natapov.
Effective Propositional Reasoning CSE 473 – Autumn 2003.
Using Problem Structure for Efficient Clause Learning Ashish Sabharwal, Paul Beame, Henry Kautz University of Washington, Seattle April 23, 2003.
Time-Space Tradeoffs in Resolution: Superpolynomial Lower Bounds for Superlinear Space Chris Beck Princeton University Joint work with Paul Beame & Russell.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View SAT.
1/30 SAT Solver Changki PSWLAB SAT Solver Daniel Kroening, Ofer Strichman.
Logical Foundations of AI SAT Henry Kautz. Resolution Refutation Proof DAG, where leaves are input clauses Internal nodes are resolvants Root is false.
ECE 667 Synthesis & Verification - SAT 1 ECE 667 ECE 667 Synthesis and Verification of Digital Systems Boolean SAT CNF Representation Slides adopted (with.
Discrete Structures & Algorithms The P vs. NP Question EECE 320.
A Differential Approach to Inference in Bayesian Networks - Adnan Darwiche Jiangbo Dang and Yimin Huang CSCE582 Bayesian Networks and Decision Graph.
Constraint Satisfaction and the Davis-Putnam-Logeman-Loveland Procedure Henry Kautz.
Presented by Ed Clarke Slides borrowed from P. Chauhan and C. Bartzis
1 Sampling, Counting, and Probabilistic Inference Wei joint work with Bart Selman.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
1 Understanding the Power of Clause Learning Ashish Sabharwal, Paul Beame, Henry Kautz University of Washington, Seattle IJCAI ConferenceAug 14, 2003.
Knowledge Representation II (Inference in Propositional Logic) CSE 473 Continued…
A Differential Approach to Inference in Bayesian Networks - Adnan Darwiche Jiangbo Dang and Yimin Huang CSCE582 Bayesian Networks and Decision Graphs.
1 Paul Beame University of Washington Phase Transitions in Proof Complexity and Satisfiability Search Dimitris Achlioptas Michael Molloy Microsoft Research.
SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment.
Penn ESE 535 Spring DeHon 1 ESE535: Electronic Design Automation Day 21: April 21, 2008 Modern SAT Solvers ({z}Chaff, GRASP,miniSAT)
Logic - Part 2 CSE 573. © Daniel S. Weld 2 Reading Already assigned R&N ch 5, 7, 8, 11 thru 11.2 For next time R&N 9.1, 9.2, 11.4 [optional 11.5]
Time-Space Tradeoffs in Proof Complexity: Superpolynomial Lower Bounds for Superlinear Space Chris Beck Princeton University Joint work with Paul Beame.
Ten Challenges Redux: Recent Progress in Propositional Reasoning & Search A Biased Random Walk Henry Kautz University of Washington.
Performing Bayesian Inference by Weighted Model Counting Tian Sang, Paul Beame, and Henry Kautz Department of Computer Science & Engineering University.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Toward a Universal Inference Engine Henry Kautz University of Washington With Fahiem Bacchus, Paul Beame, Toni Pitassi, Ashish Sabharwal, & Tian Sang.
Survey Propagation. Outline Survey Propagation: an algorithm for satisfiability 1 – Warning Propagation – Belief Propagation – Survey Propagation Survey.
Conformant Probabilistic Planning via CSPs ICAPS-2003 Nathanael Hyafil & Fahiem Bacchus University of Toronto.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
First-Order Logic and Inductive Logic Programming.
Boolean Satisfiability Present and Future
SAT 2009 Ashish Sabharwal Backdoors in the Context of Learning (short paper) Bistra Dilkina, Carla P. Gomes, Ashish Sabharwal Cornell University SAT-09.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Satisfiability and SAT Solvers CS 270 Math Foundations of CS Jeremy Johnson.
SAT Solving As implemented in - DPLL solvers: GRASP, Chaff and
AAAI of 20 Deconstructing Planning as Satisfiability Henry Kautz University of Rochester in collaboration with Bart Selman and Jöerg Hoffmann.
Inference in Propositional Logic (and Intro to SAT) CSE 473.
A COURSE ON PROBABILISTIC DATABASES Dan Suciu University of Washington June, 2014Probabilistic Databases - Dan Suciu 1.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
1 P NP P^#P PSPACE NP-complete: SAT, propositional reasoning, scheduling, graph coloring, puzzles, … PSPACE-complete: QBF, planning, chess (bounded), …
CS137: Electronic Design Automation
Inference in Propositional Logic (and Intro to SAT)
Clause Learning in a SAT-Solver
Inference and search for the propositional satisfiability problem
Gábor Kusper University of Linz RISC Austria
EA C461 – Artificial Intelligence Logical Agent
A New Algorithm for Computing Upper Bounds for Functional EmajSAT
First-Order Logic and Inductive Logic Programming
Local Search Strategies: From N-Queens to Walksat
Logic Synthesis CNF Satisfiability.
SAT-Based Area Recovery in Technology Mapping
ECE 667 Synthesis and Verification of Digital Circuits
CS 188: Artificial Intelligence
Provably hard problems below the satisfiability threshold
Artificial Intelligence
Switching Lemmas and Proof Complexity
Presentation transcript:

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)

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

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

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

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

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

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)

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:

#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;

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!

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?

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

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

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!

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!

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

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

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;...

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

Random 3-SAT, 75 Variables sat/unsat threshhold

Random 3-SAT Results relsatCC+CL 3,8092 5,9975 5, , V, R=1.0 relsatCC+CL 17, , ,60652 time out121 75V, R=1.4 relsatCC+CL 7, , V, R=1.6relsatCC+CL13, , V, R=2.0

Results: Pebbling Formulas layersvar/clausesolutionsrelsatCC+CLLinearCCCL756/927.79E / E / E / E+18X / E+54X X 20420/ E+95X3XXX 25650/ E+151X35XXX 30930/ E+218X37XXX X means time-out after 12 hours

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

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, …

Questions?

Results: Planning Formulas pddlvar/clausesolutionsrelsatCC+CLCCCLLinear1939/ E+20< / E / E / E X / E XXX / E X X means time-out after 12 hours

Results: Circuit Synthesis var/clausesolutionsrelsatCC+CLCCCLLinearra1236/ E rb1854/ E bit_comp6150/ E bit_add10590/ X rand1304/ E rc2472/ E X means time-out after 12 hours

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

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

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

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

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