33
Methods for SAT- a Survey Robert Glaubius CSCE 976 May 6, 2002

Methods for SAT- a Survey

Embed Size (px)

DESCRIPTION

Methods for SAT- a Survey. Robert Glaubius CSCE 976 May 6, 2002. SAT: Outline. Definitions Solving SAT Testing SAT Attempted Contribution Conclusions. SAT: The Propositional Satisfiability Problem. Given:  , a predicate in CNF, e.g., - PowerPoint PPT Presentation

Citation preview

Page 1: Methods for SAT- a Survey

Methods for SAT- a Survey

Robert GlaubiusCSCE 976

May 6, 2002

Page 2: Methods for SAT- a Survey

SAT: Outline

• Definitions

• Solving SAT

• Testing SAT

• Attempted Contribution

• Conclusions

Page 3: Methods for SAT- a Survey

SAT: The Propositional Satisfiability Problem

• Given: , a predicate in CNF, e.g.,

= (a1 a2) (a2 ¬a3) (a1 ¬a2 a3)

• Question: does a model of exist?

Page 4: Methods for SAT- a Survey

SAT: Definitions

• Variable: ai

• Literal: = ai or ¬ai

• Clause: (i j ... n)

= (a1 a2) (a2 ¬a3) (a1 ¬a2 a3)

Page 5: Methods for SAT- a Survey

SAT: Outline

• Definitions

• Solving SAT

• Testing SAT

• Attempted Contribution

• Conclusions

Page 6: Methods for SAT- a Survey

SAT: Solution methods

• Systematic search:– SATO [Zhang, 1993]– Satz [Li and Ambulagan, 1997]– Chaff [Moskewicz, et al., 2001]

• Stochastic search:– GSAT [Selman et al., 1992]– walkSAT [Selman et al., 1996]

Page 7: Methods for SAT- a Survey

SAT: Systematic Search I

• Davis-Putnam procedure

Satz, Sato, Chaff

• Splitting and unit propagation

= ai and = ¬ai

Page 8: Methods for SAT- a Survey

SAT: Systematic Search II

• Splitting and unit propagation:

= a2 (a1 a2) (a2 ¬a3) (a1 ¬a2 a3)

unit_propagate() (a1 a3)

• (a1 a2), (a2 ¬a3) subsumed by a2

• (a1 ¬a2 a3) (a1 a3)

Page 9: Methods for SAT- a Survey

SAT: Systematic Search III

• SATO: Splitting heuristics

Heuristics and Hacks

• Satz: More Splitting heuristics

• Chaff: Squeaky clean implementation

Page 10: Methods for SAT- a Survey

SAT: Stochastic Search

• Selection Heuristics: mechanisms for variable selection

• Random restart:– Restart– Move– Walk

Page 11: Methods for SAT- a Survey

SAT: Stochastic Search - GSAT

procedure GSAT

begin

for i = 1 to MAX-TRIES

T = a randomly generated truth assignment

for j = 1 to MAX-FLIPS

if T satisfies then return T

p = variable s.t. flip(p) maximizes satisfied clauses

T = T after flip(p)

end for

end for

return “fail”

end

Page 12: Methods for SAT- a Survey

SAT: Stochastic Search - WalkSAT

procedure WalkSATbegin T = a randomly generated truth assignment for i = 1 to MAX-TRIES if T satisfies then return T k = random unsatisfied clause p = variable in k s.t. flip(p) maximizes satisfied clauses if flip(p) does not unsatisfy any clause then T = T after flip(p) else j = a random number in [0,1] if j > 0.5 then flip(p) else T = T after flip(q), where q is a random variable in k end forend

Page 13: Methods for SAT- a Survey

SAT: Outline

• Definitions

• Solving SAT

• Testing SAT

• Attempted Contribution

• Conclusions

Page 14: Methods for SAT- a Survey

SAT: Algorithm Verification

• Benchmark problems – planning, verification– International Competition and Symposium on

Satisfiability Testing– SAT2002 Competetion

• Random problems– naïve random generation– ‘structured’ random problems, QCP [Selman and

Gomes, 1997]– QWH, [Achlioptas et al., 2000]

Page 15: Methods for SAT- a Survey

SAT: Random Generation - Naïve

• Generate n clauses with 1..l variables per clause drawn from a pool of k variables.

• Does not guarantee satisfiability

• Requires filtering of instances by slower, systematic means

Page 16: Methods for SAT- a Survey

Digression I: Latin Square7 8 1 2 4 5 3 65 2 4 7 3 1 6 82 5 7 3 6 4 8 16 1 5 8 7 3 2 43 6 2 4 1 8 5 78 7 3 1 2 6 4 54 3 6 5 8 7 1 21 4 8 6 5 2 7 3

Latin Square: a configurationof n symbols in n columns and nrows s.t. each symbol occurs exactlyonce in each row and each column.

Rhetorical Question:“If we had a table that was only partially filled,can we make it a Latin Square?”

This turns out to be an NP-complete problem

Page 17: Methods for SAT- a Survey

SAT: Random Generation – QCP

• Quasigroup completion problem

– Fill some percentage of squares in an nn

matrix and try to complete the quasigroup

(latin square).

– Does offer a structured random problem

– Doesn’t guarantee a solution

Page 18: Methods for SAT- a Survey

SAT: Random Generation – QWH I

• Quasigroup with Holes – Start with a randomly generated completed

latin square, then poke random holes in it.

– Does offer a structured problem

– Does have at least one solution

Page 19: Methods for SAT- a Survey

SAT: Random Generation – QWH II

• Improvement: balanced QWH– Instead of random holes, specify a set

number for each row and column

7 1 2 4 62 7 3 1 6

2 5 7 6 16 1 5 3 23 2 4 1 5

7 1 6 4 54 8 7 1 2

4 8 6 2 3

7 8 1 2 4 5 3 65 2 4 7 3 1 6 82 5 7 3 6 4 8 16 1 5 8 7 3 2 43 6 2 4 1 8 5 78 7 3 1 2 6 4 54 3 6 5 8 7 1 21 4 8 6 5 2 7 3

But how do we make a random latin square?

Page 20: Methods for SAT- a Survey

Digression II: Random Latin Squares

Jacobsen and Matthews (1996) identify a set ofmoves that translate an order n Latin Square into a newLatin square, and prove that these moves connectthe space of all order n Latin Squares.

1 2 3 4 5 6 7 82 3 4 5 6 7 8 13 4 5 6 7 8 1 24 5 6 7 8 1 2 35 6 7 8 1 2 3 46 7 8 1 2 3 4 57 8 1 2 3 4 5 68 1 2 3 4 5 6 7

7 8 1 2 4 5 3 65 2 4 7 3 1 6 82 5 7 3 6 4 8 16 1 5 8 7 3 2 43 6 2 4 1 8 5 78 7 3 1 2 6 4 54 3 6 5 8 7 1 21 4 8 6 5 2 7 3

Iterated random application of these moves allows usto randomly select new squares.

Page 21: Methods for SAT- a Survey

Digression III: Encoding the Square I

• Exactly one symbol per cell(aijbij...nij)(¬aij¬bij)(¬aij¬cij)...(¬mij¬nij)

• Exactly one occurrence of s in row r(sr1sr2...srn)(¬sr1¬sr2)(¬sr1¬sr3)...(¬srn-1¬srn)

• Exactly one occurrence of s in column c(s1cs2c...snc)(¬s1c¬s2c)(¬s1c¬s3c)...(¬sn-1c¬snc)

Page 22: Methods for SAT- a Survey

Digression III: Encoding the Square II

• Conjoin the appropriate positive literal for each preassigned cell

• How much space does this cost us?n3 variables

1.5n4 - 1 .5n3 + 3n2 clauses

Page 23: Methods for SAT- a Survey

SAT: Outline

• Definitions

• Solving SAT

• Testing SAT

• Attempted Contribution

• Conclusions

Page 24: Methods for SAT- a Survey

SAT: Return to Stochastic Search

• Premise: WalkSAT uses a random start– What if we can derive us a heuristic that

can give us a better start frequently?– Systematic MoM’s heuristic: Most

occurrences in clauses of minimum length.– Another rhetorical question:

“Can we adapt this to stochastic search?”

Page 25: Methods for SAT- a Survey

SAT: ANP heuristic I

Given: = (a1 a2) (a2 ¬a3) (a1 ¬a2 a3)

• What is the P(ai = | )?- The only way to evaluate this is by finding all

models.

- Is P(ai = | ) approximable?

Page 26: Methods for SAT- a Survey

SAT: ANP heuristic II

• Given k = (a2 ¬a3), we define P(ai = | kj).– P(a2 = True | k ) = 0.67, since a2 is true in 2 models of k

– P(a2 = True | k ) = 0.33, since a2 is true in 1 models of k

• Approximate P(ai = | ) j P(ai = | kj )

• Normalize P(ai = | ) + P(ai = ¬ | ) = 1

Page 27: Methods for SAT- a Survey

SAT: ANP heuristic III

= (a1 a2) (a2 ¬a3) (a1 ¬a2 a3)

P(a1 = True | ) 0.73, P(a1 = False | ) 0.27

P(a2 = True | ) 0.75, P(a2 = False | ) 0.25

P(a3 = True | ) 0.40, P(a3 = False | ) 0.60

Page 28: Methods for SAT- a Survey

SAT: ANP heuristic IV

• ANP heuristic: choose the initial assignment with maximum approximate normalized probability

a1 = True, a2 = True, and a3 = False

• This assignment is in fact a model of

Page 29: Methods for SAT- a Survey

SAT: Experiment design

• Four benchmark problems from the 1996 International Competition and Symposium on Satisfiability Testing- hardware verification

• Three order 15 balanced QWH problems – 3, 4, 5 holes per row, column

• WalkSat solver

Page 30: Methods for SAT- a Survey

SAT: Results

• 100 trial runs per problem• 3 Initial Assignment types

- ANP- Random- Default (all False)

We didn’t do so well

Page 31: Methods for SAT- a Survey

SAT: Conclusions

• Based on our initial experiments, stochastic solvers are harmed by heuristics.

• Quasigroup-based problems are likely to be the exception; most variables are false in a model.

• More tests are needed; possible domain dependence

Page 32: Methods for SAT- a Survey

SAT: Outline

• Definitions

• Solving SAT

• Testing SAT

• Attempted Contribution

• Conclusions