1 / 41

Mark Worth

Mark Worth. The Satisfiability Problem and the MiniSat Solver. 1. – What is the Satisfiability problem? – The MiniSat solver – Algorithms used by solvers. 2. The Satisfiability Problem (SAT) – A boolean function (X1 + X2 + ¬X3 )^( ¬X1 + X2 + ¬X3)

thad
Download Presentation

Mark Worth

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. Mark Worth The Satisfiability Problem and the MiniSat Solver 1

  2. – What is the Satisfiability problem? – The MiniSat solver – Algorithms used by solvers 2

  3. The Satisfiability Problem (SAT) – A boolean function (X1 + X2 + ¬X3)^(¬X1 + X2 + ¬X3) – Are there assignments to X1, X2, and X3 that make the function TRUE? – If there are, the function is Satisfiable. 3

  4. (¬X1 + X2) ^ (X1 + X3) 4

  5. (X1 + X2 + ¬X3)^(¬X1 + X2 + ¬X3) – One assignment is X1=T, X2=F, X3=F – This function is Satisfiable 5

  6. SAT problems can come in – Conjunctive Normal Form(CNF) or – Disjunctive Normal Form(DNF) 6

  7. (X1 + X2 + ¬X3)^(¬X1 + X2 + ¬X3) This is in Conjunctive Normal Form (CNF) – A conjunction of disjunctions – Each clause is the OR of variables – Clauses are ANDed together 7

  8. (X5^X6^X7) + (¬X5^X8^¬X9) This is in Disjunctive Normal Form (DNF) – A disjunction of conjunctions – Each clause is the AND of variables – Clauses are ORed together 8

  9. SAT in DNF can be easier to solve (X5^X6^X7) + (¬X5^X8^¬X9) Why not use DNF? 9

  10. – Some problems present themselves in CNF – – Circuit analysis – Converting to DNF is an NP problem. 10

  11. Complexity Classes – P Can be solved in polynomial time – NP Verifiable in polynomial time – NP-C As “hard” as any NP problem 11

  12. 12

  13. SAT solvers like MiniSat usually accept input in CNF form. 13

  14. There are different types of SAT problems – 2SAT 2 literals per clause – 3SAT 3 literals per clause – kSAT k literals per clause – Horn SAT 14

  15. (X1 + X2 + ¬X3)^(¬X1 + X2 + ¬X3) Example of 3SAT problem – Exactly 3 variables per clause – Can have any number of clauses 15

  16. – 2SAT can be solved in polynomial time – 3SAT and over are NP-Complete 16

  17. Horn SAT – Special case of SAT – Each clause has at most 1 positive variable (X1+¬X2+¬X3)^(X2+¬X3+¬X4) 17

  18. – SAT is the first problem known to be NP-Complete – Stephen Cook proved this in 1971 – This was the origin of the concept of an NP-Complete problem 18

  19. Uses of SAT 19

  20. – Since the 1990's, great improvements have been made to SAT solvers – This has caused SAT to be applied to a wide range of uses 20

  21. SAT is used in: – Model Checking of Finite State Systems – Test Pattern Generation in Digital Systems – Combinational Equivalence Checking – Planning in AI – – Constraint satisfaction problem – Automated Theorem Proving – Software Verification – Haplotype inference in bioinformatics 21

  22. MiniSat Solver 22

  23. MiniSat Solver – Accepts problems in CNF – Any number of variables in each clause 23

  24. $ ./minisat --help WARNING: for repeatability, setting FPU to use double precision USAGE: ./minisat [options] <input-file> <result-output-file> where input may be either in plain or gzipped DIMACS. CORE OPTIONS: -rnd-init, -no-rnd-init (default: off) -luby, -no-luby (default: on) 24

  25. -rnd-freq = <double> [ 0 .. 1] (default: 0) -rnd-seed = <double> ( 0 .. inf) (default: 9.16483e+07) -var-decay = <double> ( 0 .. 1) (default: 0.95) -cla-decay = <double> ( 0 .. 1) (default: 0.999) -rinc = <double> ( 1 .. inf) (default: 2) -gc-frac = <double> ( 0 .. inf) (default: 0.2) -- garbage collection trigger (wasted memory) -rfirst = <int32> [ 1 .. imax] (default: 100) -ccmin-mode = <int32> [ 0 .. 2] (default: 2) -phase-saving = <int32> [ 0 .. 2] (default: 2) 25

  26. MAIN OPTIONS: -verb = <int32> [ 0 .. 2] (default: 1) -cpu-lim = <int32> [ 0 .. imax] (default: 2147483647) secs -mem-lim = <int32> [ 0 .. imax] (default: 2147483647) MB HELP OPTIONS: --help Print help message. --help-verb Print verbose help message. 26

  27. c All comments begin with a c p cnf 5 3 1 -5 4 0 -1 5 3 4 0 -3 -4 0 – p cnf 5 3 → problem is in CNF, 5 variables, 3 clauses – clauses end with 0 (X1+¬X5+X4)^(¬X1+X5+X3+X4)^(¬X3+¬X4) 27

  28. (X1+¬X5+X4)^(¬X1+X5+X3)^(¬X3+¬X4) Output: SAT -1 -2 -3 -4 -5 0 X1=F, X2=F, X3=F, X4=F, X5=F 28

  29. – Only one solution generated – Purpose is show the problem is satisfiable, not to find all solutions – Can force a new solution by adding the negation of the output as a new clause to the input 29

  30. c All comments begin with a c p cnf 5 4 1 -5 4 0 -1 5 3 4 0 -3 -4 0 1 2 3 4 5 0 30

  31. Solver Algorithms and Strategies 31

  32. • Davis-Putnam (DP) • Davis-Logemann-Loveland (DLL/DPLL) • Stalmarck’s algorithm • Stochastic search 32

  33. Davis-Putnam (DP) – Based on resolution 33

  34. (A  B)  (B  ¬C)  (A  ¬B) A=0 A=0 A=0 A=1 B  (B  ¬C)  ¬B B  ¬C B  ¬C B=0 B=1 B=0 B=1 () () ¬C  C=0 C=1  () 34

  35. – Good at reducing the function – Still exponential complexity for worst case 35

  36. • Davis-Logemann-Loveland (DLL/DPLL) – Used by MiniSat – Search-based – Basis for current most successful solvers 36

  37. • Davis-Logemann-Loveland (DLL/DPLL) (cont.) Step 1 – Loop through the variables – – set each variable (true or false) – – minisat initially sets unknowns to false – – if all variables are set → Satisfiable 37

  38. Step 2 – Calculate the value of other variables as you go, looking for conflicts (X1 + X2) ^ (¬X2 + X3) If X1 is false, X2 has to be true X3 has to be true Or (X1 + X2) ^ (¬X2 + X3) ^ (¬X3) – until you find a conflict → backtrack and choose a different value 38

  39. 39

  40. – SAT The Satisfiability Problem -- Theoretical applications -- Real world applications – NP-Complete – Solvers exist 40

  41. Resources Joao Marques-Silva, “Practical Applications of Boolean Satisfiability” www.cs.ucf.edu/courses/cot4810.spr2003/dhand1.ppt Thomas Cormen, Charles Leiserson, “Introduction to Algorithms” 41

More Related