1 / 30

SAT Solver

SAT Solver. Daniel Kroening , Ofer Strichman. Contents. Introduction The DPLL framework BCP and Implication Graph Conflict Clauses and Resolution Decision Heuristics References. SAT made some progress…. Contents. Introduction The DPLL framework BCP and Implication Graph

melina
Download Presentation

SAT Solver

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SAT Solver Daniel Kroening, OferStrichman

  2. Contents • Introduction • The DPLL framework • BCP and Implication Graph • Conflict Clauses and Resolution • Decision Heuristics • References

  3. SAT made some progress…

  4. Contents • Introduction • The DPLL framework • BCP and Implication Graph • Conflict Clauses and Resolution • Decision Heuristics • References

  5. 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. 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 = (x1∨x2∨x3)

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

  8. A Basic SAT algorithm • Given  in CNF: (x ∨ y ∨ z) ∧ (¬x ∨ y) ∧ (¬y ∨ z) ∧ (¬x ∨ ¬y ∨ ¬z)  x = 1 x = 0 Decide() (y)∧ (¬y ∨ z ) ∧(¬y ∨ ¬z ) (y ∨ z) ∧(¬y ∨ z ) y = 1 y = 0 z = 1 z = 0 (z) ∧(¬z ) ( ) ( ) (y) ∧(¬y) z = 1 z = 0 X  y = 1 y = 0 BCP() ( ) ( ) ( ) ( ) X X X X Analyze_Conflict()

  9. Contents • Introduction • The DPLL framework • BCP and Implication Graph • Conflict Clauses and Resolution • Decision Heuristics • References

  10. 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@dx∈{0,1} is assigned to v at decision level d • The process of BCP is best illustrated with an implication graph.

  11. 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 = { (vi, vj) |vi, vj∈ V, ¬vi ∈ Antecedent(vj) } denotes the set of directed edges where each edge (vi, vj) is labeled with Antecedent(vj). • 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. 4 x2=1@6 x5=1@6 1 4 3 6 x4=1@6  conflict 6 3 2 5 2 5 x6=1@6 x3=1@6 Implication graphs and conflict clause Current truth assignment:{x9=0@1 ,x10=0@3, x11=0@3, x12=1@2, x13=1@2} Current decision assignment: {x1=1@6} x10=0@3 1 = (x1  x2) 2 = (x1  x3  x9) 3 = (x2  x3  x4) 4 = (x4  x5  x10) 5 = (x4  x6  x11) 6 = (x5   x6) 7 = (x1  x7  x12) 8 = (x1 x8) 9 = (x7  x8   x13) x1=1@6 x9=0@1 x11=0@3 We learn the conflict clause10= (¬x1∨x9∨x11∨ x10 )

  13. x13=1@2 x8=1@6 9 8 9 ’ 9 7 x7=1@6 7 x12=1@2 Implication graph, flipped assignment x9=0@1 1 = (x1  x2) 2 = (x1  x3  x9) 3 = (x2  x3  x4) 4 = (x4  x5  x10) 5 = (x4  x6  x11) 6 = (x5  x6) 7 = (x1  x7  x12) 8 = (x1 x8) 9 = (x7  x8   x13) 10 : (x1 x9x11 x10) 10 x10=0@3 conflict x1=0@6 10 10 x11=0@3 Due to theconflict clause Another conflict clause:11 = (x13∨x12∨ x11∨x10∨x9)

  14. Non-chronological backtracking Which assignments caused the conflicts ? x9= 0@1 x10= 0@3 x11= 0@3 x12= 1@2 x13= 1@2 Backtrack to DL = 3 3 Decision level 4 5 These assignments Are sufficient for Causing a conflict. x1 6  ’ Non-chronological backtracking

  15. Non-chronological backtracking • So the rule is: backtrack to the largest decision level in the conflict clause. x1 = 0 x2 = 0 x3 = 1 x3 = 0 x4 = 0 x6 = 0 ... x5 = 0 x5 = 1 x7 = 1 x9 = 1 x9 = 0

  16. Contents • Introduction • The DPLL framework • BCP and Implication Graph • Conflict Clauses and Resolution • Decision Heuristics • References

  17. 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. 6  conflict 6 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. 4 1 4 UIP 3 UIP 3 2 5 2 5

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

  20. 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. Conflict clauses and resolution First UIP Resolution order : x4, x5, x6, x7 Since the c5 contains the negation of the first UIP as its single literal at the current decision level, the stop criterion is met. c5 is asserting clause.

  22. 4 1 4 3 3 2 5 2 5 6  conflict 6 Resolution graph Resolution Graph 1 2 3 10 4 11 9 5 10 8 7 9 ’ conflict 10 6 9 8 10 7 9 7

  23. Contents • Introduction • The DPLL framework • BCP and Implication Graph • Conflict Clauses and Resolution • Decision Heuristics • References

  24. Decision heuristics - JW • Compute for every clause w 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. Jeroslow-Wang method

  25. DLIS (Dynamic Largest Individual Sum) Decision heuristics - DLIS • Choose the assignment that satisfies the largest number of currently unsatisfied clauses • Cxp – # unresolved clauses in which x appears • Let x be the literal with Cxp • Let ybe the literal with Cyp • If Cxp > Cypchoose x, Otherwise choose y • Requires l(#literals) queries for each decision.

  26. Decision heuristics – VSIDS VSIDS (Variable State Independent Decaying Sum) • 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. (Implemented in Chaff)

  27. Decision heuristics – VSIDS (cont’d) • Chaffholds 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. 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. Contents • Introduction • The DPLL framework • BCP and Implication Graph • Conflict Clauses and Resolution • Decision Heuristics • References

  30. References • Decision Procedures – Daniel Kroening and OferStrichman • The Quest for Efficient Boolean Satisfiability Solvers – Lintao Zhang and SharadMalik • Efficient Conflict Driven Learning in a Boolean Satisfiability Solver – Lintao Zhang, Conor F. Madigan, Matthew H. Moskewicz and SharadMalik

More Related