sat solvers
play

SAT Solvers Aditya Parameswaran Luv Kumar 1st June, 2005 and 14th - PowerPoint PPT Presentation

IIT Bombay - CFDVS SAT Solvers Aditya Parameswaran Luv Kumar 1st June, 2005 and 14th June, 2005 Aditya Parameswaran, Luv Kumar: SAT Solvers, 1 Outline Outline The Satisfiability Problem Types of Solvers The basic DPLL


  1. IIT Bombay - CFDVS SAT Solvers Aditya Parameswaran Luv Kumar 1st June, 2005 and 14th June, 2005 Aditya Parameswaran, Luv Kumar: SAT Solvers, 1

  2. Outline Outline � The Satisfiability Problem � Types of Solvers � The basic DPLL Framework � Variations to the DPLL Algorithm � Branching Heuristics Deduction Mechanism Conflict Analysis and Learning Other Techniques Stalmarcks Algorithm � More Details And Examples � Comparison of BerkMin and Chaff on Branching Heuristics Comparison of Chaff and SATO in BCP Local Search � Phase Transitions � More Details on Stalmarcks method � Equivalence Classes References � Aditya Parameswaran, Luv Kumar: SAT Solvers, 2

  3. The Satisfiability Problem ◮ Given a Boolean propositional formula, does there exist assignment of values such that the formula becomes true? ◮ We consider a CNF formula, C 1 ∧ C 2 ∧ C 3 ∧ C 4 . . . , where, ◮ C i is a disjunction of literals like a , ¬ b , c , . . . Aditya Parameswaran, Luv Kumar: SAT Solvers, 3

  4. The Satisfiability Problem History of the SAT Problem ◮ Davis Putnam - Resolution based, 1960, later proposed Search based algorithm, 1962 ◮ Proved NP Complete by Cook, 1971 ◮ Stalmarcks algorithm - Patented, 1995 ◮ Conflict driven Learning and Non chronological backtracking in GRASP, 1996 ◮ Local Search, 1997 ◮ SATO - DPLL Based, 1997 ◮ Chaff - DPLL Based, 2001 ◮ BerkMin - DPLL Based, 2002 Aditya Parameswaran, Luv Kumar: SAT Solvers, 4

  5. Types of Solvers Two Types: ◮ Complete - find a solution or prove that none exist, e.g. Resolution, Search, Stalmarcks, BDDs ◮ Stochastic - do not prove unsatisfiability, can get some solutions quickly, e.g. Local Search Aditya Parameswaran, Luv Kumar: SAT Solvers, 5

  6. The basic DPLL Framework Algorithm: DPLL(formula, assignment) { if (deduce(formula, assignment) == SAT) return SAT; else if (deduce(formula, assignment) == CONF) return CONF; else { v = new_variable(formula, assignment); a = new_assignment(formula, assignment, v, 0); if (DPLL(formula, a) == SAT) return SAT; else { a = new_assignment(formula, assignment, v, 1); return DPLL(formula, a); } } } Aditya Parameswaran, Luv Kumar: SAT Solvers, 6

  7. Variations to the DPLL Algorithm Iterative Algorithm while(1) { decide_next_branch(); //branching heuristics while (true) { status = deduce(); //deduction mechanism if (status == CONF) { bl = analyze_conflict(); //conflict analysis if (bl == 0) return UNSAT; else backtrack(bl); } else if (status == SATISFIABLE) return SAT; else break; } } Aditya Parameswaran, Luv Kumar: SAT Solvers, 7

  8. Variations to the DPLL Algorithm Outline � The Satisfiability Problem � Types of Solvers � The basic DPLL Framework � Variations to the DPLL Algorithm � Branching Heuristics Deduction Mechanism Conflict Analysis and Learning Other Techniques Stalmarcks Algorithm � More Details And Examples � Comparison of BerkMin and Chaff on Branching Heuristics Comparison of Chaff and SATO in BCP Local Search � Phase Transitions � More Details on Stalmarcks method � Equivalence Classes References � Aditya Parameswaran, Luv Kumar: SAT Solvers, 8

  9. Variations to the DPLL Algorithm Branching Heuristics ◮ Branching Heuristics alter the search path and thereby change the structure of the search tree ◮ In the original DPLL paper, a branch was randomly chosen ◮ DLCS (Dynamic Largest Combined Sum) • Introduced in GRASP • Pick the variable with largest number of occurrences in unresolved clauses • State dependent • Considerable work reqd. • Static Statistic, does not take search history into consideration • Differentiation between learned and original clauses required. Aditya Parameswaran, Luv Kumar: SAT Solvers, 9

  10. Variations to the DPLL Algorithm ◮ VSIDS (Variable State Independent Decaying Sum) • Introduced in Chaff • Choose variable with highest score to branch • Initial score is the number of clauses with the variable • Periodic division by a constant • Incrementation by a constant on addition of new clauses with the variable • State Independent • Focus on recent clauses ◮ BerkMin method • Simliar to the Chaff method • When a conflict occurs, all literals in the clauses responsible for the conflict have their scores increased • Periodic divison by a constant • Branch on one of the variables present in the last added clause Aditya Parameswaran, Luv Kumar: SAT Solvers, 10

  11. Variations to the DPLL Algorithm Deduction Mechanism ◮ Most important part of the solver (maximum time spent here) ◮ The function deduce() tries to see if by the current assignment of values to variables, some conclusions can be got regarding the satisfiability of the formula ◮ It returns SAT if the assignment causes a satisfying instance and CONF if it causes a conflict, else returns UNKNOWN and updates the program state. ◮ All SAT solvers use the unit clause rule ◮ The unit clause rule states that if all but one of the literals in a clause are assigned false, then that literal is assigned true ◮ Such clauses are called unit clauses the unassigned literal is a unit literal , the process of assigning 1 to all such literals is called BCP ( Boolean Constraint Propagation ) ◮ Counter Method is used in GRASP, Head-Tail List Method is from SATO, and Two-Literal watch was first used in Chaff Aditya Parameswaran, Luv Kumar: SAT Solvers, 11

  12. Variations to the DPLL Algorithm Deduction Mechanism (contd.) ◮ Counter Method • Simple method of keeping track of which clauses are satisfied or conflicting • Each clause has 3 variables: number of 1 value literals, number of 0 value literals and total number of literals • When number of 0 value literals equals total number, the clause is contradictory • When number of 0 value literals equals total number minus one and number of 1 value literals equals 0 then it is an unit clause • With m clauses and n variables and on an average l literals per clause then on an average ml / n counters are updated • Undo takes same number of operations Aditya Parameswaran, Luv Kumar: SAT Solvers, 12

  13. Variations to the DPLL Algorithm ◮ Head-Tail List method • Each clause maintains two pointers, the head and tail pointer • Each variable maintains 4 linked lists, pos-head, neg-head, pos-tail, neg-tail, each of which contain pointers to the clauses which have their head/tail literal in the positive/negative phases of the variable. • If v is assigned 1, then both the pos-lists will be ignored. • For each clause v in the neg-head list, the solver will search for a literal which does not evaluate to 1 such that, 1. If we first encounter a literal evaluating to 1, then the clause is sat., and we stop 2. If we first encounter a literal u that is free and u is not the tail literal, then we move the head pointer 3. If all literals are assigned 0, and tail literal is undefined, then it is a unit clause with tail literal as unit literal 4. If all literals are assigned 0 and tail literal is 0, then it is a conflicting clause • Repeat for neg-tail list, backwards • Average number of clauses to be updated, m / n , same on backtrack Aditya Parameswaran, Luv Kumar: SAT Solvers, 13

  14. Variations to the DPLL Algorithm ◮ Two Literal Watch method • Two literals “watched” in each clause • Each variable has two lists, pos-watched and neg-watched containing pointers to all the clauses where the variable is watched in positive or negative phases • When a variable v is assigned a value 1, then for each clause in the neg-watched list, we search for a literal that is not set to 0 1. If there is such a literal u, and it is not the other watched literal, then we make u the watched literal 2. If the only such u is the other watched literal, and its free, then it is a unit clause 3. If the only such u is the other watched literal and it evaluates to 1, then it is sat. 4. If all literals in the clause are assigned 0 and no such u exists, then clause is conflicting • Backtrack in constant time Aditya Parameswaran, Luv Kumar: SAT Solvers, 14

  15. Variations to the DPLL Algorithm Conflict Analysis and Learning ◮ Conflict Analysis tries to find the reason for the conflict and tries to resolve it ◮ Original DPLL paper used Chronological Backtracking , in which the last assignment that has not been flipped is flipped ◮ Non-Chronological Backtracking need not flip the last assignment and could backtrack to a earlier decision level ◮ This was first introduced in GRASP ◮ Conflict Directed Learning incorporates learned Conflict Clauses ◮ Conflict Clauses are obtained using Implication Graphs ◮ In Implication Graphs , all the variables, whose values are either known or are implied are depicted ◮ Directed edges are drawn from the variables that make up part of the unit clause implying the new variable ( antecedents ) Aditya Parameswaran, Luv Kumar: SAT Solvers, 15

  16. Variations to the DPLL Algorithm In the conflict clause, we include the following: ◮ The antecedents of the conflict which are decisions made in the current decision level ◮ The antecedents of the conflict in previous decision levels ◮ Recursively , this procedure is applied to the antecedents which are part of the current decision level, but are not decisions The backtrack level is the maximum of the decision levels of all the variables in the conflict clause Aditya Parameswaran, Luv Kumar: SAT Solvers, 16

Recommend


More recommend