Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.

Slides:



Advertisements
Similar presentations
The behavior of SAT solvers in model checking applications K. L. McMillan Cadence Berkeley Labs.
Advertisements

Exploiting SAT solvers in unbounded model checking
Exploiting SAT solvers in unbounded model checking K. L. McMillan Cadence Berkeley Labs.
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:
Introduction to MiniSat v1.14 Presented by Yunho Kim Provable Software Lab, KAIST.
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View SAT.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
1/30 SAT Solver Changki PSWLAB SAT Solver Daniel Kroening, Ofer Strichman.
IBM Labs in Haifa © 2005 IBM Corporation Adaptive Application of SAT Solving Techniques Ohad Shacham and Karen Yorav Presented by Sharon Barner.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
Generating Hard Satisfiability Problems1 Bart Selman, David Mitchell, Hector J. Levesque Presented by Xiaoxin Yin.
The Theory of NP-Completeness
Properties of SLUR Formulae Ondřej Čepek, Petr Kučera, Václav Vlček Charles University in Prague SOFSEM 2012 January 23, 2012.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
Tuning SAT-checkers for Bounded Model-Checking A bounded guided tour Ofer Strichman Carnegie Mellon University.
© 2002 Fadi A. Aloul, University of Michigan PBS: A Pseudo-Boolean Solver and Optimizer Fadi A. Aloul, Arathi Ramani, Igor L. Markov, Karem A. Sakallah.
Weizmann Institute Tuning SAT-checkers for Bounded Model-Checking A bounded guided tour Ofer Shtrichman Weizmann Institute & IBM (HRL)
SAT-based Bounded Model Checking
Methods for SAT- a Survey Robert Glaubius CSCE 976 May 6, 2002.
Boolean Satisfiability Solvers Wonhong Nam
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
Penn ESE 535 Spring DeHon 1 ESE535: Electronic Design Automation Day 6: February 4, 2009 Modern SAT Solvers ({z}Chaff, GRASP,miniSAT)
08/1 Foundations of AI 8. Satisfiability and Model Construction Davis-Putnam, Phase Transitions, GSAT Wolfram Burgard and Bernhard Nebel.
Presented by Ed Clarke Slides borrowed from P. Chauhan and C. Bartzis
Chaff: Engineering an Efficient SAT Solver Matthew W.Moskewicz, Concor F. Madigan, Ying Zhao, Lintao Zhang, Sharad Malik Princeton University Presenting:
Algorithms in Exponential Time. Outline Backtracking Local Search Randomization: Reducing to a Polynomial-Time Case Randomization: Permuting the Evaluation.
1 Quantified Formulas Acknowledgement: QBF slides borrowed from S. Malik.
Ofer Strichman, Technion 1 Decision Procedures in First Order Logic Part I - Introduction.
GRASP-an efficient SAT solver Pankaj Chauhan. 6/19/ : GRASP and Chaff2 What is SAT? Given a propositional formula in CNF, find an assignment.
Complexity 19-1 Complexity Andrei Bulatov More Probabilistic Algorithms.
GRASP SAT solver Presented by Constantinos Bartzis Slides borrowed from Pankaj Chauhan J. Marques-Silva and K. Sakallah.
Efficient Reachability Checking using Sequential SAT G. Parthasarathy, M. K. Iyer, K.-T.Cheng, Li. C. Wang Department of ECE University of California –
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Pruning techniques for the SAT-based Bounded Model-Checking problem Ofer Shtrichman Weizmann Institute of Science & IBM - HRL.
Weizmann Institute Tuning SAT-checkers for Bounded Model-Checking A bounded guided tour Ofer Shtrichman Weizmann Institute & IBM-HRL.
1 Completeness and Complexity of Bounded Model Checking.
1 Abstraction Refinement for Bounded Model Checking Anubhav Gupta, CMU Ofer Strichman, Technion Highly Jet Lagged.
MAE 552 – Heuristic Optimization Lecture 5 February 1, 2002.
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)
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
1 Completeness and Complexity of Bounded Model Checking.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Digitaalsüsteemide verifitseerimise kursus1 Formal verification: SAT SAT applied in equivalence checking.
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Review of Propositional Logic Syntax
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 29.
Accelerating Random Walks Wei Wei and Bart Selman.
NPC.
SAT Solving As implemented in - DPLL solvers: GRASP, Chaff and
Complexity ©D.Moshkovits 1 2-Satisfiability NOTE: These slides were created by Muli Safra, from OPICS/sat/)
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
CS137: Electronic Design Automation
Inference and search for the propositional satisfiability problem
(xy)(yz)(xz)(zy)
NP-Completeness Yin Tat Lee
Heuristics for Efficient SAT Solving
Decision Procedures An Algorithmic Point of View
NP-Completeness Yin Tat Lee
GRASP-an efficient SAT solver
Presentation transcript:

Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.

2 The K-Coloring problem: Given an undirected graph G(V,E) and a natural number k, is there an assignment color: Formulation of famous problems as SAT: k-Coloring (1/2)

3 Formulation of famous problems as SAT: k-Coloring (2/2) x i,j = node i is assigned the ‘color’ j (1  i  n, 1  j  k) Constraints: i) At least one color to each node: (x 1,1  x 1,2  … x 1,k ) .... ii) At most one color to each node: iii) Coloring constraints:

4 Given a property p: (e.g. “always signal_a = signal_b”) Is there a state reachable within k cycles, which satisfies  p ?... s0s0 s1s1 s2s2 s k-1 sksk pp p pp p Formulation of famous problems as SAT: Bounded Model Checking (1/4)

5 The reachable states in k steps are captured by: The property p fails in one of the cycles 1..k: Formulation of famous problems as SAT: Bounded Model Checking (2/4)

6 The safety property p is valid up to cycle k iff  is unsatisfiable:... s0s0 s1s1 s2s2 s k-1 sksk pp p pp p Formulation of famous problems as SAT: Bounded Model Checking (3/4)

7 Example: a two bit counter Property: always (  l   r) For k = 2,  is unsatisfiabe. For k = 4  is satisfiable Initial state: Transition: For k = 2: Formulation of famous problems as SAT: Bounded Model Checking (4/4)

8 Given  in CNF: (x,y,z),(-x,y),(-y,z),(-x,-y,-z) Decide() Deduce() Resolve_Conflict()  X XX XX  A Basic SAT algorithm (1/3)

9 While (true) { if (!Decide()) return (SAT); while (!Deduce()) if (!Resolve_Conflict()) return (UNSAT); } Choose the next variable and value. Return False if all variables are assigned Apply unit clause rule. Return False if reached a conflict Backtrack until no conflict. Return False if impossible A Basic SAT algorithm (2/3)

10 bool Resolve_Conflict() { d = most recent decision not 'tried both ways’; if (d == NULL) return FALSE; flip the value of d; mark d as 'tried both ways’; undo invalidated implications; return true; } A Basic SAT algorithm (3/3)

11 Deduction() allocates new implied variables and conflicts. How can this be done efficiently ? A large set of CNF instances were used to identify the bottleneck of classical SAT solving. First conclusion: almost 90% of the time SAT solvers perform Deduction(). Second conclusion: dynamic decision strategies impose large overhead. Chaff enjoyed a ‘profiler-based’ development process.

12 Hold 4 counters for each clause  : Val1_neg_literals(  ) - # of negative literals assigned 0 in . Val1_pos_literals(  ) - # of positive literals assigned 1 in . Val0_neg_literals(  ) - # of negative literals assigned 1 in . Val0_pos_literals(  ) - # of positive literals assigned 0 in . Define: val1(  ) = Val1_pos_literals (  ) + Val1_neg_literals (  ) val0(  ) = Val0_pos_literals (  ) + Val0_neg_literals (  ) |  | = # literals in  Grasp implements Deduction() with counters (1/2)

13 Every assignment to a variable x results in updating the counters for all the clauses that contain x. Grasp implements Deduction() with counters (2/2)  is satisfied iff val1(  ) > 0  is unsatisfied iff val0(  ) = |  |  is unit iff val1(  ) = 0  val0(  ) = |  | - 1  is unresolved iff val1(  ) = 0  val0(  ) < |  | - 1. Backtracking: Same complexity.

14 Observation: during Deduction(), we are only interested in newly implied variables and conflicts. These occur only when the number of literals in  with value ‘false’ is greater than |  | - 2. (val0(  ) > |  | - 2) Chaff visits clause  only if O1(  ) or O2(  ) become ‘false’. Chaff implements Deduction() with a pair of observers (1/3) Define two ‘observers’: O1(  ), O2(  ). O1(  ) and O2(  ) point to two distinct  literals which are not ‘false’.  becomes unit if updating one observer leads to O1(  ) = O2(  ).

15 Both observers of an implied clause are on the highest decision level present in the clause. Therefore, backtracking will un-assign them first. Conclusion: when backtracking, observers stay in place. Chaff implements Deduction() with a pair of observers (2/3) V[1]=0 V[5]=0, v[4]= 0 V[2]=0 O1O2 Unit clause Backtrack v[4] = v[5]= X v[1] = 1 Backtracking: 0 complexity.

16 Chaff implements Deduction() with a pair of observers (3/3) The choice of observing literals is important. Best strategy is - the least frequently updated variables. The observers method has a learning curve in this respect: 1. The initial observers are chosen arbitrarily. 2. The process shifts the observers away from variables that were recently updated. These variables will most probably be reassigned in a short time. In our example: the next time v[5] is updated, it will point to a significantly smaller set of clauses.

17 l: # literals, v: # vars, c: # clauses, d: # decisions + implied vars Grasp Assignments + backtracks # clauses per var The # of updating operations ratio is (e.g. for 3-sat that’s 1/6). Several missing factors in the equations: 1) the complexity of each updating operation. 2) the learning curve of the observers. A (rough) quantitative comparison Chaff Negative assignments # clauses per var Probability of observing Avg. Length of clause

18 Decision heuristics (1/3) Grasp's default (DLIS) - Choose the literal which appears most frequently in unresolved clauses. (Requires l queries for each decision).

19 Chaff’s default: (VSIDS) - (Variable State Independent Decaying Sum) Decision heuristics (2/3) Chaff holds a list of unassigned variables sorted by the counter value. Updates are needed only when adding conflict clauses. Thus - decision is made in constant time. 4. Periodically, all the counters are divided by a constant. 3. The unassigned variable with the highest counter is chosen. 2. When a clause is added, the counters are updated. 1. Each variable in each polarity has a counter initialized to 0.

20 VSIDS is a ‘quasi-static’ strategy: - static because it doesn’t depend on var state - dynamic because it gradually changes. Variables that appear in recent conflicts have higher priority. Decision heuristics (3/3) This strategy is a conflict-driven decision strategy. “..employing this strategy dramatically (i.e. an order of magnitude) improved performance... “

21 GSAT: A different approach to SAT solving for i = 1 to max_tries { T := randomly generated truth assignment for j = 1 to max_flips { if T satisfies  return TRUE choose v s.t. flipping v’s value gives largest increase in the # of satisfied clauses (break ties randomly). T := T with v’s assignment flipped. } } Given a CNF formula , choose max_tries and max_flips

22 Improvement # 1: clause weights Initial weight of each clause: 1 Increase by k the weight of unsatisfied clauses. Choose v according to max increase in weight Clause weights is another example of conflict-driven decision strategy.

23 Improvement # 2: Averaging-in Q: Can we reuse information gathered in previous tries in order to speed up the search ? A: Yes! Rather than choosing T randomly each time, repeat ‘good assignments’ and choose randomly the rest.

24 Let X1, X2 and X3 be equally wide bit vectors. Define a function bit_average : X1  X2  X3 as follows: b 1 i b 1 i = b 2 i randomotherwise (where b j i is the i-th bit in Xj, j  {1,2,3}) Improvement # 2: Averaging-in (cont’d) b 3 i :=

25 Improvement # 2: Averaging-in (cont’d) Let T i init be the initial assignment (T) in cycle i. Let T i best be the assignment with highest # of satisfied clauses in cycle i. T 1 init := random assignment. T 2 init := random assignment.  i > 2, T i init := bit_average (T i-1 best, T i-2 best )