30
Presented by Monissa Mohan 1

Chaff: Engineering An Efficient SAT Solver

  • Upload
    kovit

  • View
    79

  • Download
    0

Embed Size (px)

DESCRIPTION

Chaff: Engineering An Efficient SAT Solver. Presented by Monissa Mohan. Two Strategies that make Chaff work better:. A highly optimized BCP algorithm Two watched literals Fast Backtracking Efficient Decision Heuristic Focused on recently added clauses Highly optimized for speed. - PowerPoint PPT Presentation

Citation preview

Page 1: Chaff: Engineering An Efficient SAT Solver

Presented by

Monissa Mohan

1

Page 2: Chaff: Engineering An Efficient SAT Solver

A highly optimized BCP algorithm Two watched literals Fast Backtracking

Efficient Decision Heuristic Focused on recently added clauses Highly optimized for speed

2

Page 3: Chaff: Engineering An Efficient SAT Solver

Boolean Constraint Propagation (BCP):

Identify all the variable assignments required by the current variable state to satisfy f

For f to be sat, every clause must be sat

3

Page 4: Chaff: Engineering An Efficient SAT Solver

Unit Clause rule: All literals are

False(F) with one unassigned literal

These clauses are called UNIT CLAUSES

This literal has to take on the value of True(T) to make f sat

f= v1+v2+v3

Now v1 and v2 has been assigned to false(F)

f=F+F+v3

Now f is called a unit clause

v3 takes the value of True(T) to make f sat.

4

Page 5: Chaff: Engineering An Efficient SAT Solver

Goal of BCP: Visit the clause only when the

number of zero literals goes from N-2 to N-1

How is this done? Theoretically, we could ignore

the first N-2 assignments to this clause

The first N-2 assignments won’t have any effect on the BCP

(…….+x+y+…….)

5

Implication occurs after N-1 assignments of False to its literals

N literals

Page 6: Chaff: Engineering An Efficient SAT Solver

Each clause has two watched literals Ignore any assignments to the other literals

in the clause. BCP Maintains the following rule

By the end of BCP, one of the watched literal is true or both are undefined.

Guaranteed to find all implications(…….+x+y+…….)

6

N literals

Page 7: Chaff: Engineering An Efficient SAT Solver

While backtracking, no need to modify watched literals

Variable may be watched only in a small subset of clauses. This reduces the total number of memory accesses which is critical for SAT solvers

7

Page 8: Chaff: Engineering An Efficient SAT Solver

Four clauses are present: v2 + v3 + v1 + v4 v1 + v2 + v3’ v1 + v2’ v1’+ v4

8

Page 9: Chaff: Engineering An Efficient SAT Solver

Watched Literals:

v2 v2 + + v3v3 + v1 + v4 + v1 + v4 v1v1 + + v2v2 + v3’ v1 + v2’ v1’+ v4

9

Page 10: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F)

Assume we decide to set v1 the value F

10

Page 11: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Ignore clauses with a watched literal whose value is T

Stack:(v1=F)

11

Page 12: Chaff: Engineering An Efficient SAT Solver

v2 v2 + + v3v3 + + v1v1 + v4 + v4v1v1 + + v2v2 + v3’ + v3’v1v1 + + v2’v2’v1’v1’+ + v4v4

Ignore clauses where neither watched literal value changes

Stack:(v1=F)

12

Page 13: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Examine clauses with a watched literal whose value is F

Stack:(v1=F)

13

Page 14: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F)

In the second clause, replace the watched literal v1 with v3’

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F)

14

Page 15: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F)

The third clause is a unit and implies v2=F We record the new implication, and add it to a queue of assignments to process.

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F)Pending: (v2=F)

15

Page 16: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F)

Next, we process v2. We only examine the first 2 clauses

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F)Pending: (v3=F)

16

Page 17: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F)

In the first clause, we replace v2 with v4 The second clause is a unit and implies v3=F We record the new implication, and add it to the queue

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F)Pending: (v3=F)

17

Page 18: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F, v3=F)

Next, we process v3’. We only examine the first clause.

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F, v3=F)Pending: ()

18

Page 19: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F, v3=F)

The first clause is a unit and implies v4=T. We record the new implication, and add it to the queue.

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

Stack:(v1=F, v2=F, v3=F)Pending: (v4=T)

19

Page 20: Chaff: Engineering An Efficient SAT Solver

Stack:(v1=F, v2=F, v3=F, v4=T)

There are no pending assignments, and no conflict Therefore, BCP terminates and so does the SAT solver

v2 + v3 + v1 + v4v1 + v2 + v3’v1 + v2’v1’+ v4

20

Page 21: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1v1 + v2 + v3’v1 + v2’v1’+ v4Stack:(v1=F, v2=F, v3=F) What if the first clause does not have v4? When processing v3’, we examine the first

clause. This time, there is no alternative literal to watch. BCP returns a conflict

21

Page 22: Chaff: Engineering An Efficient SAT Solver

v2 + v3 + v1

v1 + v2 + v3’

v1 + v2’

v1’+ v4

Stack:() We do not need to move any watched

literal

22

Page 23: Chaff: Engineering An Efficient SAT Solver

Variable State Independent Decaying Sum(VSIDS)Rank variables based on literal count in the initial

clause database.Only increment counts as new clauses are

added.Periodically, divide all counts by a constant.

23

Page 24: Chaff: Engineering An Efficient SAT Solver

Initial data base

x1 + x4x1 + x3’ + x8’x1 + x8 + x12x2 + x11x7’ + x3’ + x9x7’ + x8 + x9’x7 + x8 + x10’

Scores:4: x83: x1,x72: x31: x2,x4,x9,x10,x11,x12

New clause added

x1 + x4x1 + x3’ + x8’x1 + x8 + x12x2 + x11x7’ + x3’ + x9x7’ + x8 + x9’x7 + x8 + x10’x7 + x10 + x12’

Scores:4: x8,x73: x12: x3,x10,x121: x2,x4,x9,x11

watch what happens to x8, x7 and x1 24

Page 25: Chaff: Engineering An Efficient SAT Solver

Counters divided by 2

x1 + x4x1 + x3’ + x8’x1 + x8 + x12x2 + x11x7’ + x3’ + x9x7’ + x8 + x9’x7 + x8 + x10’x7 + x10 + x12’

Scores:2: x8,x71: x3,x10,x12,x10: x2,x4,x9,x11

New clause added

x1 + x4x1 + x3’ + x8’x1 + x8 + x12x2 + x11x7’ + x3’ + x9x7’ + x8 + x9’x7 + x8 + x10’x7 + x10 + x12’x12’ + x10

Scores:2: x8,x7,x12,x101: x3,x10: x2,x4,x9,x11

watch what happens to x8, x10 25

Page 26: Chaff: Engineering An Efficient SAT Solver

Clause Deletion Avoids memory explosion Determines when a clause can be deleted When more than N literals in the clause

becomes unassigned for the first time, the clause will be marked as deleted

26

Page 27: Chaff: Engineering An Efficient SAT Solver

Restarts Halt in the procedure and a restart of the

analysis using some previous information Clearing the state and decisions of all

variables and proceeding as normal The clauses learned prior to the restart are

still there after the restart and can help pruning the search space

27

Page 28: Chaff: Engineering An Efficient SAT Solver

One to two orders of magnitude faster than the best public domain solvers

Works equally good on difficult problems prevalent in EDA domain

Speedup simply comes because of efficient engineering in basic search algorithm

28

Page 29: Chaff: Engineering An Efficient SAT Solver

Chaff: Engineering an Efficient SAT SolverMatthew W. Moskewicz , Conor F. Madigan, Ying

Zhao, Lintao Zhang, Sharad Malik Boolean Satisfiability in Electronic Design

Automation

João P. Marques-Silva Karem A. Sakallah

29

Page 30: Chaff: Engineering An Efficient SAT Solver

30