Post on 22-Dec-2015
SAT
J. Gonzalez
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
SAT
• Decission Problem
• Assing true and false values to make the sentence true
• NP-Complete
( ) ( )P Q S P Q R SÚ ÚØ Ù Ø Ú Ú Ú
• Literals: An atom or its negation• Clauses: Disjunction of Literals• Sentence in CNF: Conjunction of Clauses
Literal Literal
Clauses Clauses
Sentences
In CNF
.
.
.
CNF and DNF
• CNF: Conjunctive normal form
• DNF: Disjunctive normal form
( ) ( )b c b dÚØ Ù Ø Ú
( ) ( )( )( ) ( )
( ) ( )
b c b d
b c b d
b c b d
Ø ÚØ Ù Ø Ú
Ø ÚØ ÚØ Ø Ú
Ø Ù Ú ÙØ
CSP (Constraint Satisfaction Problems)
• Variables: WA, NT, Q, NSW, V, SA, T • Domains: Di = {red,green,blue}• Constraints:
– WA ≠ NT, – WA ≠ SA– NT ≠ SA– NT ≠ Q– SA ≠ Q– SA ≠ NSW– SA ≠ V– Q ≠ NSW– NSW ≠ V– V ≠ T
CSP (Constraint Satisfaction Problems)
• Variables: WA, NT, Q, NSW, V, SA, T • Domains: Di = {red,green,blue}• Constraints:
– WA ≠ NT, – NT ≠ SA– NT ≠ Q– SA ≠ Q– SA ≠ NSW– SA ≠ V– Q ≠ NSW– NSW ≠ V– V ≠ T
XWA,red XWA,green XWA,blue
XNT,red XNT,green XNT,blue
XWA,red → ¬XNT,red
XWA,green → ¬XNT,green
XWA,blue → ¬XNT,blue
CSP (Constraint Satisfaction Problems)
• Variables: WA, NT, Q, NSW, V, SA, T • Domains: Di = {red,green,blue}• Constraints:
– WA ≠ NT, – NT ≠ SA– NT ≠ Q– SA ≠ Q– SA ≠ NSW– SA ≠ V– Q ≠ NSW– NSW ≠ V– V ≠ T
XWA,red XWA,green XWA,blue
XNT,red XNT,green XNT,blue
¬XWA,red ¬XNT,red
¬XWA,green ¬XNT,green
¬XWA,blue ¬XNT,blue
CSP (Constraint Satisfaction Problems)
• Variables: WA, NT, Q, NSW, V, SA, T • Domains: Di = {red,green,blue}• Constraints:
– WA ≠ NT, – NT ≠ SA– NT ≠ Q– SA ≠ Q– SA ≠ NSW– SA ≠ V– Q ≠ NSW– NSW ≠ V– V ≠ T
(XWA,red XWA,green XWA,blue)
(XNT,red XNT,green XNT,blue)
(¬XWA,red ¬XNT,red)
(¬XWA,gree ¬XNT,gree)
(¬XWA,blue ¬XNT,blue) …
CSP (Constraint Satisfaction Problems)
• SAT is an special case of CSP.• CSP to SAT • CSP
– Discrete CSP• N-queen problem• Graph coloring problem• Scheduling problem
– Binary CSP• SAT problem• Max-SAT problem
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
Algorithms for SAT• Discrete Constrained Algorithms:
– Discrete, satisfies all clauses– Goal: satisfy all clauses (constraints )– Usually uses Splitting (search) and/or Resolution
• Discrete Unconstrained Algorithms:– Discrete, minimize a function– Minimize the number of unsatisfied clauses– Usually uses Local Search.
• Constrained Programming Algorithms:– Non discrete, satisfies all clauses– From CNF to IP (Integer Programming).– Usually uses Linear Programming relaxations
• Unconstrained Global Optimization Algorithms:– Non discrete, minimize a function (constrains included in such function)– From a formula on Boolean Space (a decision problem) to an unconstrained
problem on real Space (unconstrained global optimization problem). – Usually uses many global optimization methods.
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
Splitting and Resolution
• Replace one formula by one or more other equivalent formulas.• Splitting:
– A variable v is replaced by True and False. – Two sub-formulas are generated. – The original formula has a satisfying truth assignment iff either sub-
formula has one satisfying truth assignment .
( )
( )
True Q S
False Q R S
Ú ÚØ Ù
Ú Ú Ú
( )
( )
False Q S
True Q R S
Ú ÚØ Ù
Ú Ú Ú
( )
( )
P Q S
P Q R S
Ú ÚØ Ù
Ø Ú Ú Ú
P=true
P=False
Splitting and Resolution
• Stop recursion:– Any formula with no variables is True– All subformulas are false and there is no formulas with
variables
( )
( )
True Q S
False Q R S
Ú ÚØ Ù
Ú Ú Ú
( )
( )
False True
True
Ú Ù
( )
( )
False False
False
Ú Ù ( )
( )
True False
False
Ú Ù ( )
( )
False False False
True True
Ú Ú Ù
Ú
Satisfiable
Unsatisfiable
Splitting and Resolution• Resolution: Using a resolvent to create new clauses.• Resolvent: clauses transformation based on a given variable v.
( )
( )
P Q S
M Q R S
Ú ÚØ Ù
Ø Ú Ú Ú ( )P Q M Q RÚ ÚØ Ú Ú
Resolvent
Splitting and Resolution• Resolution: Using a resolvent to create new clauses.• Resolvent: clauses transformation based on a given variable v.
( )
( )
P Q S
M Q R S
Ú ÚØ Ù
Ø Ú Ú Ú ( )P Q M Q RÚ ÚØ Ú Ú
Resolvent
Splitting and Resolution
• Stop recursion:– Formulas with an empty clause have no solution– No more resolvent could be created
( ) ( )S SØ Ù ()
( )
( )
P N
M Q R
Ú Ù
Ø Ú Ú
Unsatisfiable
Satisfiable
Splitting and Resolution
• First methods:– DP (Davis-Putnam): Resolution– DPL (Davis-Putnam-Loveland): Splitting (+
depth-first search avoids memory explosion)
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
Local Search
• Begins with an initial vector y0
• F(y0): Number of unsatisfiable formulas
• We define neighbourhood function N(yi)
• N(y0)=y1
• F(yi+1)>F(y0): strategies are applied to help escape from the local minima.
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C), False(A,B,D)
( ) ( ) ( )F F F F F TÚ Ú Ù Ú ÙF=2
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C), False(A,B,D)
( ) ( ) ( )F F F F F TÚ Ú Ù Ú ÙF=2
( )( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(A,C), False(B,D)
( ) ( ) ( )T F F T F FÚ Ú Ù Ú ÙF=1
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C), False(A,B,D)
( ) ( ) ( )F F F F F TÚ Ú Ù Ú ÙF=2
( )( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(A,C), False(B,D)
( ) ( ) ( )T F F T F FÚ Ú Ù Ú ÙF=1
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(A,B,C), False(D)
( ) ( ) ( )T T F T F FÚ Ú Ù Ú Ù
F=1
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C), False(A,B,D)
( ) ( ) ( )F F F F F TÚ Ú Ù Ú ÙF=2
( )( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(A,C), False(B,D)
( ) ( ) ( )T F F T F FÚ Ú Ù Ú ÙF=1
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(A,B,C), False(D)
( ) ( ) ( )T T F T F FÚ Ú Ù Ú Ù
F=1
( )( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(A,C,D), False(B)
( ) ( ) ( )T F F T T FÚ Ú Ù Ú Ù
F=1
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C), False(A,D,B)
( ) ( ) ( )F F F F F TÚ Ú Ù Ú ÙF=2
( )( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C,D), False(A,B)
( ) ( ) ( )F F F F T TÚ Ú Ù Ú ÙF=1
( ) ( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C,D,A), False(B)
( ) ( ) ( )T F F T T FÚ Ú Ù Ú Ù
F=1
( )( ) ( )A B C A D AÚ ÚØ Ù Ú Ù Ø
True(C,D,B), False(A)
( ) ( ) ( )F T F F T TÚ Ú Ù Ú Ù
F=0
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
Integer Programming Method (IP)
( ) ( ) ( )A A B A B CÙ Ú Ù Ø Ú Ú 1, 1, True False® ®- Ú®+
Integer Programming Method (IP)
( ) ( ) ( )A A B A B CÙ Ú Ù Ø Ú Ú
( )1 1=
1, 1, True False® ®- Ú®+
( )A True= ( )1 1- = 1X ³
Integer Programming Method (IP)
( ) ( ) ( )A A B A B CÙ Ú Ù Ø Ú Ú
( )1 1=
1, 1, True False® ®- Ú®+
( )A True= ( )1 1- = 1X ³
( )A B TrueÚ = ( )1 1 2,
(1 1) 0,
( 1 1) 0,
( 1 1) 2
+ =
- =
- + =
- - =-
0X Y+ ³
Integer Programming Method (IP)
( ) ( ) ( )A A B A B CÙ Ú Ù Ø Ú Ú
( )1 1=
1, 1, True False® ®- Ú®+
( )A True= ( )1 1- = 1X ³
( )A B TrueÚ = ( )1 1 2,
(1 1) 0,
( 1 1) 0,
( 1 1) 2
+ =
- =
- + =
- - =-
0X Y+ ³
( )A B C TrueØ Ú Ú = ( )1 1 1 1- - + =- 1X Y Z- + + ³ -
Integer Programming Method (IP)
( ) ( ) ( )A A B A B CÙ Ú Ù Ø Ú Ú
( )1 1=
1, 1, True False® ®- Ú®+
( )A True= ( )1 1- = 1X ³
( )A B TrueÚ = ( )1 1 2,
(1 1) 0,
( 1 1) 0,
( 1 1) 2
+ =
- =
- + =
- - =-
0X Y+ ³
( )A B C TrueØ Ú Ú = ( )1 1 1 1- - + =- 1X Y Z- + + ³ -
( ),1
2n
i j j ij
q w C=
³ -å
Integer Programming Method (IP)
• Solving– Linear Programs (LP): solved by the Simplex– Integer Programs (IP): no fast technique.– Integer Linear Programs (ILP): Is a LP constrained by
integrality restrictions
• Method:– Solve a LP– If solution is integer => end– If solution is non integer, round off such values
• If it is a solution => end• Else adds a new constraint and try again
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
Global optimization
• Continuous Unconstrained Formulation
• From discrete to continuous (UniSAT)
• Try to minimize a function instead of trying to verify concrete restrictions.
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
Which is the best method?
• Local search: – Faster for satisfiable CNF– Can not prove unsatisfiability
• DP algorithm (split, resolution):– Slower for satisfiable CNF– Can prove unsatisfiability
Algorithm categories
• Complete– Find the unique hard solution – Determine whether or not a solution exits– Give the variable settings for one solution– Find all solutions or an optimal solution– Prove that there is no solution
• Incomplete– Verify that there is no solution but could not find one.– Can not optimize solution quality
Performance evaluation
• Performance evaluation– Experimentally
• Works for random formulas• Does not work for worst-case formulas (too many formulas
for every given size)• Sometimes inconclusive
– Analytically• Works for random formulas• Works for worst-case formulas• Does not work for typical formulas (which is his mathematical
structure)• Need simplified algorithms
P-Subclasses of SAT
• Solved in polynomial time– Determine if a formula (or a portion) is polynomial-time solvable– The study of this subclasses reveals the nature of these “easy”
SAT formulas
• Subclasses:– 2-SAT: CNF formula with clauses of one or two literals only:
– Horn Formulas: CNF formula where every formula has at most one positive literal.
– Extended Horn Formulas: Rounding the results of a Linear Programming method we obtain the real solutions.
– Balanced formulas: When a Linear Programming method can be used to obtain integer solutions.
( )A B C DØ ÚØ Ú ÚØ
( ) ( ) ( )A D C A BÚ Ù Ø Ú Ù
Applications• Mathematics• Computer Science and AI• Machine Vision• Robotics• Computer-aided manufacturing• Database systems• Text processing• Computer graphics• Integrated circuit design automation• Computer architecture design• High-speed networking• Communications• Security
Summary
• Introduction
• Algorithms for SAT– Splitting and Resolution– Local Search– Integer Programming Method– Global Optimization
• SAT Solvers Features
• Final Thoughts
2005 Industrial
Gold Silver Bronze
SAT and UNSAT SatELiteGTI MiniSAT 1.13zChaff_rand andHaifaSAT
SAT SatELiteGTI MiniSAT 1.13Jerusat 1.31 B and HaifaSAT
UNSAT SatELiteGTI Zchaff_rand HaifaSat
2005 Handmake
Gold Silver Bronze
SAT and UNSAT Vallst SatELiteGTI March_dl
SAT Vallst March_dl Hsat1
UNSAT SatELiteGTI MiniSAT 1.13Vallst and March-dl
2005 Random
Gold Silver Bronze
SAT and UNSAT kcnf-2004 March_dl Dew_Satz1a
SAT ranov g2wsat VW
UNSAT kcnf-2004 March_dl Dew_Satz1a
2004 Industrial handmade Random
ALL (SAT+UNSAT)
Zchaff 2004 March-eq AdaptNovelty
SAT Jerusat Satzoo AdaptNovelty
UNSAT Zchaff 2004 March-eq Kcnfs
2003 Industrial handmade Random
Complete on all Forklift Satzoo Kcnfs
ALL on SAT Forklift Satzoo Unitwalk
2002 Industrial handmade Random
Complete on all zChaff zChaff OKSolver
ALL on SAT Limmat Berkmin OKSolver
A few names
• SatELite: CNF minimizer (+MiniSAT)• MiniSAT: the SAT solver properly• Authors: Niklas Eén and Niklas Sörensson • Vallst by Daniel Vallstrom • Kcnfs: is a generalization of cnfs. Olivier Dubois
and Gilles Dequen• Ranov by by L&C Researcher Anbulagan and
Nghia Duc Pham • Zchaff: Boolean Satisfiability Research Group at
Princeton University
Some last ideas
• Produce each solution => exponential in the worst case (whether or not P=NP)– List an exponential number of solutions– Solutions in compressed form
• Cylinders of solutions: variables not listed could have any value.
• BDD: Binary Decision Diagrams
• SAT solvers can be faster than other non-NP systems under some circumstances.
Bibliography
• Algorithms for the Satisfiability (SAT) Problem: A Survey.
Jun Gu, Paul W. Purdom, John Franco, Benjamin W. Wah
• SAT 2004: http://www.satisfiability.org/SAT04/• SAT 2005: http://www.satisfiability.org/SAT05/• SAT 2006:
http://www.easychair.org/FLoC-06/SAT.html