Professional Documents
Culture Documents
SAC 2010
SAT: A Simple Example
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Outline
Outline
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Motivation - Why SAT?
• Time is everything
– Good ideas are not enough, you have to be fast!
– One thing is the algorithm, another thing is the implementation
– Make your source code available
◮ Otherwise people will have to wait for years before realising
what you have done
◮ At least provide an executable!
Motivation - Some lessons from SAT II
• Get all the info from the SAT competition web page
– Organizers, judges, benchmarks, executables, source code
– Winners
◮ Industrial, Handmade and Random benchmarks
◮ SAT+UNSAT, SAT and UNSAT categories
◮ Gold, Silver and Bronze medals
Outline
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Boolean Formulas
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Algorithms for SAT
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Outline
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Organization of Local Search
• Example:
• Example:
• Example:
• Example:
• Example:
• Example:
• Example:
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Outline
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Pure Literals
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Resolution
• Resolution rule:
– If a formula ϕ contains clauses (x ∨ α) and (¬x ∨ β), then one
can infer (α ∨ β)
(x ∨ α) ∧ (¬x ∨ β) ⊢ (α ∨ β)
(x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (¬x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (x2 ∨ x3 ) ∧ (x3 ∨ x4 ) ∧ (x3 ∨ ¬x4 ) ⊢
Resolution – An Example
(x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (¬x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (x2 ∨ x3 ) ∧ (x3 ∨ x4 ) ∧ (x3 ∨ ¬x4 ) ⊢
(x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (¬x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (x2 ∨ x3 ) ∧ (x3 ∨ x4 ) ∧ (x3 ∨ ¬x4 ) ⊢
(x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (¬x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (x2 ∨ x3 ) ∧ (x3 ∨ x4 ) ∧ (x3 ∨ ¬x4 ) ⊢
(x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (¬x1 ∨ ¬x2 ∨ ¬x3 ) ∧ (x2 ∨ x3 ) ∧ (x3 ∨ x4 ) ∧ (x3 ∨ ¬x4 ) ⊢
(x3 )
• Formula is SAT
Outline
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Stålmarck’s Method
(a = 0) → (b = 1) → (d = 1)
UP(a = 0) = {a = 0, b = 1, d = 1}
(a = 1) → (c = 1) → (d = 1)
UP(a = 1) = {a = 1, c = 1, d = 1}
UP(a = 0) ∩ UP(a = 1) = {d = 1}
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Recursive Learning
(a = 1) → (c = 1) → (d = 1)
UP(a = 1) = {a = 1, c = 1, d = 1}
(b = 1) → (d = 1)
UP(b = 1) = {b = 1, d = 1}
UP(a = 1) ∩ UP(b = 1) = {d = 1}
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
Historical Perspective I
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
An Example of DPLL
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
a
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
An Example of DPLL
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
a
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
b
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
conflict
An Example of DPLL
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
a
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
b
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
conflict
An Example of DPLL
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
a
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
b
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
c
conflict
An Example of DPLL
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
a
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
b
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
c
conflict
An Example of DPLL
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
a
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
b
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
c
conflict
An Example of DPLL
ϕ = (a ∨ ¬b ∨ d) ∧ (a ∨ ¬b ∨ e) ∧
a
(¬b ∨ ¬d ∨ ¬e) ∧
(a ∨ b ∨ c ∨ d) ∧ (a ∨ b ∨ c ∨ ¬d) ∧
b b
(a ∨ b ∨ ¬c ∨ e) ∧ (a ∨ b ∨ ¬c ∨ ¬e)
c
conflict solution
Outline
Motivation
SAT Algorithms
Incomplete Algorithms
Local Search
Complete Algorithms
Basic Rules
Resolution
Stålmarck’s Method
Recursive Learning
Backtrack Search (DPLL)
Conflict-Driven Clause Learning (CDCL)
CDCL SAT Solvers
(a ∨ c ∨ f ) (c ∨ f )
Non-Chronological Backtracking
c • Learnt clause: (c ∨ f )
• Need to backtrack, given
f new clause
• Backtrack to most recent
decision: f = 0
h
(a ∨ c ∨ f )
Most Recent Backtracking Scheme
(a ∨ c ∨ f )
Most Recent Backtracking Scheme
f (a ∨ c ∨ f ) a
h
• Learnt clause: (a ∨ c ∨ f )
i • No need to assign a = 1 -
backtrack to most recent
decision: f = 0
a
• Search algorithm is no
longer a traditional
(a ∨ c ∨ f ) backtracking scheme
Unique Implication Points (UIPs)
c
g d
a b i conflict f
h e
• Exploit structure from the implication graph
– To have a more aggressive backtracking policy
• Identify additional clauses to be learnt
[Marques-Silva&Sakallah’96]
– Create clauses (a ∨ c ∨ f ) and (¬i ∨ f )
– Imply not only a = 1 but also i = 0
• 1st UIP scheme is the most efficient [Zhang&al’01]
– Create only one clause (¬i ∨ f )
– Avoid creating similar clauses involving the same literals
Clause deletion policies
literals0 = 4
literals1= 0
size = 5
• Each variable x keeps a reference
to all clauses containing a literal in
x
unit – If variable x is assigned, then all
clauses containing a literal in x
literals0 = 4
literals1= 1
are evaluated
size = 5 – If search backtracks, then all
clauses of all newly unassigned
variables are updated
satisfied
• Total number of references is L,
literals0 = 5
literals1= 0
where L is the number of literals
size = 5
unsatisfied
Lazy Data Structures (watched literals)
new
clauses
solution
cutoff
Conclusions