26
Minimizing Learned Clauses Niklas S ¨ orensson 1 Armin Biere 2 1 Chalmers University of Technology, G¨ oteborg, Sweden 2 Johannes Kepler University, Linz, Austria SAT’09 Twelfth International Conference on Theory and Applications of Satisfiability Testing Swansea, Wales, United Kingdom Wednesday, July 1st, 2009

Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Minimizing Learned Clauses

Niklas Sorensson 1 Armin Biere 2

1 Chalmers University of Technology, Goteborg, Sweden

2 Johannes Kepler University, Linz, Austria

SAT’09Twelfth International Conference on

Theory and Applications of Satisfiability Testing

Swansea, Wales, United Kingdom

Wednesday, July 1st, 2009

Page 2: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Implication Graph 1

d = 1 @ 1 e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f g = 1 @ 2 h = 1 @ 2 i = 1 @ 2

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4 s = 1 @ 4 t = 1 @ 4 y = 1 @ 4

= 1 @ 4x z = 1 @ 4 κ

top−level

decision

decision

decision

unit unit

conflict

decision

Page 3: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Antecedents / Reasons 2

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f h = 1 @ 2 i = 1 @ 2

= 1 @ 1c

r = 1 @ 4 y = 1 @ 4

= 1 @ 4x z = 1 @ 4 κ

top−level

decision

decision

decision

unit unit

conflict

decision

d

g

s t

= 1 @ 2

= 1 @ 1

= 1 @ 4= 1 @ 4

k = 1 @ 3 = 1 @ 3l

d∧g∧ s → t ≡ (d∨g∨ s∨ t)

Page 4: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Conflicting Clauses 3

d = 1 @ 1 e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f g = 1 @ 2 i = 1 @ 2

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4 s = 1 @ 4

= 1 @ 4x

top−level

decision

decision

decision

unit unit

= 1 @ 4

= 1 @ 4y

z conflictκ

h = 1 @ 2

t = 1 @ 4decision

¬(y∧ z) ≡ (y∨ z)

Page 5: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Resolving Antecedents 1st Time 4

d = 1 @ 1 e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f g = 1 @ 2

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4 s = 1 @ 4

= 1 @ 4x

top−level

decision

decision

decision

unit unit

= 1 @ 4

= 1 @ 4y

z conflictκ

decision

h i

t

= 1 @ 2 = 1 @ 2

= 1 @ 4

(h∨ i∨ t ∨ y) (y∨ z)

Page 6: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Resolving Antecedents 1st Time 5

d = 1 @ 1 e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f g = 1 @ 2

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4 s = 1 @ 4

= 1 @ 4x

top−level

decision

decision

decision

unit unit

= 1 @ 4

= 1 @ 4y

z conflictκ

decision

h i

t

= 1 @ 2 = 1 @ 2

= 1 @ 4

(h∨ i∨ t ∨ y) (y∨ z)

(h∨ i∨ t ∨ z)

Page 7: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Resolvents = Cuts = Potential Learned Clauses 6

d = 1 @ 1 e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f g = 1 @ 2

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4 s = 1 @ 4

= 1 @ 4x

d = 1 @ 1 e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f g = 1 @ 2

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4 s = 1 @ 4

= 1 @ 4x

top−level

decision

decision

decision

unit unit

= 1 @ 4

= 1 @ 4y

z conflictκ

decision

h i

t

= 1 @ 2 = 1 @ 2

= 1 @ 4

top−level

decision

decision

decision

unit unit

= 1 @ 4

= 1 @ 4y

z conflictκ

decision

h i

t

= 1 @ 2 = 1 @ 2

= 1 @ 4

(h∨ i∨ t ∨ y) (y∨ z)

(h∨ i∨ t ∨ z)

Page 8: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Potential Learned Clause After 1 Resolution 7

d = 1 @ 1 e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f g = 1 @ 2

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

= 1 @ 4x

top−level

decision

decision

decision

unit unit

z

decision

h i

t

= 1 @ 2 = 1 @ 2

= 1 @ 4s = 1 @ 4 = 1 @ 4

= 1 @ 4 κ conflict

y

(h∨ i∨ t ∨ z)

Page 9: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Resolving Antecedents 2nd Time 8

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

= 1 @ 4x

top−level

decision

decision

decision

unit unit

z

decision

h i

t

= 1 @ 2 = 1 @ 2

= 1 @ 4 = 1 @ 4

= 1 @ 4 κ conflict

ys

g

d = 1 @ 1

= 1 @ 2

= 1 @ 4

(d∨g∨ s∨ t) (h∨ i∨ t ∨ z)

(d∨g∨ s∨h∨ i∨ z)

Page 10: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Resolving Antecedents 3rd Time 9

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit unit

z

decision

h i= 1 @ 2 = 1 @ 2

= 1 @ 4

= 1 @ 4 κ conflict

y= 1 @ 4t= 1 @ 4

= 1 @ 2

= 1 @ 1d

g

s

= 1 @ 4x

(x∨ z) (d∨g∨ s∨h∨ i∨ z)

(x∨d∨g∨ s∨h∨ i)

Page 11: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Resolving Antecedents 4th Time 10

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit unit

decision

h i= 1 @ 2 = 1 @ 2

= 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

x = 1 @ 4

= 1 @ 4

= 1 @ 4

t

z

(s∨ x) (x∨d∨g∨ s∨h∨ i)

(d∨g∨ s∨h∨ i)self subsuming resolution

Page 12: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

1st UIP Clause after 4 Resolutions 11

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit unit

decision

h i= 1 @ 2 = 1 @ 2

= 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

1st UIP

backjump level

(d∨g∨ s∨h∨ i)

Page 13: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Resolving Antecedents 5th Time 12

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

= 1 @ 1c

k = 1 @ 3

top−level

decision

decision

decision

unit unit

decision

h i= 1 @ 2 = 1 @ 2

= 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

l = 1 @ 3

= 1 @ 4r

(l∨ r∨ s) (d∨g∨ s∨h∨ i)

(l∨ r∨d∨g∨h∨ i)

Page 14: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Decision Learned Clause 13

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

= 1 @ 1c

top−level

decision

decision

decision

unit unit

decision

h i= 1 @ 2 = 1 @ 2

= 1 @ 4

κ conflict

y

g

d

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

r = 1 @ 4 = 1 @ 4s

l = 1 @ 3= 1 @ 3kbacktrack

level

last UIP

(d∨g∨ l∨ r∨h∨ i)

Page 15: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

1st UIP Clause after 4 Resolutions 14

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit unit

decision

h i= 1 @ 2 = 1 @ 2

= 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

(d∨g∨ s∨h∨ i)

Page 16: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Locally Minimizing 1st UIP Clause 15

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit unit

decision

i = 1 @ 2

= 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

h = 1 @ 2

(h∨ i) (d∨g∨ s∨h∨ i)

(d∨g∨ s∨h)self subsuming resolution

Page 17: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Locally Minimized Learned Clause 16

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit unit

decision = 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

= 1 @ 2i= 1 @ 2h

(d∨g∨ s∨h)

Page 18: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Local Minimization Algorithm 17

[BeameKautzSabharwal-JAIR’04] variation, independently discovered

Two step algorithm:

1. mark all variables in 1st UIP clause

2. remove literals with all antecedent literals also marked

Correctness:

• removal of literals in step 2 are self subsuming resolution steps.

• implication graph is acyclic.

Confluence: produces a unique result.

Page 19: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Minimizing Locally Minimized Learned Clause Further? 18

e = 1 @ 1

b = 1 @ 0a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit unit

decision = 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

= 1 @ 2i

Remove ?

h = 1 @ 2

(d∨g∨ s∨6 h)

Page 20: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Recursively Minimizing Learned Clause 19

a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit

decision = 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

= 1 @ 2i= 1 @ 2h

unit b

e

= 1 @ 0

= 1 @ 1

(b)(d∨b∨ e)

(e∨g∨h) (d∨g∨ s∨h)(e∨d∨g∨ s)

(b∨d∨g∨ s)

(d∨g∨ s)

Page 21: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Recursively Minimized Learned Clause 20

a = 1 @ 0

= 1 @ 2f

l = 1 @ 3

= 1 @ 1c

k = 1 @ 3

r = 1 @ 4

top−level

decision

decision

decision

unit

decision = 1 @ 4

κ conflict

ys

g

d

= 1 @ 4

= 1 @ 2

= 1 @ 1

t

z= 1 @ 4x

= 1 @ 4

= 1 @ 4

= 1 @ 2i

unit

= 1 @ 2

= 1 @ 1

= 1 @ 0

h

e

b

(d∨g∨ s)

Page 22: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Recursive Minimization Algorithm 21

[MiniSAT 1.13]

Four step algorithm:

1. mark all variables in 1st UIP clause

2. for each candidate literal: search implication graph

3. start at antecedents of candidate literals

4. if search always terminates at marked literals remove candidate

Correctness and Confluence as in local version!!!

Optimization: terminate early with failure if new decision level is “pulled in”

Page 23: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Experiments on 100 SAT’08 Race Instances 22

solved time space out of deletedinstances in hours in GB memory literals

MINISAT recur 788 9% 170 11% 198 49% 11 89% 33%with local 774 7% 177 8% 298 24% 72 30% 16%

preprocessing none 726 192 392 103MINISAT recur 705 13% 222 8% 232 59% 11 94% 37%without local 642 3% 237 2% 429 24% 145 26% 15%

preprocessing none 623 242 565 196PICOSAT recur 767 10% 182 13% 144 45% 10 60% 31%

with local 745 6% 190 9% 188 29% 10 60% 15%preprocessing none 700 209 263 25

PICOSAT recur 690 6% 221 8% 105 63% 10 68% 33%without local 679 5% 230 5% 194 31% 10 68% 14%

preprocessing none 649 241 281 31recur 2950 9% 795 10% 679 55% 42 88% 34%

altogether local 2840 5% 834 6% 1109 26% 237 33% 15%none 2698 884 1501 355

10 runs for each configuration with 10 seeds for random number generator

Page 24: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Large Variance for Different Seeds 23

MINISATwith preprocessing

seed solved time space mo del

1. recur 8 82 16 19 1 33%2. recur 6 81 17 20 1 33%3. local 0 81 16 29 7 16%4. local 7 80 17 29 8 15%5. recur 4 80 17 20 1 33%6. recur 1 79 17 20 1 33%7. recur 9 79 17 20 1 34%8. local 5 78 18 29 7 16%9. local 1 78 17 29 6 16%

10. recur 0 78 17 20 1 34%11. recur 5 78 17 19 1 33%12. local 3 77 18 31 7 16%13. local 8 77 18 30 8 16%14. recur 7 77 17 20 1 34%15. recur 3 77 17 20 1 34%16. recur 2 77 17 20 2 33%17. none 7 76 19 39 9 0%

... ... ... ... ... ... ... ...

Page 25: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Conclusion 24

• first proper description of original MiniSAT 1.13 minimization algorithm

• extensive experimental results:

minimization is effective and efficient

• substantial statistical variance in running SAT solvers

Page 26: Institute for Formal Models and Verificationfmv.jku.at/biere/talks/Biere-SAT09-talk.pdfCreated Date 6/27/2009 12:24:05 PM

Future Work 25

• how to use clauses not in the implication graph

[AudemardBordeauxHamadiJabbourSais SAT’09] . . .

• how to use intermediate resolvents

[HanSomenzi SAT’10] . . .

• how to extract resolution proofs directly [VanGelder SAT’10] next talk