Advanced Algorithms 1.4

Advanced Algorithms 1.4 - Claim 18 For any stream of...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Claim 18 For any stream of requests, on-line or o -line, only one server needs to be moved at each request. To show a contradiction, assume otherwise. In response to some request, i; in your stream, you move server j to point i and, in order to minimize the overall cost, you also move server k to some other location, perhaps to cover ground" because of j 's move. If server k is never again used, then the extra move is a waste, so assume server k is used for some subsequent request m. However, by the triangle inequality see the de nition of a metric space, server k could have gone directly from its original location to the point m at no more cost than stopping at the intermediate position after request i. We might, in general, consider algorithms which move more than one server at a time. While we will sometimes do this for purposes of analysis, we can in general ignore such algorithms thanks to the triangle inequality. 11.1 Special Cases of the k Server Problem 1. Paging. The paging problem is a special case of the k-server problem, in which the k servers are the k slots of fast memory, V is the set of pages and du; v = 1 for u 6= v. In other words, paging is just the k server problem but with a uniform distance metric. 2. Two-headed Disk. You have a disk with concentric tracks. Two disk-heads can be moved linearly from track to track. The two heads are never moved to the same location and Figure 2: Two-headed disk. need never cross. The metric is the sum of the linear distances the two heads have to move to service all the disk's I O requests. Note that the two heads move exclusively on the line that is half the circumference and the disk spins to give access to the full area. Online-23 11.2 Summary of known results We already have results about paging that can be used for the k server problem. Positive results about paging can't be generalized, but since paging is a case of the k server problem, the lower bound for paging also applies in general. Theorem 19 Manasse-McGeoch-Sleator 16 For no metric spaces is there a deterministic -competitive algorithm for the k -server problem such that k. The general proof is similar to the previous proof with a uniform distance metric. However, in the case of paging we actually have a k-competitive deterministic on-line algorithm. Open Problem: Whether or not there exists a k competitive deterministic algorithm for the general k server problem. In fact, for some time it was unknown whether there exists a f k-competitive algorithm, where f k is a function of k. Theorem 20 Fiat, Rabani and Ravid 10 proved by induction on k that there is an f k-competitive algorithm for the general k server problem, where f k = eO k k . Very recently, it was shown by Koutsoupias and Papadimitriou 15 that the socalled work-function algorithm of Chrobak and Larmore 7 is 2k , 1-competitive. It is an open problem whether the same algorithm is in fact k-competitive. log 11.2.1 Results for speci c k k = 1 This case is trivial, since there is never any choice about which server to send. Thus any reasonable algorithm is 1-competitive. k = 2 There is a 2-competitive deterministic algorithm for this case, due to Manasse, McGeoch and Sleator 16 . Even with this small k, the algorithm is nontrivial and would make a challenging exercise. The work function algorithm is also known to be 2-competitive 7 . There has also been work on developing competitive algorithms for 2 servers which are fast" in the sense that they perform only a constant amount of work per request 12, 4, 14 . k = jV j , 1 . Then the algorithm Balance, described later, is k-competitive 16 . A variation of Balance is also known to be 10-competitive for the case k = 2 Irani and Rubinfeld 12 . 11.2.2 Results for speci c metric spaces paging For paging, we've already seen a k-competitive algorithm. line, tree For these con gurations, there is a k-competitive deterministic algorithm 5. circle For points on the circle, there is a deterministic k -competitive algorithm. 3 Online-24 11.2.3 Greedy The most obvious on-line algorithm for the k-server problem is Greedy, in which a given request is serviced by whichever server is closest at the time. The following example, however, shows the major aw in this algorithm: Consider two servers 1 and 2 and two additional points A and b, positioned as follows assume something like a Euclidean metric: 1 2 a b Now take a sequence of requests ababab : : : . Greedy will attempt to service all requests with server 2, since 2 will always be closest to both A and b, whereas an algorithm which moves 1 to A and 2 to b, or vice versa, will su er no cost beyond that initial movement. Thus Greedy can't be -competitive for any . 11.2.4 The Balance Algorithm We now describe the Balance algorithm mentioned above. At all times, we keep track of the total distance travelled so far by each server, Dserver , and try to even out" the workload among the servers. When request i arrives, it is serviced by whichever server, x; minimizes the quantity Dx + dx; i, where Dx is the distance travelled so far by server x, and dx; i is the distance x would have to travel to service request i. Balance is k-competitive when jV j = k + 1. However, it is not even competitive for k = 2. Consider indeed the following instance suggested by Jon Kleinberg. The metric space corresponds to a rectangle abcd where da; b = dc; d = is much smaller than db; c = da; d = . If the sequence of requests is abcdabcd : : : , the cost of Balance is per request, while the cost of MIN is per request. A slight variation of Balance in which one minimizes Dx +2dx; i can be shown to be 10-competitive for k = 2 12 . 12 The Randomized Algorithm, Harmonic While Greedy doesn't work very well on its own, the intuition of sending the closest server can be useful if we randomize it slightly. Instead of sending the closest server every time, we can send a given server with probability inversely proportional to its distance from the request. Thus for a request A we can try sending a server at x with probability 1=Ndx; a for some N . Since, if On is the set of on-line servers we want X 1 1= x2On Ndx; a we set X 1 N= x2On dx; a Online-25 This algorithm is known as the Harmonic algorithm H . Note, once again, that in the special case of paging this is identical to Random. Harmonic is competitive as stated below. tive on-line adversary. Theorem 21 Grove 11 5 Harmonic is 4 k 2k , 2k -competitive against an adap- Before this fairly recent result, Harmonic was only known to be 317000-competitive for k = 3 3 and 3-competitive for 2 servers 6 . There is a known lower bound for this algorithm. Speci cally, for some adaptive k on-line adversary Q, we know that CH Q = +1 CQH, where H denotes Har2 k+1 -competitiveness. It is open whether monic so we can't hope to do better than 2 the competitive factor for Harmonic is indeed equal to this lower bound. Finally, recall that we can get an 2-competitive deterministic on-line algorithm from an -competitive randomized algorithm. So this theorem will also give us a 5 k2k , 2k2-competitive deterministic algorithm, although the algorithm that we get 4 this way is far from e cient. 12.1 Analysis of Harmonic Theorem 22 sary. We prove here a slightly weaker result than Grove's result. Harmonic is k 2 2k,1 -competitive against an adaptive online adver- Proof: In the following, let OFF denote both the servers of the online adaptive adversary which Harmonic plays against, as well as their locations in the metric space. Phase 1 Adversary Q Phase 3 Phase 2i 1 2 i Harmonic a1 Phase 2 a2 Phase 4 ai-1 Phase 2i-1 ai Phase 2i+1 Figure 3: Odd and even phases of OFF vs. ON. We de ne phases Figure 3 by: Online-26 In the odd phase 2i , 1, the online adversary moves a server to vertex A at cost di. The adversary then makes a request i at vertex A. Note that OFF can move its server before making the request because it is an online adversary, so the order makes no di erence. In the even phase 2i, the player moves an online server ai 2 ON to A and incurs a cost of li. li is in fact a random variable since Harmonic chooses the server to move probabilistically. The actions of ON and OFF taken during one pair of odd even phases are illustrated in Figure 4. Position of A before the request di Position of request, and position of OFFline server A after the request li Figure 4: The movement of servers. X's denote the servers of ON while O's denote the servers of OFF. 12.1.1 Analysis by Means of a Potential Function To aid in the analysis of Harmonic, we introduce a potential function . Let j denote the value of at the end of phase j . The potential function will be required to satisfy the following properties. 1. 0 = 0, j 0: 2. 2i , 1 , 2i , 2 k22k,1 di: 3. E li + 2i , 2i , 1 0: Online-27 These properties allow us to prove the competitive ratio of k22k,1 since, by summing 2. and 3., we obtain: j Pj l = X E l E i=1 i i i=1 j j X X = E li + E 2i , 2i , 1 g + E 2i , 1 , 2i , 2 i=1 i=1 ,E 2j + E 0 j 2 2k,1 X E d k i i=1 j X = k22k,1 E di : i=1 12.1.2 Derivation of the Potential Function We now obtain a potential function satisfying the above constraints. will depend on three factors: 1. The vertices in ON. 2. The vertices in OFF. 3. The past history of moves by ON and OFF. is obtained by means of a matching M mapping the vertices in ON bijectively to the vertices in OFF. If x 2 ON then we denote by M x 2 OFF the server in OFF matched to x. Initially we impose that x = M x for all servers x in ON since ON and OFF start with the same initial con guration of servers. This implies that 0 = 0. In an odd phase i.e. when a server from OFF is moved, the matching is kept unchanged. When during an even phase a server in ON is moved from vertex b to the position of the OFFline server A where a request occurs and with M a = A, the matching is updated by the following rule: If ON moves the server b which was originally matched to server B from OFF, then M is updated according to M a = B and M b = A. We can now de ne by: X = x x2ON where for , OFF we de ne the radius by: Rx; , = max dx; Y Y 2, Online-28 Rx; , : M x 2 , : min 2j,j , OFF Also de ne , to be the argmin of the term in the de nition of x. x Note that x kdx; M x for all x since 2j,j 2k and Rx; , dx; M x for any , 3 M x. Two nal de nitions are: x = Rx; , and nx = j,j: x So x = k2k 2nxx . x = k2k and 12.1.3 Why we Argue on Matchings A small example now su ces to provide an intuitive feeling for why matchings provide a tool for measuring the potential di erence between ON and OFF. Suppose that there are seven servers positioned as shown in Figure 5. If the adversary consistently makes requests to the poorly matched server on the right, then the adversary will pay 0 cost, while Harmonic will keep paying until it moves a server from the left side of the network. In the matching, one edge will be large, and so both Rx; , and x will x be large until such a move is made. Figure 5: An example of a con guration of OFF's servers O's and ON's servers X's. If the adversary requests at the unmatched OFFline server on the right, then Harmonic eventually pays a high cost while the adversary pays 0. 12.1.4 Proof of Properties about Property 1 Initially , = fxg so x = 0 which means x = 0 and 0 = 0: It is clear x that j 0. Property 2 In an odd phase, the adversary moves a server in OFF by a distance di. Let 0x be the value of after the move. Then 0 x; 0x k2k R 2,,x x Online-29 where , is the value from before the move and: x R0x; , = Y 2, d0x; Y max x x Y 2, fdx; Y g + di max x = Rx; , + di: x Note that the distance function is primed to indicate that Y may have moved during the phase. However, the matching is not altered during an odd phase, so we were able to use the same , since M x still belongs to , . x x Since j, j is at least one, we now can calculate that: x 0 0x k2k R x;,x 2j,xj d x + k2k 2j,i j x x + k2k,1 di : Therefore, 2i , 1 , 2i , 2 = Px2ON0x , x kk2k,1di k22k,1 di : Property 3 We now need to show that E li + 2i , 2i , 1 0: In the rest of this proof, we shall be conditioning on P , the current position of the servers in ON and OFF. Clearly, if the inequality is true while conditioning on P, then it will remain true when we take the expectation over P. First consider what E lijP represents. It is the expected distance that the server moved by Harmonic will have to travel. By the de nition of Harmonic, we know that, given P , x 2 ON is moved with probability 1 Ndx;A . Therefore, E lijP = Px2ON Nd1x;A dx; A k = N since ON contains k servers. So for to satisfy property 3, we must show that k E 2i , 2i , 1jP ,E lijP = , N : Because we are in an even phase, OFF already has a server at A. We will examine the changes in the matching depending on which server ON moves in order to approach this problem. Each of the cases has a probability attached, and so the results of each case can be used to determine an expected value for 2i , 2i , 1: Note that in Online-30 the following analysis the servers of OFF are xed, since the adversary has already moved its server during the odd phase. Case 1 occuring with probability Nd1a;A : ON moves server a to the request at A where M a = A before the phase. Then after the move, 0a = 0 and 0c = c for all c 6= a. Therefore, 2i , 2i , 1 = ,a = ,k2k 2na : a Case 2: ON moves a server b 6= a where M b = B before the move. Then 0 c = c for c 6= a; c 6= b. Moreover, 0b = 0: And lastly, 0a a since the fact that da; B a implies that B the new OFFline server matched to a, belongs to , see Figure 6. Therefore, 2i , 2i , 1 0. a Original Matching Updated Matching After b is Moved to A Case i: da; B a: (a) A a B b d C c D C d c a (a) bA B D Figure 6: The con guration of the matching when da; B a, and when the matching is updated. a: Now de ne l so that B is the lth closest OFF server to a from outside of the disk of radius a centered at a. Consider a disk centered at a of radius a+ dA; b+ b. See Figure 7. Clearly B is in that disk, since Case ii: da; B da; B da; A + dA; b + db; B a + dA; b + b: Online-31 In fact, this big disk contains at least maxna + l; nb servers from OFF. i.e. na + l is all OFF servers in the disk centered at a with radius da; B and nb is all servers in the disk of radius b centered at b. Therefore, 0a k2k R2a;, j,j a + dA; b + b k2k 2maxna+l;nb b k2k 2naa + dnA;+l + 2nbb a 2 k dA; b + b: = a + k2 2na+l Furthermore, 0 b = 0 since b is moved to the position A of the request and M 0b = A. Lastly, 0c = c for c 6= a; c 6= b: This means that in this case when b is the server moved to A: k 2i , 2i , 1 k22ndA;l b : a+ (a) A a d(A,b) (b) b C c B Figure 7: The con guration of the matching when da; B Online-32 a: ...
View Full Document

Ask a homework question - tutors are online