Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2...

19
Adrian Balint Andreas Fröhlich July 13, 2010 Improving stochastic local search for SAT with a new probability distribution

Transcript of Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2...

Page 1: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Adrian Balint Andreas Fröhlich

July 13, 2010

Improving stochastic local search for

SAT with a new probability distribution

Page 2: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 2 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Introduction

SATI Formula F as a set of clauses. Each clause as a set of literals.

I Is there an assignment α, so that F (α) = 1?

SLS-solversI Operate on complete assignments.

I Try to change an initial assignment α0 in a way, so that it becomes

satisfying after several steps.

I Use local information and heuristics to decide how to modify the

assignment in each search step.

Page 3: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 3 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Pseudocode of a typical SLS-solver

INPUT: formula F , cutoff.

OUTPUT: model for F or UNKNOWN.

SLS(F , cutoff)

for i=1 to maxTries

α = α0 = random assignment;

for j=1 to maxFlips

if (α is a model for F ) return α;

var = pickVar ();

α[var] = 1−α[var];

return UNKNOWN;

Page 4: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 4 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

SLS architectures

I Differ in how to select a variable for flipping.

GSATI Considers all variables.

WalkSATI Only considers variables from a randomly chosen unsatisfied clause.

DLSI Similar to GSAT. Additionally uses clause-weighting.

Page 5: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 5 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Modern SLS-solvers

I Can not be put into just one category.

I Are hybrids of the different architectures e.g.:

I adaptG2WSAT = GSAT + WalkSAT + adaptive scheme [Li07]I gNovelty+ = adaptG2WSAT + DLS-component [Pham07]I TNM = GSAT + WalkSAT-version + two noise schemes to switch

between [Wei09]

I they all use a Novelty-version to escape from local minima.

Page 6: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 6 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Escaping from local minima

NoveltyI Choose a random unsatisfied clause c ∈ F

I Pick a variable x from c according to the following heuristic:

best score variable has min age?

choose best variable

best variablechoose second choose best variable

no yes

noise 1-noise

Page 7: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 7 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Escaping from local minima

adaptNovelty+I Additionally implements a random walk with probability wp.

I Uses an adaptive scheme for setting the noise probability [Hoos02].

Page 8: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 8 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Novelty as a probability distribution

I This can be seen as a probability distribution p on the variables of c.

I p(x) can take only 4 different values:

I Always chosen; p(x) = 1I Chosen, when no noise step occurs; p(x) = (1−noise)I Chosen, when a noise step occurs; p(x) = noiseI Never chosen; p(x) = 0

I Information used to decide: score, age

I Does not take into account the exact values of score and age.

I Does not put different variables into relation.

Page 9: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 9 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Example

I c = {x1,x2,x3}

Case 1I score(x1) = 0,score(x2) =−3,score(x3) =−3

I age(x1) = 104−2,age(x2) = 104,age(x3) = 104−1

Case 2I score(x1) =−1,score(x2) =−2,score(x3) =−3

I age(x1) = 103,age(x2) = 104,age(x3) = 107

I Both cases are identical for Novelty+.

I The only chance for x3 to be selected is by a random walk.

Page 10: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 10 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

New probability distribution

I Define a probability distribution as a concatenation of continuous

functions on the variables of c.

I Choose a random variable according to this distribution.

I The form of this distribution p(x) := ps(x)·pa(x)∑x̃∈c ps(x̃)·pa(x̃)

.

I ps(x) is a function considering the score of x.

I pa(x) is a function considering the age of x.

I pa(x),ps(x)> 0

Page 11: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 11 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

New probability distribution

I Define a probability distribution as a concatenation of continuous

functions on the variables of c.

I Choose a random variable according to this distribution.

I The form of this distribution p(x) := ps(x)·pa(x)∑x̃∈c ps(x̃)·pa(x̃)

.

I ps(x) := c1score(x)

I pa(x) :=(

age(x)c3

)c2+1

I c1 controls the influence of score on the decision.

I c2 and c3 specify, how quick and how strong age starts to affect the

decision.

Page 12: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 12 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Properties of p

Like NoveltyI Prefers variables with high score.

I Prefers variables with high age.

AdditionallyI Takes into account the exact values of score and age.

I Puts different variables into relation.

I Does not need an explicit random walk.

I Implicit random walk because of ps(x),pa(x)> 0.

I Does not need an explicit noise scheme.

I Growing age automatically leads to new decisions when getting stuck in

a certain part of the search space.

Page 13: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 13 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Implementation details

SparrowI gNovelty+ as the basic module. gNovelty+ consists of:

I Gradient-walk as in G2WSAT.I adaptNovelty+ to escape local minima.I Additive weighting scheme.

I Replaced the adaptNovelty+ component by a WalkSAT-algorithm

using the presented probability distribution.

I Specifying the parameters c1 = 4,c2 = 4,c3 = 105.

I Constants fixed for all instances.I Empirical values.I Not optimized yet.

Page 14: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 14 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Evaluation

Empirical TestsI 2 sets of large random 3-SAT instances with ratio = 4.2

I Not optimized for k -SAT, k 6= 3.

I Benchmark 1:

I 64 different instances from SAT 2009 Competition (2k - 18k variables)I Each instance is solved 100 times (cutoff 1200 sec.)

I Benchmark 2:

I 40 additional instances from SAT 2009 Competition (20k - 26k variables)I Each instance is solved 50 times (cutoff 2400 sec.)

Page 15: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 15 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Results: Sparrow vs gNovelty+

0.0e+00 1.5e+08 3.0e+08

0.0e+00

1.5e+08

3.0e+08

0 100 200 300

0100200300

0 20 40 60 80 100

020

60100

gnovelt

y+

2T

Sparrow

Numbers of flips Time in seconds Success runs

Page 16: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 16 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Results: Sparrow vs TNM

0.0e+00 1.0e+08

0.0e+00

1.0e+08

0 50 100 150

050

100

150

0 20 40 60 80 100

020

60100

0e+00 2e+08 4e+08

0e+00

3e+08

0 100 300 500

0200

400

600

0 10 20 30 40 50

010

3050T

NM

Numbers of flips Time in seconds Success runs

Sparrow

Page 17: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 17 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Results: Sparrow vs hybridGM3

0.0e+00 1.0e+08

0.0e+00

1.0e+08

0 50 100 150 200 250

050

150

250

0 20 40 60 80 100

020

60100

0.0e+00 1.0e+08

0.0e+00

1.0e+08

0 100 200 300 400

0100

300

0 10 20 30 40 50

010

3050

hyb

rid

GM

3

Sparrow

Numbers of flips Time in seconds Success runs

Page 18: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 18 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Conclusion

SummaryI Escaping local minima is a key feature for SLS-solvers

I Variable selection in local minima should not be done in a

deterministic way

I Detailed differentiation useful for variable selection.

OutlookI Implement more attributes.

I Arbitrary complex function.

I Variable expressions [Tompkins10].

Page 19: Adrian Balint Andreas Fröhlich Improving stochastic local search for · 2010. 7. 21. · Page 2 Improving stochastic local search for SAT with a new probability distribution jBalint,

Page 19 Improving stochastic local search for SAT with a new probability distribution | Balint, Fröhlich | July 13, 2010

Thank you for your attention!