330 likes | 489 Views
SAT Solvers. The SAT Problem. Given a Boolean formula , look for assignment A for such that . A is a solution for . A partial assignment assigns a subset of . CNF representation of : is a conjunction of clauses:
E N D
The SAT Problem • Given a Boolean formula , look for assignmentAfor such that . • A is a solution for . • A partial assignment assigns a subset of . • CNF representation of : • is a conjunction of clauses: • A clause is a disjunction of literals: • A satisfies ↔ A satisfies all its clauses.
Boolean Constraint Propagation • Unit Clause: A clause with exactly one unassigned literal, while all the rest are false. • Asserts the value of the unassigned variable. • cl implies and is its antecedent. • a and c are the antecedent variables of • BCP(): Calculates all the possible implications. Returns conflict / no-conflict. a = 0 b = ? c = 1 b = 0
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value.
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value. • Run bcp()
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value. • Run bcp()
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value. • Run bcp() • If a conflict occurs • Flip the highest decision variable not yet flipped.
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value. • Run bcp() • If a conflict occurs • Flip the highest decision variable not yet flipped. • Mark as flipped.
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value. • Run bcp() • If a conflict occurs • flip the highest decision variable not yet flipped. • Mark as flipped • Run bcp().
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value. • Run bcp() • If a conflict occurs • flip the highest decision variable not yet flipped. • Mark as flipped • Run bcp().
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Choose a decision variable and value. • Run bcp() • If a conflict occurs • flip the highest decision variable not yet flipped. • Mark as flipped • Run bcp().
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Termination • No unassigned variables – SAT
DPLL: Davis Putnam Logemann Loveland Backtrack Search • Termination • No unassigned variables – SAT • No decision variable to flip – un-SAT
The SAT Problem - Resolution • Given a Boolean formula in CNF, for clauses and . • For
x3 ¬x5 ¬x1 x12 x7 ¬x8 x19 ¬x6 ¬x3 ¬x9 x4 Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8, ¬x7,¬x3)
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 x19 ¬x3 x4 ¬x1 ¬x6
Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 Conflict x19 ¬x3 x4 ¬x1 ¬x6
x12 x7 ¬x6 x3 ¬x3 ¬x5 ¬x8 x19 ¬x1 Learning: Cuts ¬x9 Conflict x4
¬x3 ¬x6 x12 x19 ¬x8 ¬x1 Learning: Conflict Clauses Reason Side Conflict Side • x7,¬x5,x15 are the reason for the conflict. • Adding the clause will prevent it in the future. (x5,¬x7,x3) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 Conflict x4
Learning: Conflict Clauses X1 0 1 X2 X2 The clause (x2,x3) is created after a conflict 0 1 0 1 X3 X3 X3 X3 0 0 The search tree is pruned accordingly
1 UIP 2 UIP Learning: Implication Graph (x9,¬x5) (x9,¬x8) (x9,x12) (x5,x7) (x5,¬x7,x3) (¬x4,¬x1) (x1,¬x12,x19) (x1,¬x6) (x6,¬x19,x8,¬x7,¬x3) x7 ¬x5 x3 ¬x9 ¬x8 x12 Conflict x19 ¬x3 x4 ¬x1 ¬x6
Non –Chronological Backtracking • Backtrack multiple levels instead of one. • Use conflict clause to determine the level • Backtrack to the minimum level where the clause is still asserting. • Emphasis on recent learning. Conflict Clause (x10,¬x7,x2,x9)
Learning: Conflict Clauses • Prevent the reason to the conflict. • Consists of the negation to the reason literals. • Prunes the search tree. • Different cuts yield different conflict clauses. • We choose cuts such that: • Conflict clause includes one variable from the top level. It is a unit clause after backtracking one level. • The new problem is equivalent to the original.