Title: GRASP SAT solver
1GRASP SAT solver
J. Marques-Silva and K. Sakallah
- Presented by Constantinos Bartzis
- Slides borrowed from Pankaj Chauhan
2What is SAT?
- Given a propositional formula in CNF, find an
assignment to boolean variables that makes the
formula true - E.g.
?1 (x2 ? x3) ?2 (?x1 ? ?x4) ?3 (?x2 ?
x4) A x10, x21, x30, x41
SATisfying assignment!
3Why is SAT important?
- Fundamental problem from theoretical point of
view - Numerous applications
- CAD, VLSI
- Optimization
- Model Checking and other kinds of formal
verification - AI, planning, automated deduction
4Terminology
- CNF formula ?
- x1,, xn n variables
- ?1,, ?m m clauses
- Assignment A
- Set of (x,v(x)) pairs
- A lt n ? partial assignment (x1,0), (x2,1),
(x4,1) - A n ? complete assignment (x1,0), (x2,1),
(x3,0), (x4,1) - ?A 0 ? unsatisfying assignment (x1,1), (x4,1)
- ?A 1 ? satisfying assignment (x1,0), (x2,1),
(x4,1) - ?A X ? unresolved (x1,0), (x2,0), (x4,1)
?1 (x2 ? x3) ?2 (?x1 ? ?x4) ?3 (?x2 ?
x4) A x10, x21, x30, x41
5Terminology
- An assignment partitions the clause database into
three classes - Satisfied
- Unsatisfied
- Unresolved
- Free literals unassigned literals of a clause
- Unit clause unresolved with only one free
literal
6Basic Backtracking Search
- Organize the search in the form of a decision
tree - Each node is an assignment, called decision
assignment - Depth of the node in the decision tree ? decision
level ?(x) - xv_at_d ? x is assigned to v at decision level d
7Basic Backtracking Search
- Iteration
- Make new decision assignments to explore new
regions of search space - Infer implied assignments by a deduction process.
- May lead to unsatisfied clauses, conflict. The
assignment is called conflicting assignment. - If there is a conflict backtrack
8 DPLL in action
x1 0_at_1
?1 (?x1 ? x2 ? x3 ? x4) ?2 (?x1 ? x3 ?
x4) ?3 (x1 ? x2 ? x3) ?4 (?x3 ? x4) ?5
(?x4 ? x1 ? ? x3) ?6 (?x2 ? x4) ?7 (?x2 ? ?x4
)
?
?
U
/
/
?
U
/
?
x2 0_at_2
?
/
/
/
?
? x3 1_at_2
?
? x4 1_at_2
conflict
9 DPLL in action
x1 0_at_1
?1 (?x1 ? x2 ? x3 ? x4) ?2 (?x1 ? x3 ?
x4) ?3 (x1 ? x2 ? x3) ?4 (?x3 ? x4) ?5
(?x4 ? x1 ? ? x3) ?6 (?x2 ? x4) ?7 (?x2 ? ?x4
)
?
?
/
?
x2 0_at_2
/
x2 1_at_2
/
?
U
? x3 1_at_2
? x4 1_at_2
?
/
/
? x4 1_at_2
conflict
conflict
10 DPLL in action
x1 0_at_1
?1 (?x1 ? x2 ? x3 ? x4) ?2 (?x1 ? x3 ?
x4) ?3 (x1 ? x2 ? x3) ?4 (?x3 ? x4) ?5
(?x4 ? x1 ? ? x3) ?6 (?x2 ? x4) ?7 (?x2 ? ?x4
)
/
/
?
x1 1_at_1
/
?
?
?
x2 0_at_2
x2 0_at_2
?
x2 1_at_2
?
? x3 1_at_2
? x4 1_at_2
?
? x4 1_at_2
x4 1_at_2
conflict
conflict
(x1,1), (x2,0), (x4,1)
11DPLL Algorithm
Deduction
Decision
Backtrack
12GRASP
- GRASP stands for Generalized seaRch Algorithm for
the Satisfiability Problem (Silva, Sakallah, 96) - Features
- Implication graphs for BCP and conflict analysis
- Learning of new clauses
- Non-chronological backtracking
13GRASP search template
14GRASP Decision Heuristics
- Procedure decide()
- Which variable to split on
- What value to assign
- Default heuristic in GRASP
- Choose the variable and assignment that
directly satisfies the largest number of clauses - Other possibilities exist
15GRASP Deduction
- Boolean Constraint Propagation using implication
graphs - E.g. for the clause ? (x ? ?y), if y1, then
we must have x1 - For a variable x occuring in a clause, assignment
0 to all other literals is called antecedent
assignment A(x) - E.g. for ? (x ? y ? ?z),
- A(x) (y,0), (z,1), A(y) (x,0),(z,1),
A(z) (x,0), (y,0) - Variables directly responsible for forcing the
value of x - Antecedent assignment of a decision variable is
empty
16Implication Graphs
- Nodes are variable assignments xv(x)
- (decision or implied)
- Predecessors of x are antecedent assignments A(x)
- No predecessors for decision assignments!
- Special conflict vertices ? have A(?)
assignments to variables in the unsatisfied
clause - Decision level for an implied assignment is
- ?(x) max?(y)(y,v(y))?A(x)
17Example Implication Graph
Current truth assignment x90_at_1 ,x100_at_3,
x110_at_3, x121_at_2, x131_at_2 Current decision
assignment x11_at_6
?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)
x100_at_3
x11_at_6
x90_at_1
x110_at_3
18GRASP Deduction Process
19GRASP Conflict Analysis
- After a conflict arises, analyze the implication
graph at current decision level - Add new clauses that would prevent the occurrence
of the same conflict in the future ? Learning - Determine decision level to backtrack to, might
not be the immediate one ? Non-chronological
backtracking
20Learning
- Determine the assignment that caused conflict ?
- Backward traversal of the IG, find the roots of
the IG in the transitive fanin of ? - This assignment is necessary condition for ?
- Negation of this assignment is called conflict
induced clause ?C(?) - Adding ?C(?) to the clause database will prevent
the occurrence of ? again
21Learning
x100_at_3
x11_at_6
x90_at_1
x110_at_3
?C(?) (?x1 ? x9 ? x10 ? x11)
22Learning
- For any node of an IG x, partition A(x) into
- ?(x) (y,v(y)) ?A(x)?(y)lt?(x)
- ?(x) (y,v(y)) ?A(x)?(y)?(x)
- Conflicting assignment AC(?) causesof(?), where
23Learning
- Learning of new clauses increases clause database
size - Increase may be exponential
- Heuristically delete clauses based on a user
provided parameter - If size of learned clause gt parameter, dont
include it
24Backtracking
- Failure driven assertions (FDA)
- If ?C(?) involves current decision variable, a
different assignment for the current variable is
immediately tried. - In our IG, after erasing the assignment at level
6, ?C(?) becomes a unit clause ?x1 - This immediately implies x10
25Example Implication Graph
Current truth assignment x90_at_1 ,x100_at_3,
x110_at_3, x121_at_2, x131_at_2 Current decision
assignment x11_at_6
?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) ?C(?)(?x1 ?
x9 ? x10 ? x11)
x100_at_3
x11_at_6
x90_at_1
x110_at_3
26Example Implication Graph
Current truth assignment x90_at_1 ,x100_at_3,
x110_at_3, x121_at_2, x131_at_2 Current decision
assignment x10_at_6
?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) ?C(?) (?x1 ?
x9 ? x10 ? x11)
x90_at_1
?C(?)
x100_at_3
x10_at_6
?C(?)
?C(?)
x110_at_3
27Non-chronological backtracking
x81_at_6
x90_at_1
?8
?C(?)
?9
x100_at_3
?
x131_at_2
x10_at_6
?C(?)
?9
?9
?7
?C(?)
x110_at_3
x71_at_6
?7
x121_at_2
AC(?) x9 0_at_1, x10 0_at_3, x11 0_at_3, x121_at_2,
x131_at_2 ?C(?) (x9 ? x10 ? x11 ? ? x12 ? ?
x13)
28Backtracking
- Backtrack level is given by
- ? d-1 chronological backtrack
- ? lt d-1 non-chronological backtrack
? max?(x)(x,v(x))?AC(?)
29Procedure Diagnose()
30Whats next?
- Reduce overhead for constraint propagation
- Better decision heuristics
- Better learning, problem specific
- Better engineering
Chaff