Download - The k-server Problem Study Group: Randomized Algorithm Presented by Ray Lam August 16, 2003
The k-server Problem
Study Group: Randomized Algorithm
Presented by Ray LamAugust 16, 2003
2
Outline
1. Background and problem definition
2. The Harmonic k-server Algorithm
3. Proving the claimed performance of the algorithm
Background
And Problem Definition
4
The Metric Space
Definition: A metric space M = (V, d) consists of a set of points V with a distance function d:V R satisfying the following properties: d(u,v) 0 for all u, v V. d(u,v) = 0 iff u = v. d(u,v) = d(v,u) for all u, v V. d(u,v) + d(v,w) d(u,w) for all u, v, w V.
5
The Metric Space
Think of it as a complete weighted graph Weight corresponds to distance between
points
1 3
4
2 22
3
2
1
1
6
The k-server Problem
k servers in the metric space Located at particular points
Request of service Happens at the points To serve the request: move a server to the point
of request A request sequence , where is a
point in M, is a finite sequence of requests...21 i
7
The k-server Problem
Two competing algorithms An adversary offline algorithm An online algorithm to be designed
The adversary algorithm Knows all of right from the beginning and
serves them optimally with his own k servers Thus it is offline
8
The k-server Problem
Algorithm to be designed Online Only knows the next request and has to serve it
immediately Cost measure
Total distance moved by all the servers to serve : total cost incurred by the optimal offline
algorithm
)(OPT
9
The k-server Problem
Let denote the cost of algorithm A on request sequence .
Definition: A randomized algorithm A is c-competitive (compared to the optimal offline algorithm), if for all starting configurations there is a real a, independent of , such that
)(A
.)()(E a, for allOPTcσA
10
Lower Bound of Performance
Theorem: For any metric space, the competitive ratio of the k-server problem is at least k (i.e. k-competitive).
Note: This lower bound holds for any randomized algorithm against an optimal online adversary
The proof is skipped
The Harmonic k-server Algorithm
12
The Harmonic Algorithm
Suppose node r makes a request The algorithm works as follows:
Let di be the distance from server i to the request node r
If any di = 0, do nothing (server i will serve the request; no server moves)
Else, use server i with probability inversely proportional to di......
13
The Harmonic Algorithm
i.e. let
and choose server i with probability . We denote the Harmonic k-server algorithm
by Harmonic or H in the following slides Eddie Grove proved that H is
-competitive for all .
kdddN
111
21
N
di/1
2k kk k 224/5
Eddie Grove’s Proof
Showing H is -competitive kk k 224/5
15
Process of Serving Requests
Let be a request sequence of length m Let be the ith request Think of the process of serving requests as fo
llows: For each request , first the adversary moves a s
erver, if necessary, to serve the request Then H “flips a coin” (takes a decision at random
according to the pdf mentioned) to choose a server to serve
i
i
i
16
Process of Serving Requests
In this way, we have 2m phases Odd phase (phase ): adversary serves Even phase (phase 2i): H serves
Let Dj be the distance moved by the server during phase j Odd j: Distance moved by adversary’s server Even j: Distance moved by H’s server
12 i ii
17
Introducing the Potential Function
To analyze, a function is used Define to be the value of at the end
of phase t. is chosen in such a fashion that the following three conditions hold:
1.
2. , where ck is the constant to be determined later
3. Referred as Condition (1), (2) and (3) in the
following slides
)(t
0(0) 0)( and for all tt12)22()12( ik Dcii
0122E 2 iiD i
18
Introducing the Potential Function
What means? From Vijay Gupta’s lecture:
represents the amount of work that H can be forced to do if the offline servers do not move
My intuition:“Potential energy”, reserved by adversary moves, consumed by H’s moves
Why introduce ? Lemma: If Condition (1), (2) and (3) hold, then H is
ck-competitive.
19
Lemma from 3 Conditions
Proof:
(3))2( 0
)22()12(E)12()2(EE
)22()12()12()2(
)22()2(
0
122
122
122
0
and tion from Condi
DciiiiDX
DciiiiD
DciiDX
, andLet X
ikii
iki
ikii
20
Lemma from 3 Conditions
Now,
)0()2() '() '(
)0()2(
)22()2(
1
1 1122
1122
1
mcostsadversaryccostsHX
mDcD
DciiDX
k
m
ii
m
i
m
iiki
m
iiki
m
ii
0EE ,0E 11
m
ii
m
iii XXXSince
(1)
(2)
21
Lemma from 3 Conditions
Using Equation (1) and (2), we have
PutAlso, by the linearity of expectation, we have
But, from Condition (1),
Hence,
)1( 0)0( Conditionfrom
0)0()2() () '(E mcostsadversary'ccostsH k
)2(E)( 'E mOPTcon σcostsH k
0)2(E0)2( mm
)( 'E OPTconcostsH k
22
More Notations
k offline and k online servers Lower-case letter: online server
Capital letter: offline server Perfect matchings M between online and offline serv
ers Denote by M(x) the mate of x
Initial condition: every online server coincides with one offline server i.e. In the 0th phase, d(x, M(x)) = 0 for each online server x
23
Matching M
Each time an online server moves, update matching M
Example Request placed at offline server A with M(a) = A Online server b, with M(b) = B, moves to the reque
st at A Change matching to: M(b) = A, M(a) = B Matching unchanged for all other servers
24
Active Set
Idea of active set is central to the proof Call OFF the set of all k offline servers For and any online server x, the radi
us of about x is
AS(x), the active set of x, is the with largest minimizing
OFF YYxdxR ),(max),(
)(x
OFFxM
xRkxLet k )(
2
),(min2)(
25
Active Set
Example k = 4 All offline servers shown; only on
line server a shown M(a) = A Let Two possible minimizing
AS(x) = {A,B,D}
5),( ,,, aRCBA
11
2
5
a
A
B C
D
)(a
162
224)(:,,
162
124)(:,
34
24
aDBA
aBA
26
Active Set
Any minimizing set must contain all offline servers within distance of x
Intuitively, the active set includes offline servers close to x in comparison to d(x,M(x))
For convenience: Definition: Definition:
),( xR
)()( xASxS ))(,()( xASxRxR
The Potential Function
All the 3 conditions satisfied?
28
The Potential Function
Definition: The potential function is computed as:
Condition (1) is satisfied: , hence , is always non-negative At t=0, every online server and its matched offline
server at identical point,
xserversonline
x
)(
0)0(
29
Notes before Analysis
Condition (2) corresponds to an adversary move
Condition (3) corresponds to a Harmonic move Analyzing an (generic) adversary move and a
(generic) Harmonic move completes the proof
30
Notes before Analysis
In the following analysis, a request is placed at some point Let A be the offline server moved in response to the reques
t, with M(a)=A Let b be the online server moved in response to the reques
t, with M(b)=B
Unless otherwise specified, all expressions describe configuration BEFORE the movement
Abuse notation: same variable for a server and the point it occupies
31
Analysis of Adversary Moves
Let Z be the place of request A moves a distance D2i+1 to Z in phase 2i+1 Consider the set of servers,
Physical meaning: online server with A inside its active set, and now A moves out of its active set boundary
For won’t increase
)(),( )( hhhh yRZydandyASAy
)( , xx
32
Analysis of Adversary Moves
Indexing all yh as follows: If a in , y0=a; else no y0
For h>0, index yh such that
When an offline server moves a distance D2i+1
increases by at most for all Other terms do not increase
),()(),()( 11 AydyRAydyR hhhh
)( hy)(
12
22
hySik D
k hy
33
Analysis of Adversary Moves
To estimate the increase in potential, we need to estimate S(yh)
Let Yh be the offline server matched to yh
Lemma: For h>1,
)( 1)( 00 yS A is in AsinceyS
)( 2)( 111 y are in AS A and YsinceyS
hyS h )(
34
Analysis of Adversary Moves
Proof:Let . Hence
Distance from yh to any Yj in Th is bounded by
Hence,
hjYAT jh 1 1hTh
),(),(),( jjjh YydyAdAyd
)(3
)(),(),(
)(),(max),(
),(),(),(max),(
1
1
h
hhh
jjhjh
jjjhhjhh
yR
yRAydAyd
yRAydAyd
YydyAdAydTyR
35
Analysis of Adversary Moves
By the minimality in the definition of , we have
Hence
)( hy
1)( 2
)(3
2
),(
2
)(
hh
Thh
ySh yRTyRyR
hh
hyS h )(
36
Analysis of Adversary Moves
The increase in potential due to a move by an offline server of distance D2i+1 is at most
Condition (2) is satisfied with competitive ratio
kk
ikh
hki kDkD 1
1212
12 24
522
4
1
2
12
2 ,224
5 kforkkc k
k
37
Analysis of Harmonic Moves
Three cases Case 1: a serves the request at A (i.e. b is identica
l to a) Case 2: B is close to a, Case 3: B is at distance greater than R(a) from a,
We will describe sets NS(x) for which AFTER update matching M
)(aASB
)(aASB
)()( xNSxM
)(2
))(,(2)(
xNS
k xNSxRkx
38
Harmonic Moves: Case 1
Case 1: a serves the request at A AFTER the move, goes to zero Nothing else is changed
Chance is
Expected change in potential
)(a
),(
1
AadN
)()( 2
2
2
)(2
),(
1aS
k
aS
k
N
kaRk
AadN
39
Harmonic Moves: Case 2
Case 2: B is close to a, For , let NS(x)=AS(x). NS(b)={A} Terms for unaffected Potential decreases by at least
This term is dropped in an inequality in later proof
bx )(aASB
bx )(b
40
Harmonic Moves: Case 3
Case 3: B is at distance greater than R(a) from a, Call Bi the offline server that is ith closest to a amo
ng offline servers at a distance more than R(a) from a Break any ties arbitrarily Let Bl = B
Call bi the online server matched to Bi
bl = b Let dl=d(A,bl)
)(aASB
41
Harmonic Moves: Case 3
For R(a,NS(a)) will be at most
Now Since , we have
)()( ,, xASxNSbax l AbNS l )(
)(1)()( li bASliBaASaNS
)()()(),(),( llll bRdaRbRbAdAad
laSaNS )()(
)()( aNSbAS l )(,)(max)( bSlaSaNS
42
Harmonic Moves: Case 3
Only and changes Expected increase in potential at most
The increase happens for each l between 1 andk-S(a)
)(a )( lb
laS
k
laSl
bSl
bSl
aSlaSl
k
bSl
aSbSlaSll
l
k
N
k
dbRbRaRaR
dN
k
bRaRbRdaR
dN
k
ll
ll
)(
)()()()()(
)()()(,)(max
2
2
22
)(
2
)(
2
)(
2
)(2
2
)(
2
)(
2
)()(2
43
Analysis of Harmonic Moves
It remains to show that satisfies Condition (3)
From previous results, we see that
0122E 2 iiD i
)(1)()(
)(1)()(
2
2
2
2
2
2
2
2
2
2
),(
),(
122
122E
aSkllaS
k
aS
k
aSkllaS
k
aS
k
xserversonline
i
i
N
k
N
k
N
k
N
k
N
k
xAdN
xAd
iiEDE
iiD
44
Analysis of Harmonic Moves
The identity,
proves that This completes the proof that the Harmonic
algorithm is -competitive for all
)(
)()(
)(1)(
2
2
212
22
2
2
aS
k
kaSaS
k
aSkl
laS
k
k
kk
kk
0122E 2 iiD i
2k kk k 224/5
45
Reference
V. Gupta, “CS497 SHT Spring 1999 Prof. Shang-Hua Teng Lecture 12: 2nd March, 1999,” Mar. 1999
E.F. Grove, “The Harmonic online k-server algorithm is competitive,” Proceedings of the 23rd Annual ACM Symposium on Theory of Computing, 1991