mark worth
DESCRIPTION
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) - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/1.jpg)
Mark Worth
The Satisfiability Problem and the MiniSat Solver
1
![Page 2: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/2.jpg)
– What is the Satisfiability problem?
– The MiniSat solver
– Algorithms used by solvers
2
![Page 3: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/3.jpg)
The Satisfiability Problem (SAT)
– A boolean function (X1 + X2 + ¬X3)^(¬X1 + X2 + ¬X3)
– Are there assignments to X1, X2, and X3 thatmake the function TRUE?
– If there are, the function is Satisfiable.
3
![Page 4: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/4.jpg)
(¬X1 + X2) ^ (X1 + X3)
4
![Page 5: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/5.jpg)
(X1 + X2 + ¬X3)^(¬X1 + X2 + ¬X3)
– One assignment is X1=T, X2=F, X3=F
– This function is Satisfiable
5
![Page 6: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/6.jpg)
SAT problems can come in – Conjunctive Normal Form(CNF) or – Disjunctive Normal Form(DNF)
6
![Page 7: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/7.jpg)
(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
![Page 8: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/8.jpg)
(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
![Page 9: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/9.jpg)
SAT in DNF can be easier to solve
(X5^X6^X7) + (¬X5^X8^¬X9)
Why not use DNF?
9
![Page 10: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/10.jpg)
– Some problems present themselves in CNF– – Circuit analysis
– Converting to DNF is an NP problem.
10
![Page 11: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/11.jpg)
Complexity Classes
– P Can be solved in polynomial time– NP Verifiable in polynomial time– NP-C As “hard” as any NP problem
11
![Page 12: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/12.jpg)
12
![Page 13: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/13.jpg)
SAT solvers like MiniSat usually accept input in CNF form.
13
![Page 14: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/14.jpg)
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
![Page 15: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/15.jpg)
(X1 + X2 + ¬X3)^(¬X1 + X2 + ¬X3)
Example of 3SAT problem– Exactly 3 variables per clause– Can have any number of clauses
15
![Page 16: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/16.jpg)
– 2SAT can be solved in polynomial time– 3SAT and over are NP-Complete
16
![Page 17: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/17.jpg)
Horn SAT
– Special case of SAT– Each clause has at most 1 positive variable
(X1+¬X2+¬X3)^(X2+¬X3+¬X4)
17
![Page 18: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/18.jpg)
– 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
![Page 19: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/19.jpg)
Uses of SAT
19
![Page 20: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/20.jpg)
– 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
![Page 21: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/21.jpg)
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
![Page 22: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/22.jpg)
MiniSat Solver
22
![Page 23: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/23.jpg)
MiniSat Solver
– Accepts problems in CNF– Any number of variables in each clause
23
![Page 24: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/24.jpg)
$ ./minisat --helpWARNING: for repeatability, setting FPU to use double precisionUSAGE: ./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
![Page 25: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/25.jpg)
-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
![Page 26: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/26.jpg)
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
![Page 27: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/27.jpg)
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
![Page 28: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/28.jpg)
(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
![Page 29: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/29.jpg)
– 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
![Page 30: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/30.jpg)
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
![Page 31: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/31.jpg)
Solver Algorithms and Strategies
31
![Page 32: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/32.jpg)
• Davis-Putnam (DP)
• Davis-Logemann-Loveland (DLL/DPLL)
• Stalmarck’s algorithm
• Stochastic search
32
![Page 33: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/33.jpg)
Davis-Putnam (DP)– Based on resolution
33
![Page 34: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/34.jpg)
B B (B (B ¬C) ¬C) ¬B ¬B B B ¬C ¬CB B ¬C ¬C
¬C¬C
(())
(A (A B) B) (B (B ¬C) ¬C) (A (A ¬B) ¬B)
(()) (())
A=0A=0A=0A=0A=0A=0 A=1A=1
B=0B=0 B=1B=1
C=0C=0 C=1C=1
B=1B=1B=0B=0
34
![Page 35: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/35.jpg)
– Good at reducing the function– Still exponential complexity for worst case
35
![Page 36: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/36.jpg)
• Davis-Logemann-Loveland (DLL/DPLL)
– Used by MiniSat– Search-based– Basis for current most successful solvers
36
![Page 37: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/37.jpg)
• 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
![Page 38: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/38.jpg)
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
![Page 39: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/39.jpg)
39
![Page 40: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/40.jpg)
– SAT The Satisfiability Problem-- Theoretical applications-- Real world applications
– NP-Complete
– Solvers exist
40
![Page 41: Mark Worth](https://reader033.vdocuments.us/reader033/viewer/2022051316/56815aa3550346895dc82b93/html5/thumbnails/41.jpg)
Resources
Joao Marques-Silva, “Practical Applications of Boolean Satisfiability”www.cs.ucf.edu/courses/cot4810.spr2003/dhand1.pptThomas Cormen, Charles Leiserson, “Introduction to Algorithms”
41