Docsity

K-server Problem and Online learning-Advanced Algorithms-Lecture 22 Notes-Computer Science, Study notes of Advanced Algorithms

Toggle sidebar
bg1
CS787: Advanced Algorithms
Scribe: Mayank Maheshwari and Priyananda Shenoy Lecturer: Shuchi Chawla
Topic: k-server Problem(continued); Online learning Date: 11/07/2007
22.1 Introduction and Recap
In the last lecture we were discussing the k-server problem, which is formulated as follows: Let M
be a metric space with npoints. There are kservers which can service requests. When a request
occurs from a particular location, a server must be placed at that location. The problem is to
minimize the total distance traveled by the servers. In this class we will see one algorithm for this
problem, the Work Function Algoritm.
22.2 Work Function Algorithm
Let Xbe a configuration of the servers; i.e. the set of locations the servers are located. Then
we define OP Ti(X) as the optimal cost of serving requests σ[1 : i] and ending at configuration X.
Then the Work Function algorithm, for servicing ith request, chooses the configuration Xiusing
the following rule:
Xi= arg min
X{OP Ti(X) + d(Xi−1, X )}
Theorem 22.2.1 WFA is (2k-1) competitive
Proof: We will be proving that for any sequence of requests σ
W F A(σ)6(2k−1)OP T (σ) + k2D
where Dis the diameter of the metric space.
Let X0, X1, ..., Xtbe the configurations chosen by the WF Algorithm for servicing requests r0, r1, ..., rt.
We are interested in seeing how OP Ti(Xi) evolves over time. So when the ith request ricomes,
we keep track of the difference in the optimal cost of servicing irequests and ending up at the
configuration Xichosen by our algorithm, and the optimal cost of servicing i−1 requests and
ending up at the previous configuration Xi−1. This difference is given by
OP Ti(Xi)−OP Ti−1(Xi−1)
Adding and subtracting OP Ti(Xi−1) we get,
1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download K-server Problem and Online learning-Advanced Algorithms-Lecture 22 Notes-Computer Science and more Study notes Advanced Algorithms in PDF only on Docsity!

CS787: Advanced Algorithms Scribe: Mayank Maheshwari and Priyananda Shenoy Lecturer: Shuchi Chawla Topic: k-server Problem(continued); Online learning Date: 11/07/

22.1 Introduction and Recap

In the last lecture we were discussing the k-server problem, which is formulated as follows: Let M be a metric space with n points. There are k servers which can service requests. When a request occurs from a particular location, a server must be placed at that location. The problem is to minimize the total distance traveled by the servers. In this class we will see one algorithm for this problem, the Work Function Algoritm.

22.2 Work Function Algorithm

Let X be a configuration of the servers; i.e. the set of locations the servers are located. Then we define OP Ti(X) as the optimal cost of serving requests σ[1 : i] and ending at configuration X. Then the Work Function algorithm, for servicing ith request, chooses the configuration Xi using the following rule:

Xi = arg min X {OP Ti(X) + d(Xi− 1 , X)}

Theorem 22.2.1 WFA is (2k-1) competitive

Proof: We will be proving that for any sequence of requests σ

W F A(σ) 6 (2k − 1)OP T (σ) + k^2 D

where D is the diameter of the metric space.

Let X 0 , X 1 , ..., Xt be the configurations chosen by the WF Algorithm for servicing requests r 0 , r 1 , ..., rt. We are interested in seeing how OP Ti(Xi) evolves over time. So when the ith request ri comes, we keep track of the difference in the optimal cost of servicing i requests and ending up at the configuration Xi chosen by our algorithm, and the optimal cost of servicing i − 1 requests and ending up at the previous configuration Xi− 1. This difference is given by

OP Ti(Xi) − OP Ti− 1 (Xi− 1 )

Adding and subtracting OP Ti(Xi− 1 ) we get,

(OP Ti(Xi) − OP Ti(Xi− 1 )) + (OP Ti(Xi− 1 ) − OP Ti− 1 (Xi− 1 )) (1)

The term (OP Ti(Xi− 1 ) − OP Ti− 1 (Xi− 1 )) keeps track of how the optimal cost of ending at Xi− 1 changes due to the ith request. The term (OP Ti(Xi) − OP Ti(Xi− 1 )) tells us how our movement from Xi− 1 to Xi changes the potential function.

In the offline case, we used a dynamic programming approach to arrive at an optimal solution. The recurrence used by the DP was

OP Ti(X) = min Y 3 ri

OP Ti− 1 (Y ) + d(X, Y )

Since Y 3 ri,we have OP Ti− 1 (Y ) = OP Ti(Y ). By taking X = Xi− 1 , we see that Y = Xi. This gives us

OP Ti(Xi− 1 ) = OP Ti(Xi) + d(Xi, Xi− 1 ) OP Ti(Xi) − OP Ti(Xi− 1 ) = −d(Xi, Xi− 1 )

Substituting this in (1) we get,

(OP Ti(Xi− 1 ) − OP Ti− 1 (Xi− 1 )) − d(Xi, Xi− 1 )

Summing over all the steps across the evolution,

i

{OP Ti(Xi− 1 ) − OP Ti− 1 (Xi− 1 )} −

i

d(Xi, Xi− 1 )

This sum is equal to the optimal cost of servicing all the requests and ending at the last configuration chosen by the WF Algorithm Xt. And

i d(Xi, Xi−^1 ) is nothing but the total cost incurred by our algorithm. Therefore we get

i

{OP Ti(Xi− 1 ) − OP Ti− 1 (Xi− 1 )} − W F A(σ) = OP Tt(Xt)

OP T (σ) OP T (σ) + W F A(σ) 6

i

{OP Ti(Xi− 1 ) − OP Ti− 1 (Xi− 1 )}

We know that OP T (σ) = minX OP Tt(X). We can get an upper bound on maxX OP Tt(X) using the fact

max X OP Tt(X) 6 OP T (σ) + max X, X´

d(X, X´)

We know that maxX, X´ d(X, X´) 6 kD where D is the diameter of the space. So we get

Φt 6 (k + 1)(OP T (σ) + kD)

Substituting this in (3)

i

EXTi 6 Φt

6 (k + 1)OP T (σ) + (k + 1)kD

Using this in (2), we get

W F A(σ) 6 kOP T (σ) + (k + 1)kD

Hence our algorithm is k-competitive for the case where n = k + 1. We will now try to get a bound for the general case.

Claim 22.2.3 For any values of k and n, WFA is (2k-1) competitive

To show this, we will do the following construction. Let M be our metric space. Then we will construct a metric space M in the following manner. For every point a in M , we create a point a, called the antipode of a , such that d(a, a) = D. The distance between antipodes is equal to the distance between their corresponding original points; i.e. d(a, b) = d(a, b). The distance between a point and an antipode of another point is given by d(a, b) = D − d(a, b). It is easy to see that this construction yields a valid metric space.

M (^) M

a a

b

b

D d(a,b)

d(a,b)

D

d(a,b) = D - d(a,b)

Fig 1: The metric spaces M and M

a b^ c^ d

a b^ c^ d

d c b^ a

M

M U M Fig 2: An example where all points lie on a line.

We transform the space M to M ∪ M. The problem doesn’t change, since none of the newly added points issue requests.

We will consider the “worst case scenario” which maximizes the distance covered at step i. We will claim, and later give a proof sketch that this happens when a request comes from location ri and all servers are at its antipode ri.

Claim 22.2.4 arg maxX {OP Ti(X) − OP Ti− 1 (X)} = (ri, ri, ..., ri)

Assuming that this claim holds good, we will proceed with obtaining an upper bound for

i EXTi. Let Yi = (ri, ri, ..., ri) be the “worst case” configuration. Then we have

EXTi = OP Ti(Yi) − OP Ti− 1 (Yi) ∑

i

EXTi =

i

OP Ti(Yi) −

i

OP Ti− 1 (Yi) (4)

Let us examine the sequence in which the optimal algorithm OPT services the requests.

r r r r r^ r^ r

server 1

server 2

... ... .......^.^. 1 2 3 4 i^ j

some server

t

Fig 3: The sequence of how OPT services the requests

If OPT moves a server from ri to rj , we will match i with j. Then the following holds true

OP Ti(x) − OP Ti− 1 (x) = (OP Ti− 1 (b) + d(a, b) + d(a, x)) − (OP Ti− 1 (b) + d(b, x)) = d(a, x) − d(b, x) + d(a, b)

if x = a then,

d(a, a) − d(b, a) = D − (D − d(a, b)) = d(a, b)

So we see that the distance is maximized when the server was located at position a.

22.3 Metric Task System Problem

The Metric Task system problem is a generalization of the k-server problem. The Work Function Algorithm is used to solve this problem and it gives a competitive ratio of 2N − 1 where N is the number of points in the metric space.

Given: A Metric space M where |M | = N and one server. M has a distance function d which satisfies the following properties:

∀x, y, z ∈ M

  • d(x, y) ≥ 0
  • d(x, y) = d(y, x)
  • d(x, y) ≤ d(x, z) + d(z, y)

The setting can be viewed as the server needs to execute tasks coming in a stream on machines located at points in the metric space M. A task can be well suited to a machine and so the cost of executing it at that point is low. We can also move the server to machine at another point in M which is suited to the task but we incur a cost in moving the task from one point to another. So we get a task and the server should execute it on best machine possible without incurring too much cost in moving from one machine to another.

Goal: The server needs to execute the incoming tasks on the machines located at the |M | points such that the cost of executing those tasks is minimized.

To solve the k-server problem using metrical task system, we let each state of the system correspond to one possible configuration of the k-server problem. Therefore, the number of states is

(N

k

. This is a more general problem and we will not delve into the intricacies of it. But the Work-Function Algorithm covered in the previous section can be used to solve the Metrical Task System problem and it gives a competitive ratio of 2N − 1.

22.4 Online Learning

The online learning algorithms are a method to solve class of prediction problems. The problem is generally characterized by number of experts (say) n and every expert has a cost vector corre- sponding to the prediction associated with it. The objective is to maximize the cost associated with the cost vectors of an expert and do as well as the expert. The algorithm at every step needs to pick an expert and then the cost vector (consisting of 0’s and 1’s is revealed). This is similar to the Metrical Task System problem with a few differences,namely, there are two underlying assumptions for this class of problems:

  1. It is free to move from one point (expert) to another i.e. the algorithm doesn’t incur any cost.
  2. The algorithm ALG is not compared with the optimal OPT in hindsight.

Goal: The algorithm should do nearly as well as the expert.

We will consider a few specific problems in this case. The first one is the Pick-a-Winner problem.

22.4.1 Pick-a-Winner Problem

In this problem, we get profits instead of costs and we need to maximize it.

Problem Statement: There are n different buckets and an adversary throws coins in the bucket. In this game, we need to pick a bucket and if the adversary oblivious of our choice throws the coin in that bucket, we get the coin. The game gets over when there are maximum d coins thrown in a bucket.

This is a case of oblivious adversary in which we take the help of randomization to work to our advantage. If we pick the buckets deterministically, the adversary would know our choice and would always throw the coins in the other buckets.

So if we pick the bucket uniformly at random, the expected number of coins that we get

E[number of coins won]= d · Pr[picking a bucket u.a.r.] = (^) nd.

With this approach, we get a competitive ratio of (^1) n.

22.4.1.1 Multiplicative Updates Method(Exponential weights)

In this method of solving the Pick-a-Winner problem, we increase the probability of picking a bucket by a factor of 2 each time the adversary throws a coin in that bucket. So the algorithm can be seen as

Algorithm

  • Start with, for all buckets i, wi = 1 where wi is the weight of bucket i.
  • Whenever a coin falls into a bucket, double its weight.
  • At every step, pick an i with probability proportional to wi.

The additive factor which we lose here is known as the regret bound or the regret of algorithm which is the factor the algorithm looses in order to converge to the profit of the expert. We will see more on the regret bounds in the next lecture.

References

[1] Yair Bartal Lecture Notes on Online computation and network Algorithms. http://www.cs.huji.ac.il/ algo2/on-line/on-line-course.html.