randomized algorithms cs648

30
Randomized Algorithms CS648 Lecture 25 Derandomization using conditional expectation A probability gem 1

Upload: galeno

Post on 22-Feb-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Randomized Algorithms CS648. Lecture 25 Derandomization using conditional expectation A probability gem. Derandomization using conditional expectation. Problem 1 : Large cut in a graph. Problem: Let be an undirected graph on vertices and edges. Compute a cut of size at least . - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Randomized Algorithms CS648

Randomized AlgorithmsCS648

Lecture 25• Derandomization using conditional expectation• A probability gem

1

Page 2: Randomized Algorithms CS648

DERANDOMIZATION USING CONDITIONAL EXPECTATION

2

Page 3: Randomized Algorithms CS648

Problem 1: Large cut in a graph

Problem: Let be an undirected graph on vertices and edges. Compute a cut of size at least .

A randomized algorithm:∅; ∅; For each vertex Add to or randomly with probability independent of other vertices return the cut defined by .

: size of cut () returned by the randomized algorithm.E[] = Question: How to deterministically compute a cut of size in () time?

3

A simple application of conditional expectation

Page 4: Randomized Algorithms CS648

Problem 2: Approximate Distance OraclesProblem: Let be an undirected graph on vertices and edges. Compute a 3-approximate distance oracle of size .

A randomized algorithm: ∅; Add each vertex from to randomly independently with probability . for each , compute Ball(, ) for each , compute distance to all vertices.

: returned by the randomized algorithm.E[] =

Question: How to deterministically compute a 3-approximate distance oracle of size O() ?

4A non-trivial application of conditional expectation (published in ICALP 2005)

Page 5: Randomized Algorithms CS648

Problem 3: Min-Cut

Problem: Let be an undirected graph on vertices and edges. Compute minimum cut of .

Randomized algorithmMin-cut():{ Repeat times { Let ; Contract(). } return the edges of multi-graph ;}

Theorem: The algorithm computes a min-cut with probability at least .

Question: How to deterministically compute a min-cut in time ?

5

No idea whether we can use conditional expectation ?

Page 6: Randomized Algorithms CS648

Large cut in a graph

A randomized algorithm: ∅; ∅; For each vertex Add to or randomly with probability independent of other vertices return the cut defined by .

6

𝒗𝟏𝒗𝟐𝒗𝟑…𝒗𝒊𝒗 𝒊+𝟏𝒗𝒏

Page 7: Randomized Algorithms CS648

Notations:

For a given graph , and ,

: set of all edges from that have as one of the endpoint.

: set of all edges from that have at least one end point in .

: set of all edges from with one endpoint in and another in .

: set of all edges from with one endpoint and another endpoint in .

7

Page 8: Randomized Algorithms CS648

Notations:

: random variable denoting the number of edges in a cut output by the algorithm. : random variable taking value 1 if and 0 otherwise

: {, , …, }

: {, , …, } where for .

means .

8

Page 9: Randomized Algorithms CS648

CONDITIONAL EXPECTATION

Make sure you understand “Conditional expectation” before using it.So try to focus on the following slide.

9

Page 10: Randomized Algorithms CS648

10

𝑨 𝑩

𝒗𝟏𝒗𝟐𝒗𝟑…𝒗𝒊𝒗 𝒊+𝟏𝒗𝒏

𝑽 𝒊

Page 11: Randomized Algorithms CS648

|| +|

11

𝑨 𝑩

𝒗𝟏𝒗𝟐𝒗𝟑…𝒗𝒊𝒗 𝒊+𝟏𝒗𝒏

… …

𝑽 𝒊

𝑽 𝒊𝑨 𝑽 𝒊

𝑩

Page 12: Randomized Algorithms CS648

DERANDOMIZATION USING CONDITIONAL EXPECTATION

12

Page 13: Randomized Algorithms CS648

Role of conditional expectation

Either or

In general,

Either or

13

Page 14: Randomized Algorithms CS648

The Binary tree associated with the Randomized algorithm

14

𝒙 𝟏=𝟏 𝒙

𝟏=𝟎

𝒙 𝟐=𝟏

𝒙 𝟐=𝟏

𝒙𝟐=𝟎

𝒙𝟐=𝟎

𝒏

𝐄 [ 𝒁 ]

𝐄 [ 𝒁|𝒙𝟏=𝟏 ] 𝐄 [ 𝒁|𝒙𝟏=𝟎 ]

𝐄 [ 𝒁|𝒙𝟐=𝟏 , 𝒙𝟏=𝟏 ]

A cut of value

Page 15: Randomized Algorithms CS648

Using Conditional expectation

We wish to make choices for ’s such that

IDEA: Given that , choose such that

15

Page 16: Randomized Algorithms CS648

16

Page 17: Randomized Algorithms CS648

= || + |

17

𝑨 𝑩

𝒗𝟏𝒗𝟐𝒗𝟑…𝒗𝒊𝒗 𝒊+𝟏𝒗𝒏

… …

𝑽 𝒊

𝑽 𝒊𝑨 𝑽 𝒊

𝑩

Page 18: Randomized Algorithms CS648

= || + |

= ??

= ??

Question: Should we assign to or to ?

Assign to if || ||

18

|| + || + |

|| + || + |

Page 19: Randomized Algorithms CS648

Making Choice for

19

𝑨 𝑩

𝒗𝟏𝒗𝟐𝒗𝟑…𝒗𝒊𝒗 𝒊+𝟏𝒗𝒏

… …

𝑽 𝒊

𝑽 𝒊𝑨 𝑽 𝒊

𝑩

𝒗 𝒊+𝟏 𝒗 𝒊+𝟏

Page 20: Randomized Algorithms CS648

Deterministic algorithm for Large cut

Input: = ()∅; ∅; For each vertex { if ||> ||

Add to ; else

Add to ; } return the cut defined by .

Time Complexity: O().

Theorem: There is a deterministic O() time algorithm to compute a cut of size at least in any given undirected graph.

20

• This was a simple example of using conditional expectation to derandomize a randomized algorithm. But it conveys the crux of this powerful method. In order to use it to derandomize any other algorithm, all you might need is creative and analytical skills.

• Also remember, we can not hope to derandomized every randomized algorithm. But if it is possible to derandomize and algorithm, conditional expectation may prove to be a useful tool.

Page 21: Randomized Algorithms CS648

AN INTERESTING PROBLEM

21

Page 22: Randomized Algorithms CS648

Selecting a random number

Question: How many random bits are needed to select a number randomly uniformly from [1,32] ?Answer: 5

Question: How many random bits are needed to select a number randomly uniformly from [1,34] ?Answer: < 6⨯21. Select a random number from [1,64]2. If

return ; else repeat;

22

Page 23: Randomized Algorithms CS648

Selecting a random intervalQuestion: There are rational numbers . intervals {(), (),…,()}How to select an interval randomly with probability proportional to their length?Example: , , ,

Answer:1. Select a random number from []2. If

{ if , return I; if , return II; if , return III;

else return IV; } else repeat;

23

Page 24: Randomized Algorithms CS648

Selecting a random interval

There are rational numbers , with common denominator . intervals {(), (),…,()}

Example : , .

Question: How many random bits are needed for selecting an interval randomly with probability proportional to their length?

Answer:

Surprise: In fact we just need bits only.

24

Page 25: Randomized Algorithms CS648

SOLUTION FOR2 INTERVALS

25

Page 26: Randomized Algorithms CS648

𝒂𝟏=𝟓𝟑𝟐

26

𝟓

0 1 2 3 4 5 6 7 8 9 10 … 30 31

0 1

100 1

00

0

0 01 1

1 1 1 1

1

1

00

0 0

……….

Page 27: Randomized Algorithms CS648

𝒂𝟏=𝟓𝟑𝟐

27

𝟓

0 1 2 3 4 5 6 7 8 9 10 … 30 31

0 1

0 1

0

0

0

01 1

1 0 1

10

1 1

1

1

00

0 0

……….

Page 28: Randomized Algorithms CS648

𝒂𝟏=𝟓𝟑𝟐

28

𝟓

0 1 2 3 4 5 6 7 8 9 10 … 30 31

0 1

0 1

0 1

12

14

18

116

132

132

Show that expected number of random bits needed to select an interval is

Page 29: Randomized Algorithms CS648

For any

The expected number of random bits needed:

Last gem of this course: There are intervals {(), (),…,()}, where ’s are rational.Show that we need expected random bits to select an interval randomly.

29

Page 30: Randomized Algorithms CS648

Last slide

Question: Why did the instructor conclude the course with a probability gem ?

Answer: It is the joy of pondering over a probabilistic or algorithmic puzzle that is the strongest driving force to teach this course. Perhaps the same is the driving force for you to study this course. You disagree!You will realize this fact after a few years down the line…

Thanks for the attention you paid to this course

30