Presentation is loading. Please wait.

Presentation is loading. Please wait.

SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment.

Similar presentations


Presentation on theme: "SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment."— Presentation transcript:

1 SAT Solving Presented by Avi Yadgar

2 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:  A clause is a disjunction of literals:

3 The SAT Problem  = (v 1  v 2   v 5 )  (  v 1  v 7   v 9 ) … (v 5  v 7 ) A satisfies ↔ A satisfies all its clauses.  Each clause needs one “true” literal NP-Complete Many applications Very efficient solvers Search / Proof engine

4 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 = ( v 3 ) v 1 = 0 v 2 = 1 v 3 = ? v 1 = 0  v 2 = 0 v 3 = 1 v 1   v 2 

5 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.  v 1 and v 2 are the antecedent variables of BCP(): Calculates all the possible implications. v 1 = 0 v 2 = 1 v 3 = ? v 3 = 1

6 DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision variable and value. v6v6

7 DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision variable and value. Run bcp() v6v6 ¬v 14 v 3

8 DPLL: Davis Putnam Logemann Loveland Backtrack Search Choose a decision variable and value. Run bcp() v6v6 ¬v 14 v 3 ¬v 1 v 18 v 4 ¬v 2 v8v8 ¬v 10 v 7

9 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. v6v6 ¬v 14 v 3 ¬v 1 v 18 v 4 ¬v 2 v8v8 ¬v 10 v 7 ¬v 9 v 5 ¬v 3

10 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. v6v6 ¬v 14 v 3 ¬v 1 v 18 v 4 ¬v 2 v8v8 ¬v 10 v 7 v 9 **

11 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(). v6v6 ¬v 14 v 3 ¬v 1 v 18 v 4 ¬v 2 v8v8 ¬v 10 v 7 v 9 ** v 15 v 14

12 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(). v6v6 ¬v 14 v 3 ¬v 1 v 18 v 4 ¬v 2 ¬v 8 ** v 9 ** v 15 v 14

13 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(). v6v6 ¬v 14 v 3 ¬v 1 v 18 v 4 ¬v 2 ¬v 8 ** v 11

14 DPLL: Davis Putnam Logemann Loveland Backtrack Search Termination  No unassigned variables – SAT  No decision variable to flip – un-SAT

15 Optimized BCP Solver spends 90% in BCP

16 c res (c 1, c 2 ) = (v 2   v 5  v 7   v 9 ) The SAT Problem - Resolution c 1 = (v 1  v 2   v 5 ), c 2 (  v 1  v 7   v 9 )   c res     c res v2  v5v2  v5 v7  v9v7  v9

17 SAT Solving - Implication Graph (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 )

18 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 9 SAT Solving - Implication Graph

19 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 SAT Solving - Implication Graph

20 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 ¬v 8 SAT Solving - Implication Graph

21 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 12 ¬v 8 SAT Solving - Implication Graph

22 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 12 v 7 ¬v 8 SAT Solving - Implication Graph

23 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 12 v 7 ¬v 8 v 3 SAT Solving - Implication Graph

24 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 v 12 v 7 ¬v 8 v 3 SAT Solving - Implication Graph

25 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 3 SAT Solving - Implication Graph

26 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 v 3 SAT Solving - Implication Graph

27 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 ¬v 6 v 3 SAT Solving - Implication Graph

28 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 ¬v 6 v 3 v 15 SAT Solving - Implication Graph

29 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 v 3 ¬v 3 v 15 SAT Solving - Implication Graph ¬v 6

30 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 ¬v 6 v 3 ¬v 3 v 15 Conflict SAT Solving - Implication Graph

31 (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 12 v 7 ¬v 8 v 3 SAT Solving - Implication Graph ¬v4 ¬v4 ***

32 CUT: A bi-partition of the graph.  The conflict is on the ‘conflict side’.  The decisions are on the ‘reason side’  No edge from the ‘conflict side’ to the ‘reason side’. The edges which cut the cut represent the reason to the conflict. Learning: Cuts

33 ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 ¬v 6 v 3 ¬v 3 v 15 Conflict

34 Learning: Conflict Clauses ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 ¬v 6 v 3 ¬v 3 v 15 Conflict Conflict Side Reason Side v 7,¬v 5,v 15 are the reason for the conflict. Adding the clause will prevent it in the future. (v 5,¬v 7,v 3 ) (¬v 7,¬v 15,¬v 3 ) (¬v 7,v 5,¬v 15 )

35 Learning: Conflict Clauses v1v1 v2v2 v2v2 v3v3 v3v3 v3v3 v3v3 0 0 0 0 0 1 1 1 The clause (v 2,v 3 ) is created after a conflict The search tree is pruned accordingly

36 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.

37 Learning: Implication Graph (v 9,¬v 5 ) (v 9,¬v 8 ) (v 9,v 12 ) (v 5,v 7 ) (v 5,¬v 7,v 3 ) (¬v 4,¬v 1 ) (v 1,¬v 12,v 19 ) (v 1,¬v 6 ) (v 6,¬v 19,v 8,v 15 ) (¬v 7,¬v 15,¬v 3 ) ¬v 5 ¬v 9 v 4 ¬v 1 v 12 v 7 ¬v 8 v 19 ¬v 6 v 3 ¬v 3 v 15 Conflict 1 UIP2 UIP3 UIP

38 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. v8v8 ¬v 10 v 3 v 7 v 14 ¬v 2 v 5 v 1 ¬v 4 v 21 ¬v 12 ¬v 15 v 19 v 18 v 32 ¬v 6 v 16 ¬v 9 ¬v 14 v8v8 ¬v 10 v 3 v 7 ¬v 2 v 5 v 1 v 9 Conflict Clause (v 10,¬v 7,v 2,v 9 )

39 Non –Chronological Backtracking v8v8 ¬v 10 v 3 v 7 v 14 ¬v 2 v 5 v 1 ¬v 4 v 21 ¬v 12 ¬v 15 v 19 v 18 v 32 ¬v 6 v 16 ¬v 9 ¬v 14 v8v8 ¬v 10 v 3 v 7 ¬v 2 v 5 v 1 v 9 v8v8 v6v6 v2v2 v 19 v4v4 1 0 0 1 1 v8v8 v2v2 v9v9 0 1 1

40 Branching - VSIDS (Variable State Independent Decaying Sum) Counter for each literal  Updated when clauses are added Branch on the literal with the highest rank Divide counters periodically Favors recent conflict clauses.  Recent gained knowledge

41 Restarts After a fixed interval  Lengthen interval after each restart Nullify all branching and implications Keep conflict clauses Leads to a new branching order  New score for the literals  Hopefully a better order

42 Branching for BMC Add static ordering  Forward  backward Branch on latches \ inputs

43 Branching for BMC Create independent sub-problems

44 un-SAT Core ¬v 2 ¬v 3 ¬v 1 v1v1 Conflict

45 un-SAT Core v 2 ¬v 3 ¬v2¬v2 Conflict

46 un-SAT Core

47 Easily obtained from a DPLL SAT solver Requires saving the resolution graph

48 Branching – BerkMin \HaifaSAT SAT as abstraction / refinement Stack of added conflict clauses  Order clauses chronologically (BerkMin)  Order on clauses topologically (HaifaSAT) Branch on a literal from the top clause

49 The Rise and Fall of Parallel SAT Solving VERY appealing! Obstacles  Dependencies  Communication Parallelized BCP()  Centralized  Appealing since bcp() is 90% of the runtime  Useless since bcp() is only 90% of the runtime BCP()

50 The Rise and Fall of Parallel SAT Solving Parallelize for BMC Create “independent” formulae Take advantage of symmetry  Share learned clauses Inference is local


Download ppt "SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment."

Similar presentations


Ads by Google