Vous êtes sur la page 1sur 30

Probabilistic analysis of satisability

Next: What is quantitative relationship between satisable and unsatisable problems? In other words if we pick a set of clauses at random with what probability it will be satisable? How can we randomly generate hard problems? Randomized algorithms for showing satisability.

1 / 30

Random Clause Generation


Consider: 3-clauses; 3-SAT. Fix: Number n of boolean variables. Note: the set of 3-clauses is nite, denoted TC . the set of sets of 3-clauses is nite, denoted TS . Consider a process: Start from the empty set of clauses and repeatedly add new clauses from TC then we can observe transition from satisable to unsatisable. Next question: What is the ratio of the number of clauses to the number of variables when this transition takes place?
2 / 30

Probability of obtaining an unsatisable set


Randomly generate s-sets of 3-clauses for each 0 s |TC |. We plot the probability of a clause to be unsatisable w.r.t. the ratio r = s/n. 1.0 (r, 80)

0.5 crossover point 0 3 4 5 6


3 / 30

Sharp Phase Transition

1.0

(r, n)
* n = 200

************

n = 140 n = 80

0.5

0 ********* 3 4

r 5 6

4 / 30

-window

1 0.9

(r, 80)

0.1 0 3 4 5

0.1-window r 6

5 / 30

Scaling Window Eect


0.01-window and 0.1-window: n 190 170 150 130 110 90 70 r 4 5 190 170 150 130 110 90 70 r 4 4.5 n

6 / 30

Easy-Hard-Easy Pattern
branches
7000 6000 5000 4000 3000 2000 1000 0 3 4 5 6
7 / 30

easy

hard

crossover point

easy
r

One-sided randomized algorithms


Randomized algorithms: algorithms that uses random numbers One-sided satisability algorithms: input: a set of clauses S output I such that I |= S ; or do not know Note: Evaluation of a given set of clauses S on a given interpretation I can be done eciently (polynomial time). Idea: To check satisability of S repeat the following randomly generate an interpretation I evaluate S on I
if I (S ) = 1 then return I

8 / 30

Satisability Algorithm that Cannot Establish Unsatisability


procedure CHAOS (S ) input: set of clauses S output: interpretation I such that I |= S or dont know parameters: positive integer MAX-TRIES begin repeat MAX-TRIES times I := random interpretation if I |= S then return I return dont know end

Satisability has short witnesses: interpretations.


9 / 30

Randomised Algorithms for SAT

Local search: Choose a random interpretation. If this interpretation is not a model, repeatedly choose a variable and change its value in the interpretation (ip the variable). The ipped variables are chosen using heuristics or randomly, or both.

10 / 30

Flipping a Variable

ip (I, p) = I where 1, I (q ) = 0, I (q ), changing its value on p. if p = q and I (p) = 0; if p = q and I (p) = 1. if p = q ;

In other words, the interpretation ip (I, p) is obtained from I by

11 / 30

GSAT
procedure GSAT (S ) input: set of clauses S output: interpretation I such that I |= S or dont know parameters: integers MAX-TRIES, MAX-FLIPS begin repeat MAX-TRIES times I := random interpretation if I |= S then return I repeat MAX-FLIPS times p := an atom such that ip (I, p) satises the maximal number of clauses in S I := ip (I, p) if I |= S then return I return dont know end
12 / 30

GSAT example

p1 p2 p3 ,

p2 p3 ,

p1 p3 ,

p1 p2 ,

p1 p 2 .

ip no. 1

interpretation p1 0 p2 0 p3 1

satised clauses p1 4 p2 p3

candidates for ipping

ipped atom

13 / 30

GSAT example

p1 p2 p3 ,

p2 p3 ,

p1 p3 ,

p1 p2 ,

p1 p 2 .

ip no. 1

interpretation p1 0 p2 0 p3 1

satised clauses p1 4 3 p2 4 p3 4

candidates for ipping p 2 , p3

ipped atom p2

14 / 30

GSAT example

p1 p2 p3 ,

p2 p3 ,

p1 p3 ,

p1 p2 ,

p1 p 2 .

ip no. 1 2

interpretation p1 0 0 p2 0 1 p3 1 1

satised clauses p1 4 4 3 p2 4 p3 4

candidates for ipping p 2 , p3

ipped atom p2

15 / 30

GSAT example

p1 p2 p3 ,

p2 p3 ,

p1 p3 ,

p1 p2 ,

p1 p 2 .

ip no. 1 2

interpretation p1 0 0 p2 0 1 p3 1 1

satised clauses p1 4 4 3 3 p2 4 4 p3 4 4

candidates for ipping p 2 , p3 p 2 , p3

ipped atom p2 p3

16 / 30

GSAT example

p1 p2 p3 ,

p2 p3 ,

p1 p3 ,

p1 p2 ,

p1 p 2 .

ip no. 1 2 3

interpretation p1 0 0 0 p2 0 1 1 p3 1 1 0

satised clauses p1 4 4 4 3 3 p2 4 4 p3 4 4

candidates for ipping p 2 , p3 p 2 , p3

ipped atom p2 p3

17 / 30

GSAT example

p1 p2 p3 ,

p2 p3 ,

p1 p3 ,

p1 p2 ,

p1 p 2 .

ip no. 1 2 3

interpretation p1 0 0 0 p2 0 1 1 p3 1 1 0

satised clauses p1 4 4 4 3 3 5 p2 4 4 4 p3 4 4 4

candidates for ipping p 2 , p3 p 2 , p3 p1

ipped atom p2 p3 p1

18 / 30

GSAT example

p1 p2 p3 ,

p2 p3 ,

p1 p3 ,

p1 p2 ,

p1 p 2 .

ip no. 1 2 3

interpretation p1 0 0 0 1 p2 0 1 1 1 p3 1 1 0 0

satised clauses p1 4 4 4 5 3 3 5 p2 4 4 4 p3 4 4 4

candidates for ipping p 2 , p3 p 2 , p3 p1

ipped atom p2 p3 p1

We choose randomly among ipping candidates.


19 / 30

GSAT with random walks


procedure GSATwithWalks (S ) input: set of clauses S output: interpretation I such that I |= S or dont know parameters: integers MAX-TRIES, MAX-FLIPS real number 0 1 (probability of a sideways move), begin repeat MAX-TRIES times I := random interpretation ; if I |= S then return I repeat MAX-FLIPS times with probability with probability 1 randomly select p among atoms occurring in clauses false in I I := ip (I, p) ; if I |= S then return I return dont know end
20 / 30

p := an atom such that ip (I, p) satises the maximal number of clauses

WSAT
procedure WSAT (S ) input: set of clauses S output: interpretation I such that I |= S or dont know parameters: integers MAX-TRIES, MAX-FLIPS begin repeat MAX-TRIES times I := random interpretation if I |= S then return I repeat MAX-FLIPS times randomly select a clause C S such that I randomly select an atom p in C I := ip (I, p) if I |= S then return I return dont know end
21 / 30

WSAT example

p1 p2 p3 , ip no. 1

p2 p3 ,

p1 p3 , unsatised clauses p 1 p2

p1 p2 , candidates for ipping

p1 p 2 . ipped atom

interpretation p1 0 p2 0 p3 1

22 / 30

WSAT example

p1 p2 p3 , ip no. 1

p2 p3 ,

p1 p3 , unsatised clauses p 1 p2

p1 p2 , candidates for ipping p1 , p2

p1 p 2 . ipped atom p1

interpretation p1 0 p2 0 p3 1

23 / 30

WSAT example

p1 p2 p3 , ip no. 1 2

p2 p3 ,

p1 p3 , unsatised clauses p 1 p2 p1 p3 p1 p2

p1 p2 , candidates for ipping p1 , p2

p1 p 2 . ipped atom p1

interpretation p1 0 1 p2 0 0 p3 1 1

24 / 30

WSAT example

p1 p2 p3 , ip no. 1 2

p2 p3 ,

p1 p3 , unsatised clauses p 1 p2 p1 p3 p1 p2

p1 p2 , candidates for ipping p1 , p2 p1 , p2 , p3

p1 p 2 . ipped atom p1 p2

interpretation p1 0 1 p2 0 0 p3 1 1

25 / 30

WSAT example

p1 p2 p3 , ip no. 1 2 3

p2 p3 ,

p1 p3 , unsatised clauses p 1 p2 p1 p3 p1 p2 p2 p3 p1 p3

p1 p2 , candidates for ipping p1 , p2 p1 , p2 , p3

p1 p 2 . ipped atom p1 p2

interpretation p1 0 1 p2 0 0 p3 1 1

26 / 30

WSAT example

p1 p2 p3 , ip no. 1 2 3

p2 p3 ,

p1 p3 , unsatised clauses p 1 p2 p1 p3 p1 p2 p2 p3 p1 p3

p1 p2 , candidates for ipping p1 , p2 p1 , p2 , p3 p1 , p2 , p3

p1 p 2 . ipped atom p1 p2 p3

interpretation p1 0 1 p2 0 0 p3 1 1

27 / 30

WSAT example
p1 p2 p3 , ip no. 1 2 3 p2 p3 , p1 p3 , unsatised clauses p 1 p2 p1 p3 p1 p2 1 1 1 p2 p3 p1 p3 1 1 0 p1 , p2 , p3 p3 p1 p2 , candidates for ipping p1 , p2 p1 , p2 , p3 p1 p 2 . ipped atom p1 p2

interpretation p1 0 1 p2 0 0 p3 1 1

28 / 30

Randomized algorithms vs. DLL:


Randomized algorithms (strengths): Easy to implement Behave well on some problems with thousands of variables (which can not be solved by DLL). Randomized algorithms (limitations): unstable behaviour unlike DLL we can not use randomized algorithms to show unsatisability some problems can be solved faster by DLL

29 / 30

Summary

We have studied probabilistic behaviour of satisability: sharp threshold from sat. to unsat. hard problems near the threshold Randomized algorithms for satisability: one-side answer: satisable or dont know GSAT, GSAT with random walks and WSAT

30 / 30

Vous aimerez peut-être aussi