lecture 14-cs648-2013
TRANSCRIPT
![Page 1: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/1.jpg)
Randomized AlgorithmsCS648
Lecture 14Expected duration of a randomized experiment
Part II
1
![Page 2: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/2.jpg)
REVISITING SOME DISCRETE MATHEMATICS
2
![Page 3: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/3.jpg)
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/๐๐
![Page 4: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/4.jpg)
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 /๐๐
![Page 5: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/5.jpg)
DISTRIBUTED CLIENT-SERVER PROBLEM
5
![Page 6: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/6.jpg)
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
![Page 7: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/7.jpg)
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
![Page 8: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/8.jpg)
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.
![Page 9: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/9.jpg)
Distributed Client-Server problemRandomized protocol
9
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Bins
Balls
![Page 10: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/10.jpg)
Distributed Client-Server problemRandomized protocol
10
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8
Round 1
![Page 11: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/11.jpg)
Distributed Client-Server problemRandomized protocol
11
3 4 7 8
1 2 3 4 5 6 7 8
![Page 12: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/12.jpg)
Distributed Client-Server problemRandomized protocol
12
3 4 7 8
1 2 3 4 5 6 7 8
Round 2
![Page 13: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/13.jpg)
Distributed Client-Server problemRandomized protocol
13
8
1 2 3 4 5 6 7 8
Round 3
![Page 14: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/14.jpg)
CALCULATING EXPECTED NO. OF ROUNDS FIRST APPROACH
14
![Page 15: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/15.jpg)
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
![Page 16: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/16.jpg)
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
![Page 17: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/17.jpg)
Distributed Client-Server problemRandomized protocol
E[] = : no. of balls at the end of round . E[| ] = ??
17
1 2 ๐
1 2 โฆ -1
Round
โค๐๐
๐
![Page 18: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/18.jpg)
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.
๐๐๐๐
![Page 19: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/19.jpg)
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
![Page 20: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/20.jpg)
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 ?
![Page 21: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/21.jpg)
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
![Page 22: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/22.jpg)
CALCULATING EXPECTED NO. OF ROUNDS WITH NEW INSIGHT
22
![Page 23: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/23.jpg)
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๐ง๐จ .๐จ๐ ๐๐๐ฅ๐ฅ๐ฌโค
๐๐
![Page 24: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/24.jpg)
CALCULATING EXPECTED NO. OF ROUNDS IN STAGE 2
24
![Page 25: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/25.jpg)
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
โค๐โ๐(๐โ(๐โ๐๐ +(๐๐ ) ๐๐๐ ))ยฟ๐โ๐((๐๐ โ(๐๐ ) ๐๐๐ ))ยฟ (๐๐ )๐๐
๐โ๐ง๐จ .๐จ๐ ๐ง๐จ๐ง๐๐ฆ๐ฉ๐ญ๐ฒ ๐๐ข๐ง๐ฌ
![Page 26: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/26.jpg)
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
โค(๐๐ ) ๐๐โค๐๐
๐๐
โค๐๐ (๐๐ )
๐
โค๐๐
(๐ ๐ )๐
![Page 27: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/27.jpg)
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
![Page 28: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/28.jpg)
Distributed Client-Server problemRandomized protocol
Theorem: The expected number of rounds taken by the Randomized protocol is at most .
28
![Page 29: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/29.jpg)
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
![Page 30: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/30.jpg)
RUMOR SPREADING
30
![Page 31: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/31.jpg)
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
![Page 32: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/32.jpg)
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.
![Page 33: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/33.jpg)
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
![Page 34: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/34.jpg)
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
![Page 35: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/35.jpg)
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๐
![Page 36: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/36.jpg)
EXPECTED NO. OF DAYS IN STAGE 2
36
![Page 37: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/37.jpg)
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
![Page 38: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/38.jpg)
EXPECTED NO. OF DAYS IN STAGE 1
38
![Page 39: Lecture 14-cs648-2013](https://reader036.vdocuments.mx/reader036/viewer/2022081404/557cc387d8b42a7e5b8b4577/html5/thumbnails/39.jpg)
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.