Lecture 14-cs648-2013
-
Upload
anshul-yadav -
Category
Technology
-
view
204 -
download
0
description
Transcript of Lecture 14-cs648-2013
Randomized AlgorithmsCS648
Lecture 14Expected duration of a randomized experiment
Part II
1
REVISITING SOME DISCRETE MATHEMATICS
2
Recurrence 1
For any , Question: What is the smallest value of such that for a given ?Answer: ??
For any , for some Question: What is the smallest value of such that for a given ?Answer: ??
3
log 2๐
log 1/๐๐
Recurrence 2
For any , Question: What is the smallest value of such that for a given ?Answer: ??
for some For any , for some Question: What is the smallest value of such that for a given ?Answer: ??
4
log 2lo g2๐
log๐ log1 /๐๐
DISTRIBUTED CLIENT-SERVER PROBLEM
5
Distributed Client-Server Problem
โข There are -clients and -servers.โข Each client knows address of each server.โข Each client has a single job.โข It is a distributed computational environment.โข A server can execute only one job in one round.
Aim: A distributed protocol to finish all jobs as quickly as possible.
6
Distributed Client-Server Problem
Randomized protocol (one round)โข Each client sends a request to a server selected randomly uniformly and
independently.
โข Each server which receives one or more requests, accepts only one request and finishes the corresponding job.
โข Each client, whose job is finished, leaves the system.
โข The remaining clients repeat the same procedure in next round.
Question: what is the expected number of rounds to finish all jobs?
7
Distributed Client-Server problemRandomized protocol
8
1 2 3 4 5 6 7 8
Clients
1 2 3 4 5 6 7 8
Servers
It can be framed as our familiar ball-bin problem.
Distributed Client-Server problemRandomized protocol
9
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Bins
Balls
Distributed Client-Server problemRandomized protocol
10
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Round 1
Distributed Client-Server problemRandomized protocol
11
3 4 7 8
1 2 3 4 5 6 7 8
Distributed Client-Server problemRandomized protocol
12
3 4 7 8
1 2 3 4 5 6 7 8
Round 2
Distributed Client-Server problemRandomized protocol
13
8
1 2 3 4 5 6 7 8
Round 3
CALCULATING EXPECTED NO. OF ROUNDS FIRST APPROACH
14
Distributed Client-Server problemRandomized protocol
: no. of balls leaving the system at the end of round . E[] = ??
15
1 2 ๐
1 2 3 โฆ -1
Round 13 ๐โ๐
Not so easy to find
Distributed Client-Server problemRandomized protocol
: no. of balls leaving the system in round . E[] = ?? = = : no. of balls remaining in the system after round . E[] =
16
1 2 ๐
1 2 3 โฆ -1
3 ๐โ๐
Is there any relation between no. of empty bins and
no. of balls leaving the system in round 1 ?
๐โ๐๐ฑ๐ฉ๐๐๐ญ๐๐๐ง๐จ .๐จ๐ ๐๐ฆ๐ฉ๐ญ๐ฒ ๐๐ข๐ง๐ฌ
Round 1
Distributed Client-Server problemRandomized protocol
E[] = : no. of balls at the end of round . E[| ] = ??
17
1 2 ๐
1 2 โฆ -1
Round
โค๐๐
๐
Distributed Client-Server problemRandomized protocol
Lemma1 : After round , the expected number of balls left is less than th fraction of the balls after round .
: fraction of balls in the system after round .Lemma 1 implies E[] If everything goes as expected, then
18
Round No. of balls in the system Fraction of balls in the system
0 1
๐ /๐ ๐/๐ยฟ๐ /๐๐ ยฟ๐ /๐๐2
1
This table gives the intuition for the expected no. of rounds but it directly does not help us to calculate the expected no. of rounds ? It also does not directly help to get a high prob. Bound. Convince yourself before proceeding further.
๐๐๐๐
Distributed Client-Server problemRandomized protocol
Lemma: After round , the expected no. of balls is less than th fraction of the balls after round .Definition: round is good if , and bad otherwise.
P(a round is bad) = ?? P(a round is good)
Question: After how many good rounds will there be no ball left ?
Expected no. of rounds = ??
19
โค๐๐ โค
๐๐
๐ฅ๐จ๐ ๐๐
โค๐๐ฅ๐จ๐ ๐๐Each round is good independent
of other rounds.
Use Markovโs Inequality
Use Recurrence 1
Distributed Client-Server problemRandomized protocol
Theorem: The Randomized protocol will terminate in expected O() rounds.
20
This bound is very loose. Can you see why ?
An important insight that we missed
Question: What is the cause of multiple rounds for a ball ?Answer: presence of other competing balls
INSIGHT As the algorithm proceeds:โข The number of these competing balls reduce โข but the number of bins remain unchanged
Chances of a ball to leave the system increases as the algorithm proceeds.
21
CALCULATING EXPECTED NO. OF ROUNDS WITH NEW INSIGHT
22
Distributed Client-Server problemRandomized protocol
Partitioning experiment into stages
Stage 1: The number of balls Stage 2: The number of balls
Expected no. of rounds in Stage 1 : 4.Expected no. of rounds in Stage 2 : ??
23
Stage 1 Stage 2๐ง๐จ .๐จ๐ ๐๐๐ฅ๐ฅ๐ฌโค
๐๐
CALCULATING EXPECTED NO. OF ROUNDS IN STAGE 2
24
Distributed Client-Server problemRandomized protocol
: no. of balls at the end of round . E[| ] = ??
25
1 2 ๐
1 2 3 โฆ -1
Round
๐โ๐(๐โ(๐โ๐๐ )๐)
We need a reasonably good upper bound for this expression
โค๐โ๐(๐โ(๐โ๐๐ +(๐๐ ) ๐๐๐ ))ยฟ๐โ๐((๐๐ โ(๐๐ ) ๐๐๐ ))ยฟ (๐๐ )๐๐
๐โ๐ง๐จ .๐จ๐ ๐ง๐จ๐ง๐๐ฆ๐ฉ๐ญ๐ฒ ๐๐ข๐ง๐ฌ
Distributed Client-Server problemRandomized protocol
: no. of balls at the end of round . E[| ] = ??
E = ??: fraction of balls at the end of round . E[] = ??
26
1 2 ๐
1 2 3 โฆ -1
Round
โค(๐๐ ) ๐๐โค๐๐
๐๐
โค๐๐ (๐๐ )
๐
โค๐๐
(๐ ๐ )๐
Distributed Client-Server problemRandomized protocol
Lemma: If is the fraction of balls at end of round in stage 2, the expected fraction of balls at the end of round will be at most .
Definition: round is good if , and bad otherwise.
P(a round is bad) = ?? P(a round is good) Question: After how many good rounds will there be no ball left ?
Expected no. of rounds = ??
27
โค ๐ฅ๐จ๐ ๐๐ฅ๐จ๐ ๐๐
โค๐๐ฅ๐จ๐ ๐ ๐ฅ๐จ๐ ๐๐
Use Markovโs Inequality
Use Recurrence 2
Distributed Client-Server problemRandomized protocol
Theorem: The expected number of rounds taken by the Randomized protocol is at most .
28
Distributed Client-Server problemRandomized protocol
Points to Ponder :
โข Why did we analyze the random variable and not ?
โข Why did we introduce the two stages ?
โข Do you find any similarity in the analysis with that of of Quick sort concentration?
โข Can you also achieve lower bound of on the expected number of rounds ? (this question is only for those whose aim is more than just grade A )
โข Can you achieve high probability bound on the number of rounds ?
29
RUMOR SPREADING
30
Rumor Spreading
There are persons in a city.On day , a person comes to know a rumor.
The following protocol is repeated from day :โข Each person knowing the rumor does the following - Picks phone number of a randomly selected person - Calls him/her and communicate the rumor.
Question: What is the expected number of days until everyone knows the rumor?
31
Rumor Spreading
Question: What is the minimum number of days until everyone knows the rumor?Answer:
32
Number of people knowing the rumor can only double
in a day.
Rumor Spreading
Theorem (it should surprise you): 1. The entire city comes to know the rumor in O() expected days. 2. The entire city comes to know the rumor in O() days with high
probability.
33
Rumor Spreading
Intuition 1:In the beginning, there are few persons who know the rumor. As a resultโข The chances of selecting a person who does not know the rumor is more.โข The chances of collisions are also few.As long as the no. of people knowing the rumor is less than , for some suitable , the no. of people knowing the rumor should increase by a factor every day.
Intuition 2:Once there are more than persons knowing the rumor, the probability of a person unaware of rumor to get a phone call about rumor should be high.
Can you use these two intuitions to partition the algorithm into stages ?
34
Rumor Spreading
Partition the experiment into stages
Select some suitably.
Stage 1: the number of people knowing the rumor is less than
Stage 2: the number of people knowing the rumor is more than
35
Stage 1 Stage 2๐ง๐จ .๐จ๐ ๐ฉ๐๐จ๐ฉ๐ฅ๐๐ค๐ง๐จ๐ฐ๐ข๐ง๐ ๐ซ๐ฎ๐ฆ๐จ๐ซ >c๐
EXPECTED NO. OF DAYS IN STAGE 2
36
Rumor Spreading
In the beginning of Stage 2: the no. of people knowing the rumor .
โข Pick any person not knowing the rumor.
โข Show that he/she will know the rumor in days with high probability.
โข Use Union theorem to conclude that the number of days in Stage 2 is with high probability.
37
EXPECTED NO. OF DAYS IN STAGE 1
38
39
It is left as a home work to be discussed in some future class.I shall be happy to see a correct
solution by some of you in the next class.