Presentation is loading. Please wait.

Presentation is loading. Please wait.

GRASP SAT solver Presented by Constantinos Bartzis Slides borrowed from Pankaj Chauhan J. Marques-Silva and K. Sakallah.

Similar presentations


Presentation on theme: "GRASP SAT solver Presented by Constantinos Bartzis Slides borrowed from Pankaj Chauhan J. Marques-Silva and K. Sakallah."— Presentation transcript:

1 GRASP SAT solver Presented by Constantinos Bartzis Slides borrowed from Pankaj Chauhan J. Marques-Silva and K. Sakallah

2 What is SAT? Given a propositional formula in CNF, find an assignment to boolean variables that makes the formula true E.g.  1 = (x 2  x 3 )  2 = (  x 1   x 4 )  3 = (  x 2  x 4 ) A = {x 1 =0, x 2 =1, x 3 =0, x 4 =1}  1 = (x 2  x 3 )  2 = (  x 1   x 4 )  3 = (  x 2  x 4 ) A = {x 1 =0, x 2 =1, x 3 =0, x 4 =1} SATisfying assignment!

3 Why 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

4 Terminology CNF formula  x 1,…, x n : n variables  1,…,  m : m clauses Assignment A Set of (x,v(x)) pairs |A| < n  partial assignment {(x 1,0), (x 2,1), (x 4,1)} |A| = n  complete assignment {(x 1,0), (x 2,1), (x 3,0), (x 4,1)}  | A = 0  unsatisfying assignment {(x 1,1), (x 4,1)}  | A = 1  satisfying assignment {(x 1,0), (x 2,1), (x 4,1)}  | A = X  unresolved {(x 1,0), (x 2,0), (x 4,1)}  1 = (x 2  x 3 )  2 = (  x 1   x 4 )  3 = (  x 2  x 4 ) A = {x 1 =0, x 2 =1, x 3 =0, x 4 =1}  1 = (x 2  x 3 )  2 = (  x 1   x 4 )  3 = (  x 2  x 4 ) A = {x 1 =0, x 2 =1, x 3 =0, x 4 =1}

5 Terminology 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

6 Basic 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) x=v@d  x is assigned to v at decision level d

7 Basic Backtracking Search Iteration: 1. Make new decision assignments to explore new regions of search space 2. Infer implied assignments by a deduction process. May lead to unsatisfied clauses, conflict. The assignment is called conflicting assignment. 3. If there is a conflict backtrack

8 DPLL in action  1 = (  x 1  x 2  x 3  x 4 )  2 = (  x 1  x 3  x 4 )  3 = (x 1  x 2  x 3 )  4 = (  x 3  x 4 )  5 = (  x 4  x 1   x 3 )  6 = (  x 2  x 4 )  7 = (  x 2   x 4 )  1 = (  x 1  x 2  x 3  x 4 )  2 = (  x 1  x 3  x 4 )  3 = (x 1  x 2  x 3 )  4 = (  x 3  x 4 )  5 = (  x 4  x 1   x 3 )  6 = (  x 2  x 4 )  7 = (  x 2   x 4 ) x1x1 x2x2 U  x 3 = 1@2 x 1 = 0@1  / / / x 2 = 0@2  x 4 = 1@2 conflict U / / /

9 DPLL in action  1 = (  x 1  x 2  x 3  x 4 )  2 = (  x 1  x 3  x 4 )  3 = (x 1  x 2  x 3 )  4 = (  x 3  x 4 )  5 = (  x 4  x 1   x 3 )  6 = (  x 2  x 4 )  7 = (  x 2   x 4 )  1 = (  x 1  x 2  x 3  x 4 )  2 = (  x 1  x 3  x 4 )  3 = (x 1  x 2  x 3 )  4 = (  x 3  x 4 )  5 = (  x 4  x 1   x 3 )  6 = (  x 2  x 4 )  7 = (  x 2   x 4 ) x1x1 x2x2  x 3 = 1@2 x 1 = 0@1  / / / x 2 = 0@2  x 4 = 1@2 conflict U / / x 2 = 1@2  x 4 = 1@2 conflict

10 DPLL in action  1 = (  x 1  x 2  x 3  x 4 )  2 = (  x 1  x 3  x 4 )  3 = (x 1  x 2  x 3 )  4 = (  x 3  x 4 )  5 = (  x 4  x 1   x 3 )  6 = (  x 2  x 4 )  7 = (  x 2   x 4 )  1 = (  x 1  x 2  x 3  x 4 )  2 = (  x 1  x 3  x 4 )  3 = (x 1  x 2  x 3 )  4 = (  x 3  x 4 )  5 = (  x 4  x 1   x 3 )  6 = (  x 2  x 4 )  7 = (  x 2   x 4 ) x1x1 x2x2  x 3 = 1@2 x 1 = 0@1 / / x 2 = 0@2  x 4 = 1@2 conflict / x 2 = 1@2  x 4 = 1@2 conflict x2x2 x 1 = 1@1 x 2 = 0@2 x4x4 x 4 = 1@2 {(x 1,1), (x 2,0), (x 4,1)}

11 DPLL Algorithm Deduction Decision Backtrack

12 GRASP 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

13 GRASP search template

14 GRASP 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

15 GRASP Deduction Boolean Constraint Propagation using implication graphs E.g. for the clause  = (x   y), if y=1, then we must have x=1 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

16 Implication Graphs Nodes are variable assignments x=v(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)}

17 Example Implication Graph  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5   x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5   x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 ) Current truth assignment: {x 9 =0@1,x 10 =0@3, x 11 =0@3, x 12 =1@2, x 13 =1@2} Current decision assignment: {x 1 =1@6} 66 66  conflict x 9 =0@1 x 1 =1@6 x 10 =0@3 x 11 =0@3 x 5 =1@6 44 44 55 55 x 6 =1@6 22 22 x 3 =1@6 11 x 2 =1@6 33 33 x 4 =1@6

18 GRASP Deduction Process

19 GRASP 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

20 Learning 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

21 Learning 66 66  conflict x 9 =0@1 x 1 =1@6 x 10 =0@3 x 11 =0@3 x 5 =1@6 44 44 55 55 x 6 =1@6 22 22 x 3 =1@6 11 x 2 =1@6 33 33 x 4 =1@6  C (  ) = (  x 1  x 9  x 10  x 11 )

22 For any node of an IG x, partition A(x) into  (x) = {(y,v(y))  A(x)|  (y)<  (x)}  (x) = {(y,v(y))  A(x)|  (y)=  (x)} Conflicting assignment A C (  ) = causesof(  ), where Learning (x,v(x)) if A(x) =   (x)  [  causesof(y) ] o/w (y,v(y))   (x) causesof( x ) =

23 Learning 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 > parameter, don’t include it

24 Backtracking 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  x 1 This immediately implies x 1 =0

25 Example Implication Graph  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5   x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  C (  )=(  x 1  x 9  x 10  x 11 )  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5   x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  C (  )=(  x 1  x 9  x 10  x 11 ) Current truth assignment: {x 9 =0@1,x 10 =0@3, x 11 =0@3, x 12 =1@2, x 13 =1@2} Current decision assignment: {x 1 =1@6} 66 66  conflict x 9 =0@1 x 1 =1@6 x 10 =0@3 x 11 =0@3 x 5 =1@6 44 44 55 55 x 6 =1@6 22 22 x 3 =1@6 11 x 2 =1@6 33 33 x 4 =1@6

26 Example Implication Graph  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5  x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  C (  ) = (  x 1  x 9  x 10  x 11 )  1 = (  x 1  x 2 )  2 = (  x 1  x 3  x 9 )  3 = (  x 2   x 3  x 4 )  4 = (  x 4  x 5  x 10 )  5 = (  x 4  x 6  x 11 )  6 = (  x 5  x 6 )  7 = (x 1  x 7   x 12 )  8 = (x 1  x 8 )  9 = (  x 7   x 8   x 13 )  C (  ) = (  x 1  x 9  x 10  x 11 ) Current truth assignment: {x 9 =0@1,x 10 =0@3, x 11 =0@3, x 12 =1@2, x 13 =1@2} Current decision assignment: {x 1 =0@6} x 11 =0@3 x 10 =0@3 x 9 =0@1 C()C() C()C() C()C() x 1 =0@6

27 Non-chronological backtracking 99 99 ’’ x 12 =1@2 x 7 =1@6 x 8 =1@6 x 1 =0@6 x 11 =0@3 x 10 =0@3 x 9 =0@1 77 77 88 C()C() C()C() C()C() x 13 =1@2 99 A C (  ’) = {x 9 =0@1, x 10 = 0@3, x 11 = 0@3, x 12 =1@2, x 13 =1@2}  C (  ) = (x 9  x 10  x 11   x 12   x 13 ) Decision level 4 5 x1 x1 6 '' 3

28 Backtrack level is given by  = d-1 chronological backtrack  < d-1 non-chronological backtrack Backtracking  = max{  (x)|(x,v(x))  A C (  ’)}

29 Procedure Diagnose()

30 What’s next? Reduce overhead for constraint propagation Better decision heuristics Better learning, problem specific Better engineering Chaff


Download ppt "GRASP SAT solver Presented by Constantinos Bartzis Slides borrowed from Pankaj Chauhan J. Marques-Silva and K. Sakallah."

Similar presentations


Ads by Google