Presentation is loading. Please wait.

Presentation is loading. Please wait.

1/30 SAT Solver Changki PSWLAB SAT Solver Daniel Kroening, Ofer Strichman.

Similar presentations


Presentation on theme: "1/30 SAT Solver Changki PSWLAB SAT Solver Daniel Kroening, Ofer Strichman."— Presentation transcript:

1 1/30 SAT Solver Changki Hong @ PSWLAB SAT Solver Daniel Kroening, Ofer Strichman

2 2/30 SAT Solver Changki Hong @ PSWLAB Contents  Introduction  The DPLL framework  BCP and Implication Graph  Conflict Clauses and Resolution  Decision Heuristics  References

3 3/30 SAT made some progress…

4 4/30 SAT Solver Changki Hong @ PSWLAB Contents  Introduction  The DPLL framework  BCP and Implication Graph  Conflict Clauses and Resolution  Decision Heuristics  References

5 5/30 SAT Solver Changki Hong @ PSWLAB Two main categories of SAT solver  Davis-Putnam-Loveland-Logemann (DPLL) framework  The solver can be thought of as traversing and backtracking on a binary tree.  Internal nodes represent partial assignments.  Leave nodes represent full assignments.  Stochastic search  The solver guesses a full assignment, and then, if the formula is evaluated to FALSE under this assignment, starts to flip values of variables according to some heuristics.  DPLL solvers are considered better in most cases according to the annual competition.

6 6/30 SAT Solver Changki Hong @ PSWLAB Status of a clause  A clause can be  Satisfied: at least one literal is satisfied  Unsatisfied: all literals are assigned but non are satisfied  Unit: all but one literals are assigned but none are satisfied  Unresolved: all other cases  Example: C = ( x 1 ∨ x 2 ∨ x 3 ) x1x1 x2x2 x3x3 C 10Satisfied 000Unsatisfied 00Unit 0Unresolved

7 7/30 SAT Solver Changki Hong @ PSWLAB A Basic SAT algorithm While (true) { if (Decide() == FALSE) return (SAT); while (BCP() == “conflict”) { backtrack-level = Analyze_Conflict(); if (backtrack-level < 0) return (UNSAT); else BackTrack(backtrack-level); } Choose the next variable and value. Return False if all variables are assigned Apply repeatedly the unit clause rule. Return False if reached a conflict Backtrack until no conflict. Return False if impossible

8 8/30 SAT Solver Changki Hong @ PSWLAB  Given  in CNF: (x ∨ y ∨ z) ∧ ( ¬ x ∨ y) ∧ ( ¬ y ∨ z) ∧ ( ¬ x ∨ ¬ y ∨ ¬ z) Decide() BCP() Analyze_Conflict() A Basic SAT algorithm (y) ∧ ( ¬ y ∨ z ) ∧ ( ¬ y ∨ ¬ z ) (y ∨ z) ∧ ( ¬ y ∨ z ) (z) ∧ ( ¬ z ) ( ) (y) ∧ ( ¬ y) ( )  x = 1x = 0 y = 1y = 0z = 1z = 0 z = 1z = 0 y = 1y = 0  X XX XX

9 9/30 SAT Solver Changki Hong @ PSWLAB Contents  Introduction  The DPLL framework  BCP and Implication Graph  Conflict Clauses and Resolution  Decision Heuristics  References

10 10/30 SAT Solver Changki Hong @ PSWLAB Boolean Constraints Propagation (BCP)  BCP is repeated application of the unit clause rule until either a conflict is encountered or there are no more implications.  Each assignment is associated with the decision level at which it occurred.  notation : x=v@d x ∈ {0,1} is assigned to v at decision level d  The process of BCP is best illustrated with an implication graph.

11 11/30 SAT Solver Changki Hong @ PSWLAB Implication graph  Def: An implication graph is a labeled directed acyclic graph G(V, E), where:  V represents the literals of the current partial assignment. Each node is labeled with the literal that it represents and the decision level at which it entered the partial assignment.  E with E = { (v i, v j ) | v i, v j ∈ V, ¬ v i ∈ Antecedent(v j ) } denotes the set of directed edges where each edge (v i, v j ) is labeled with Antecedent(v j ).  Def: For a given unit clause C with an unassigned literal l, we say that l is implied by C and that C is the antecedent clause of l, denoted by Antecedent(l).

12 12/30 55 55 x 6 =1@6 Implication graphs and conflict clause  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5   x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5   x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 ) Current truth assignment: {x 9 =0@1,x 10 =0@3, x 11 =0@3, x 12 =1@2, x 13 =1@2} Current decision assignment: {x 1 =1@6} 66 66  conflict x 9 =0@1 x 1 =1@6 x 10 =0@3 x 11 =0@3 x 5 =1@6 44 44 22 22 x 3 =1@6 11 x 2 =1@6 33 33 x 4 =1@6 We learn the conflict clause  10 = ( ¬ x 1 ∨ x 9 ∨ x 11 ∨ x 10 )

13 13/30 Implication graph, flipped assignment x 1 =0@6 x 11 =0@3 x 10 =0@3 x 9 =0@1 x 7 =1@6 x 12 =1@2 77 77 x 8 =1@6 88  10 99 99 ’’ x 13 =1@2 99 Due to the conflict clause  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5  x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  10 : (  x 1  x 9  x 11  x 10 )  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5  x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  10 : (  x 1  x 9  x 11  x 10 ) Another conflict clause:  11 = (  x 13 ∨  x 12 ∨ x 11 ∨ x 10 ∨ x 9 ) conflict

14 14/30 SAT Solver Changki Hong @ PSWLAB Non-chronological backtracking Non- chronological backtracking x 1 4 5 6 ’’ Decision level Which assignments caused the conflicts ? x 9 = 0@1 x 10 = 0@3 x 11 = 0@3 x 12 = 1@2 x 13 = 1@2 Backtrack to DL = 3 3 These assignments Are sufficient for Causing a conflict.

15 15/30 SAT Solver Changki Hong @ PSWLAB Non-chronological backtracking  So the rule is: backtrack to the largest decision level in the conflict clause. x 1 = 0 x 2 = 0 x 3 = 1 x 4 = 0 x 5 = 0 x 7 = 1 x 9 = 0 x 6 = 0... x 5 = 1 x 9 = 1 x 3 = 0

16 16/30 SAT Solver Changki Hong @ PSWLAB Contents  Introduction  The DPLL framework  BCP and Implication Graph  Conflict Clauses and Resolution  Decision Heuristics  References

17 17/30 SAT Solver Changki Hong @ PSWLAB Conflict clauses  Def: A clause is asserting if the clause contains all value 0 literals; and among them only one is assigned at current decision level.  After backtracking, this clause will become a unit clause and force the literal to assume another value, thus bringing the search to a new space.  Modern solvers only consider Asserting Clauses.

18 18/30 SAT Solver Changki Hong @ PSWLAB Unique Implication Points (UIP’s)  Definition: A Unique Implication Point (UIP) is an internal node in the implication graph that all paths from the decision to the conflict node go through it.  The First-UIP is the closest UIP to the conflict. 55 55 66 66  conflict 44 44 22 22 11 33 33 UIP

19 Conflict clauses and Resolution  The Binary-resolution :  Example:

20 20/30 SAT Solver Changki Hong @ PSWLAB Conflict clauses and resolution This function is to return TRUE if and only if cl contains the negation of the first UIP as its single literal at the current decision level

21 21/30 SAT Solver Changki Hong @ PSWLAB Conflict clauses and resolution Resolution order : x 4, x 5, x 6, x 7 Since the c 5 contains the negation of the first UIP as its single literal at the current decision level, the stop criterion is met. c 5 is asserting clause. First UIP

22 22/30 SAT Solver Changki Hong @ PSWLAB Resolution graph 11 22 33 44 55 66  10 77 88 99  11 77 77 88  10 99 99  ’ conflict 55 55 66 66  conflict 44 44 22 22 11 33 33 99 Resolution Graph

23 23/30 SAT Solver Changki Hong @ PSWLAB Contents  Introduction  The DPLL framework  BCP and Implication Graph  Conflict Clauses and Resolution  Decision Heuristics  References

24 24/30 SAT Solver Changki Hong @ PSWLAB  Compute for every clause  and every variable l (in each phase):  J ( l ) :=  Choose a variable l that maximizes J ( l ).  This gives an exponentially higher weight to literals in shorter clauses. Decision heuristics - JW Jeroslow-Wang method

25 25/30 SAT Solver Changki Hong @ PSWLAB  Choose the assignment that satisfies the largest number of currently unsatisfied clauses  C x p – # unresolved clauses in which x appears  Let x be the literal with C xp  Let y be the literal with C yp  If C xp > C yp choose x, Otherwise choose y  Requires l (#literals) queries for each decision. DLIS (Dynamic Largest Individual Sum) Decision heuristics - DLIS

26 26/30 SAT Solver Changki Hong @ PSWLAB Decision heuristics – VSIDS (Implemented in Chaff) VSIDS (Variable State Independent Decaying Sum) 1.Each variable in each polarity has a counter initialized to 0. 2. When a clause is added, the counters are updated. 3. The unassigned variable with the highest counter is chosen. 4. Periodically, all the counters are divided by a constant.

27 27/30 SAT Solver Changki Hong @ PSWLAB Decision heuristics – VSIDS (cont’d)  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.

28 28/30 SAT Solver Changki Hong @ PSWLAB Decision Heuristics - Berkmin  Keep conflict clauses in a stack  Choose the first unresolved clause in the stack  If there is no such clause, use VSIDS  Choose from this clause a variable + value according to some scoring (e.g. VSIDS)  This gives absolute priority to conflicts.

29 29/30 SAT Solver Changki Hong @ PSWLAB Contents  Introduction  The DPLL framework  BCP and Implication Graph  Conflict Clauses and Resolution  Decision Heuristics  References

30 30/30 SAT Solver Changki Hong @ PSWLAB References  Decision Procedures – Daniel Kroening and Ofer Strichman  The Quest for Efficient Boolean Satisfiability Solvers – Lintao Zhang and Sharad Malik  Efficient Conflict Driven Learning in a Boolean Satisfiability Solver – Lintao Zhang, Conor F. Madigan, Matthew H. Moskewicz and Sharad Malik


Download ppt "1/30 SAT Solver Changki PSWLAB SAT Solver Daniel Kroening, Ofer Strichman."

Similar presentations


Ads by Google