Randomness in Computing L ECTURE 25 Last time Drunkards walk - - PowerPoint PPT Presentation

โ–ถ
randomness in computing
SMART_READER_LITE
LIVE PREVIEW

Randomness in Computing L ECTURE 25 Last time Drunkards walk - - PowerPoint PPT Presentation

Randomness in Computing L ECTURE 25 Last time Drunkards walk Markov chains Randomized algorithm for 2SAT Today Randomized algorithm for 3SAT Gamblers ruin Classification of Markov chains Stationary distributions


slide-1
SLIDE 1

4/23/2020

Randomness in Computing

LECTURE 25

Last time

  • Drunkardโ€™s walk
  • Markov chains
  • Randomized algorithm for 2SAT

Today

  • Randomized algorithm for 3SAT
  • Gamblerโ€™s ruin
  • Classification of Markov chains
  • Stationary distributions

Sofya Raskhodnikova;Randomness in Computing; based on slides by Baranasuriya et al.

slide-2
SLIDE 2

Application: Algorithm for 3SAT

Recall: A 3CNF formula is an AND of clauses

  • Each clause is an OR of literals.
  • Each literal is a Boolean variable or its negation.
  • E.g. ๐‘ฆ1 โˆจ ๐‘ฆ2 โˆจ ๐‘ฆ3 โˆง ๐‘ฆ2 โˆจ ๐‘ฆ3 โˆจ ๐‘ฆ4 โˆง ๐‘ฆ1 โˆจ ๐‘ฆ3 โˆจ ๐‘ฆ4

3SAT Problem (search version): Given a 3CNF formula, find a satisfying assignment if it is satisfiable.

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-3
SLIDE 3
  • First try: the same algorithm as for 2SAT
  • We want to analyze the number of steps (iterations) necessary.

Application: Algorithm for 3SAT

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

  • 1. Start with an arbitrary truth assignment, e.g., all 0โ€™s.
  • 2. Repeat R times, terminating if ๐œš is satisfied:

a) Choose an arbitrary clause ๐ท that is not satisfied. b) Pick a uniformly random literal in ๐ท and flip its assignment.

  • 3. If a satisfying assignment is found, return it.
  • 4. Otherwise, return ``unsatisfiableโ€™โ€™.

Input: a 3CNF formula ๐œš on ๐‘œ variables

parameter

slide-4
SLIDE 4

Analysis: What should we change?

  • Let ๐‘‡ = a satisfying assignment of ๐œš.
  • ๐ต๐‘— = an assignment to ๐œš after ๐‘— steps
  • ๐‘Œ๐‘— = number of variables that have the same value in ๐ต๐‘— and ๐‘‡

When ๐‘Œ๐‘— = ๐‘œ, the algorithm terminates with a satisfying assignment.

  • If ๐‘Œ๐‘— = 0 then ๐‘Œ๐‘—+1 = 1

Pr ๐‘Œ๐‘—+1 = 1 ๐‘Œ๐‘— = 0 = 1

  • If ๐‘Œ๐‘— โˆˆ [1, ๐‘œ โˆ’ 1] then ๐ต๐‘— disagrees with ๐‘‡ on 1 or 2 literals of ๐ท

Pr ๐‘Œ๐‘—+1 = ๐‘˜ + 1 ๐‘Œ๐‘— = ๐‘˜ โ‰ฅ 1/2 Pr ๐‘Œ๐‘—+1 = ๐‘˜ โˆ’ 1 ๐‘Œ๐‘— = ๐‘˜ โ‰ค 1/2

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

๐‘Œ0, ๐‘Œ1, ๐‘Œ2, โ€ฆ is not necessarily a Markov chain 1 to 3 1/3 2/3

slide-5
SLIDE 5

Analysis: What should we change?

  • Define a Markov Chain ๐‘

0, ๐‘ 1, ๐‘ 2, โ€ฆ

๐‘

0 = ๐‘Œ0

Pr ๐‘

๐‘—+1 = 1 ๐‘ ๐‘— = 0 = 1

Pr ๐‘

๐‘—+1 = ๐‘˜ + 1 ๐‘ ๐‘— = ๐‘˜ = 1/2

Pr ๐‘

๐‘—+1 = ๐‘˜ โˆ’ 1 ๐‘ ๐‘— = ๐‘˜ = 1/2

  • ``Pessimistic versionโ€™โ€™ of stochastic process ๐‘Œ0, ๐‘Œ1, ๐‘Œ2, โ€ฆ

The expected time to reach ๐‘œ is larger for ๐‘

0, ๐‘ 1, ๐‘ 2, โ€ฆ than for ๐‘Œ0, ๐‘Œ1, ๐‘Œ2, โ€ฆ

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

1/3 2/3

slide-6
SLIDE 6

Expected time to reach ๐’

๐‘ก

๐‘˜ = expected number of steps to reach position ๐‘œ,

starting at postion ๐‘˜ ๐‘ก0 = ๐‘ก1 + 1 ๐‘ก๐‘œ = 0 for ๐‘˜ โˆˆ [1, ๐‘œ โˆ’ 1]: ๐‘ก

๐‘˜ = 1 + ๐‘ก๐‘˜โˆ’1 2

+

๐‘ก๐‘˜+1 2

ฮ˜ 2๐‘œ steps on average

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

๐’Œ ๐’ Tipsy 1/3 2/3

2๐‘ก

๐‘˜โˆ’1

3 ๐‘ก

๐‘˜+1

3

Not good

๐’•๐’Œ = ๐Ÿ‘๐’+๐Ÿ‘ โˆ’ ๐Ÿ‘๐’Œ+๐Ÿ‘ โˆ’ ๐Ÿ’ ๐’ โˆ’ ๐’Œ

slide-7
SLIDE 7

Ideas

  • The longer the algorithm runs, the more likely it is to move

towards 0.

Idea: Restart after a fixed number of steps.

  • How do we get better at the starting assignment?

Idea: Choose one at random.

Whatโ€™s the distribution of the number of variables that match S?

With nonnegligible probability we significantly exceed ๐‘œ/2 matches

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-8
SLIDE 8

Modified algorithm for 3SAT

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

  • 1. Repeat R times, terminating if ๐œš is satisfied:

a) Start with a uniformly random truth assignment. b) Repeat ๐Ÿ’๐’ times:

i. Choose an arbitrary clause ๐ท that is not satisfied. ii. Pick a uniformly random literal in ๐ท and flip its assignment.

  • 2. If a satisfying assignment is found, return it.
  • 3. Otherwise, return ``unsatisfiableโ€™โ€™.

Input: a 3CNF formula ๐œš on ๐‘œ variables

parameter

slide-9
SLIDE 9

Analysis

Want to understand: the probability of reaching assignment ๐‘‡ in 3๐‘œ steps starting from a random assignment.

  • Let ๐‘Ÿ be the probability that Markov chain ๐‘ reaches state ๐‘œ in 3๐‘œ steps

starting from a state that corresponds to a random assignment.

  • Let ๐’“๐’Œ be the probability that Markov chain ๐‘ reaches state ๐‘œ in 3๐‘œ steps

starting from the state ๐’ โˆ’ ๐’Œ.

๐‘Ÿ = เท

๐‘˜=0 ๐‘œ

Pr starting in state ๐‘œ โˆ’ ๐‘˜ โ‹… ๐‘Ÿ๐‘˜

  • One way for ๐‘ to reach state ๐‘œ from state ๐‘œ โˆ’ ๐‘˜ is

to move left ๐‘˜ times and right 2๐‘˜ times in the first 3๐‘˜ moves. ๐‘Ÿ๐‘˜ โ‰ฅ

3๐‘˜ ๐‘˜ 2 3 ๐‘˜ 1 3 2๐‘˜

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

๐’Œ ๐’ 1/3 2/3

slide-10
SLIDE 10

Analysis: Bounding ๐’“๐’Œ

So far: ๐‘Ÿ๐‘˜ โ‰ฅ

3๐‘˜ ๐‘˜ 2 3 ๐‘˜ 1 3 2๐‘˜

  • By Stirlingโ€™s formula, ๐‘›! = ฮ˜

๐‘› โ‹…

๐‘› ๐‘“ ๐‘›

  • When ๐‘˜ > 0,

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-11
SLIDE 11

Analysis: Bounding ๐’“

So far: ๐‘Ÿ is the probability that Markov chain ๐‘ reaches state ๐‘œ in 3๐‘œ steps starting from a state that corresponds to a random assignment.

๐‘Ÿ = เท

๐‘˜=0 ๐‘œ

Pr starting in state ๐‘œ โˆ’ ๐‘˜ โ‹… ๐‘Ÿ๐‘˜ ;

๐‘Ÿ๐‘˜ = ฮฉ 1 ๐‘˜ โ‹… 1 2๐‘˜ when j > 0

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-12
SLIDE 12

Analysis: final touches

  • When ๐œš is satisfiable, one run finds a satisfying assignment with

probability at least ๐‘Ÿ = ฮฉ

1 ๐‘œ โ‹… 3 4 ๐‘œ

  • The number of runs until finding a satisfying assignment is a

geometric random variable with expectation at most 1 ๐‘Ÿ = ๐‘ƒ ๐‘œ โ‹… 4 3

๐‘œ

  • Each run uses 3๐‘œ steps, so the expected number of steps is

๐‘ƒ ๐‘œ ๐‘œ โ‹… 4 3

๐‘œ

  • As for 2SAT, we set ๐‘† to 2๐‘ times the expected number of steps

to get a Monte Carlo algorithm that fails w. p. at most 2โˆ’๐‘.

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-13
SLIDE 13

The Gamblerโ€™s Ruin

  • State at time ๐‘ข: number of dollars won by Player 1

(could be negative)

  • Find the probability that Player 1 wins โ„“2 dollars before losing

โ„“1 dollars and the expected time to finish the game.

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

Player 1

with probability ยฝ Player 1 loses 1 dollar

Player 2

with probability ยฝ Player 2 loses 1 dollar Limit: โ„“๐Ÿ dollars Limit: โ„“๐Ÿ‘ dollars

slide-14
SLIDE 14

Recall: Drunkardโ€™s walk

  • Pr[Tipsy goes home

he started at position ๐‘˜ =

๐‘˜ ๐‘œ

  • Expected number of steps to finish the walk,

starting at postion ๐‘˜, is ๐‘˜(๐‘œ โˆ’ ๐‘˜)

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

Tipsy ๐’Œ ๐’

slide-15
SLIDE 15

Poll questions

The probability Player 1 wins โ„“2 before losing โ„“1 dollars is

  • The expected time to finish the game is

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

A.

โ„“1 โ„“2

B.

โ„“1 โ„“1+โ„“2

C.

โ„“2 โ„“1+โ„“2

D.

1 2

  • A. โ„“1(โ„“2 โˆ’ โ„“1)
  • B. โ„“1โ„“2
  • C. (โ„“1 + โ„“2)(โ„“2 โˆ’ โ„“1)

D.

โ„“2

2

slide-16
SLIDE 16

Classification of Markov chains

  • We want to study Markov chains that ``mixโ€™โ€™ well.
  • We will define Markov chains that avoid some problematic

behaviors: irreducible and aperiodic, and eventually ergodic.

  • A finite Markov chain is irreducible if its graph representation

consists of one strongly connected component.

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-17
SLIDE 17

Periodicity

  • Example: a Markov chain whose states are integers and it moves

to each neighboring state with probability ยฝ. If the chain starts at 0, when can it be in an even-numbered state?

  • A state is periodic if there exists an integer ฮ” > 1 such that

Pr ๐‘Œ๐‘ข+๐‘ก = ๐‘˜ ๐‘Œ๐‘ข = ๐‘˜ = 0 unless ๐‘ก is divisible by ฮ” ; otherwise, it is aperiodic.

  • A Markov chain is aperiodic if all its states are aperiodic.

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-18
SLIDE 18

Ergodicity

  • Let return probability ๐‘ 

๐‘—,๐‘˜ ๐‘ข be the probability that, starting at state ๐‘—,

the first transition to state ๐‘˜ occurs at time ๐‘ข: ๐‘ 

๐‘—,๐‘˜ ๐‘ข = Pr ๐‘Œ๐‘ข = ๐‘˜ and, for ๐‘ก โˆˆ ๐‘ข โˆ’ 1 , ๐‘Œ๐‘ก โ‰  ๐‘˜ ๐‘Œ0 = ๐‘—]

  • A state ๐‘— is recurrent if ฯƒ๐‘ขโ‰ฅ1 ๐‘ 

๐‘—,๐‘— ๐‘ข = 1 and transient if ฯƒ๐‘ขโ‰ฅ1 ๐‘  ๐‘—,๐‘— ๐‘ข < 1.

A Markov chain is recurrent if every state in it is recurrent.

โ€“ If a state ๐‘— is recurrent, once the chain visits ๐‘—, it will return again and again.

  • The hitting time โ„Ž๐‘—,๐‘˜ is the expected time to first reach state ๐‘˜ from

state ๐‘—: โ„Ž๐‘—,๐‘˜ = ฯƒ๐‘ขโ‰ฅ1 ๐‘ข โ‹… ๐‘ 

๐‘—,๐‘˜ ๐‘ข .

  • A recurrent state ๐‘— is positive recurrent if โ„Ž๐‘—,๐‘— is finite.

โ€“ In a finite Markov chain, all recurrent states are positive recurrent.

  • A state is ergodic if it is aperiodic and positive recurrent.
  • A Markov chain is ergodic if all its states are ergodic.

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

slide-19
SLIDE 19

Stationary Distributions

Recall: าง ๐‘ž ๐‘ข + 1 = าง ๐‘ž ๐‘ข ๐‘ธ, where าง ๐‘ž ๐‘ข is the distribution of the state

  • f the chain at time ๐‘ข and ๐‘ธ is its transition probability matrix.
  • A stationary distribution of a Markov chain is a probability

distribution เดค ๐œŒ such that เดค ๐œŒ = เดค ๐œŒ๐‘ธ.

(Describes steady state behavior of a Markov chain.)

4/23/2020

Sofya Raskhodnikova; Randomness in Computing

Fundamental Theorem of Markov Chains

Every finite, irreducible and aperiodic Markov chain satisfies the following: 1. It is ergodic. 2. There is a unique stationary distribution เดค

๐œŒ = (๐œŒ0, ๐œŒ_1, โ€ฆ , ๐œŒ๐‘œ), where

๐œŒ๐‘— > 0 for all ๐‘— โˆˆ [๐‘œ]. 3. For all ๐‘— โˆˆ [๐‘œ], the hitting time โ„Ž๐‘—๐‘— = 1/๐œŒ๐‘—.