the k-resource problem on uniform and on uniformly decomposable

21
The k-Resource Problem on Uniform and on Uniformly Decomposable Metric Spaces ? Marcin Bienkowski 1 and Jaros law Kuty lowski 2 1 Institute of Computer Science, University of Wroclaw, Poland 2 International Graduate School of Dynamic Intelligent Systems, and Heinz Nixdorf Institute, University of Paderborn, Germany Abstract. We define a natural generalization of the prominent k-server problem, the k-resource problem. It occurs in metric spaces with some demands and resources given at its points. The demands may vary with time, but the total demand may never exceed k. The goal of an online algorithm is to satisfy demands by moving resources, while minimizing the cost for transporting resources. We give an asymptotically optimal O(log(min{n, k}))-competitive ran- domized algorithm and an O(min{k, n})-competitive deterministic one for the k-resource problem on uniform metric spaces consisting of n points. This extends known results for paging to the more general setting of k-resource. Basing on the results for uniform metric spaces, we develop a randomized algorithm solving the k-resource and the k-server prob- lem on metric spaces which can be decomposed into components far away from each other. The algorithm achieves a competitive ratio of O(log(min{n, k})), provided that it has some extra resources more than the optimal algorithm. 1 Introduction In our work we define an extension of k-server, the k-resource problem. We introduce the definition of both problems for general metric spaces, whereas later we are addressing specific finite metric spaces, like the uniform or decomposable metric. The k-server problem [8] is defined on a metric space (X ), where ξ (·, ·) is a function measuring the distance between two points of space X . An input consists of sequence of requests to points from X . Upon seeing a request to point x ∈X , an algorithm has to move its servers, so that at least one server is placed at x. The costs of transports are defined by the distance function ξ . The goal 1 Supported by MNiSW grant number N206 001 31/0436, 2006-2008. 2 Partially supported by the EU within the 6th Framework Programme under contract 001907 (DELIS) and by the DFG-Schwerpunktprogramm 1183: Organic Computing, project “Smart Teams: Local, Distributed Strategies for Self-Organizing Robotic Exploration Teams”. ? Full version. Extended abstract appeared in the proceedings of WADS 2007.

Upload: others

Post on 03-Feb-2022

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The k-Resource Problem on Uniform and on Uniformly Decomposable

The k-Resource Problem on Uniform and onUniformly Decomposable Metric Spaces?

Marcin Bienkowski1 and Jaros law Kuty lowski2

1 Institute of Computer Science, University of Wroclaw, Poland2 International Graduate School of Dynamic Intelligent Systems, and

Heinz Nixdorf Institute, University of Paderborn, Germany

Abstract. We define a natural generalization of the prominent k-serverproblem, the k-resource problem. It occurs in metric spaces with somedemands and resources given at its points. The demands may vary withtime, but the total demand may never exceed k. The goal of an onlinealgorithm is to satisfy demands by moving resources, while minimizingthe cost for transporting resources.

We give an asymptotically optimal O(log(minn, k))-competitive ran-domized algorithm and an O(mink, n)-competitive deterministic onefor the k-resource problem on uniform metric spaces consisting of n points.This extends known results for paging to the more general setting ofk-resource. Basing on the results for uniform metric spaces, we developa randomized algorithm solving the k-resource and the k-server prob-lem on metric spaces which can be decomposed into components faraway from each other. The algorithm achieves a competitive ratio ofO(log(minn, k)), provided that it has some extra resources more thanthe optimal algorithm.

1 Introduction

In our work we define an extension of k-server, the k-resource problem. Weintroduce the definition of both problems for general metric spaces, whereas laterwe are addressing specific finite metric spaces, like the uniform or decomposablemetric.

The k-server problem [8] is defined on a metric space (X , ξ), where ξ(·, ·)is a function measuring the distance between two points of space X . An inputconsists of sequence of requests to points from X . Upon seeing a request to pointx ∈ X , an algorithm has to move its servers, so that at least one server is placedat x. The costs of transports are defined by the distance function ξ. The goal

1 Supported by MNiSW grant number N206 001 31/0436, 2006-2008.2 Partially supported by the EU within the 6th Framework Programme under contract

001907 (DELIS) and by the DFG-Schwerpunktprogramm 1183: Organic Computing,project “Smart Teams: Local, Distributed Strategies for Self-Organizing RoboticExploration Teams”.

? Full version. Extended abstract appeared in the proceedings of WADS 2007.

Page 2: The k-Resource Problem on Uniform and on Uniformly Decomposable

of an algorithm solving the k-server problem is to minimize the total distancetravelled by its servers in the runtime.

The setting of the k-server problem is powerful enough to model many ap-plications in computer science, as well as in many other aspects of everyday life.On the other hand, the model has also some deficiencies. The k-resource prob-lem, a very natural extension defined in this paper, has the advantage of dealingadditionally with two of those: we allow requests to have different durations(whereas in k-server a request is regarded as processed after one unit time step)and we allow to request more than one server to a point of the metric. An ap-plication example for the k-resource could be a robotic scenario, where tasksappearing dynamically in a terrain impose certain demands (for some periods)on the number of robots that have to be sent to handle them.

We define the k-resource problem to be, similarly to k-server, based on a finitemetric space (X , ξ). In each point of X , we have some demand for resourceunits. The resources can be thought of as workers or computational resources.The demands are arbitrary integers, but their sum is guaranteed to be at mostsome fixed integer k. Time is slotted and divided into time steps. The inputsequence contains changes of demand: in every time step, at exactly one placethe demand decreases or increases by 1. Such assumption is typical also for otherproblems and models the scenarios in which demands may vary, but the pace ofchanges is restricted. At the end of any time step, the algorithm has to cover allthe demands by its resource units, which means that the number of resourcesavailable at any node has to be at least the demand at this node. In order todo that, the algorithm may move the units between the points of X , paying thesum of distances travelled by the units.

More formally, let the resource vector Xt−1 denote the algorithm’s distribu-tion of resources to points in the metric space at the beginning of step t. Instep t, the algorithm is given a demand vector dt, which describes the demandfor resources in all points of the metric. We allow only input sequences, for which∑ni=1 |dt−1[i] − dt[i]| = 1 and |dt| ≤ k for all time steps t. Additionally, we as-

sume that at the very beginning of the input sequence, X0 is any but fixed and|d0| = 0. At the end of a time step, an algorithm has to move resources betweenmetric points, so that Xt ≥ dt, where Xt is the new resource vector. The al-gorithm pays ξ(i, j) for moving a resource unit from i to j; its cost in step t issummed over all movements performed.

We consider the k-resource problem for two types of finite metrics. In theuniform metric space, the distances between two different points of the spaceare equal to 1. A metric space (X , ξ) is uniformly decomposable if it can bepartitioned into a set Λ of disjoint components, each being a uniform metricspace. We require that for any two distinct points x and y, ξ(x, y) = 1 if theybelong to the same component, and ξ(x, y) = Θ(Γ ) if they belong to differentcomponents. We will later impose some restrictions on the separation betweencomponents given by Γ . Uniformly decomposable metrics are a natural extensionof the uniform metric, capable of capturing some aspects of locality. Intuitively,the requirement for all intra-component distances to be nearly equal to Γ is that

2

Page 3: The k-Resource Problem on Uniform and on Uniformly Decomposable

we are going to treat these connections as a uniform metric with some specialbehavior in each node (which consists of a component). In the following, we willuse the notions metric space and graph interchangeably. Whenever we speak ofa graph, we mean a complete graph with nodes corresponding to points of X ,and with edge weights given by function ξ.

In this paper, we are interested in online algorithms, i.e., the ones that haveto make decisions in time step t solely on the basis of the input sequence up totime step t, and without any information about future requests. To analyze theefficiency of our algorithms we use competitive analysis [10], and — on any inputsequence — compare the cost of our algorithm and the optimal offline schedule.For any algorithm A and any input sequence σ, we denote the cost of A by CA(σ).We say that a deterministic algorithm A is α-competitive if there exists a con-stant β, such that for all sequences σ, it holds that CA(σ) ≤ α · COPT(σ) + β,where Opt denotes the optimal offline algorithm. If A is a randomized algo-rithm, then in the definition above we replace CA(σ) by its expected value. Forrandomized algorithms, we consider only oblivious adversaries [4], the ones thatare not able to see the random choices made by the algorithm. The c-resourceaugmented version of the k-resource problem allows an online algorithm to use(1+c) ·k resources, whereas the offline schedule has to fulfill the same task usingonly k resource items.

Our contribution. We start our investigation of the k-resource problem bypresenting its relation to the k-server problem. This yields lower bounds on thecompetitiveness of any algorithm solving k-resource, as shown in Section 2. Themain results of the paper are divided into two parts. In Section 3, we consider thek-resource problem on uniform metric spaces consisting of n points. We presenta deterministic and a randomized algorithm, both achieving asymptotically op-timal competitive ratios: O(minn, k) and O(log(minn, k)), respectively. Infact, our algorithms are able to solve some instances of a more general problem,the so-called dynamic-resource problem, where the number of available resourcescan change in each step.

The results above allow us to solve the k-resource problem on uniformlydecomposable metric spaces with Γ ≥ k. The key issue for this kind of metricsis to use resources available locally in the component and transport new onesfrom other components only rarely. In Section 4 we give a randomized algorithmwith a competitive ratio (1 + 1/c) · O(log(minn′, k)), where n′ ≤ n is thesize of the largest component of the metric space and c denotes the resourceaugmentation factor (see Theorem 3). By the relations between the k-resourceand k-server problems, the same result holds for k-server. The competitivenessdoes not depend on the number of components in the decomposition.

Related work. The k-server problem, introduced by Manasse et al in [8], hasbeen prominent in the research on online problems from the advent of com-petitive analysis. Currently the best algorithm for general metrics, WFA [7], is

3

Page 4: The k-Resource Problem on Uniform and on Uniformly Decomposable

(2k − 1)-competitive, which nearly matches the lower bound of k by [8]. Al-though this result gives a very important insight into this and related problems,the achieved competitiveness is hardly acceptable for most applications.

Thus, much effort was put into the search for randomized algorithms whichcould perform better. The results for general metric spaces are unsatisfactory:whereas there exists a lower bound on the competitive ratio of Ω(log k/ log log k)[1,2], currently there is no randomized algorithm better than k-competitive.There are, however, several results for specific metric spaces that break the o(k)barrier. A classical result [6] shows a randomized O(log k)-competitive algorithmfor the uniform metric space. Recently, results on other metric spaces were ob-tained: the work by Csaba and Lodha [5] provides an O(n2/3 log n)-competitivealgorithm for n equally spaced points placed on a line; Bartal and Mendel [3]generalized this work for growth-rate bounded graphs. Seiden [9] has related thek-server problem on decomposable metric spaces to unfair metrical task systems.

Our uniformly decomposable metric is a specific case of the metrics consid-ered by Seiden [9]. The difference is that Seiden is dealing with non-uniformlyrecursively decomposable metrics with a restriction ξ(x, y) ≥ Γ for points x, yfrom distinct components. Additionally, his results do not require resource aug-mentation. On the other hand, his general result applied to our uniformly de-composable metric is roughly O(z log2(k + z))-competitive, where z = |Λ|.

Our result for k-server on uniformly decomposable metric spaces is one of thefew, which relies on resource augmentation. Another successful applications aredue to Young [11] for the weighted caching problem and Sleator and Tarjan [10]for paging.

2 Lower bounds

It is quite straightforward that the k-resource problem is capable of modellingk-server instances. Moreover, the ability to solve the k-resource problem impliesthe ability to solve the k′-server problem, for k′ ≤ k, as stated in the lemmabelow.

Lemma 1. Fix any metric space (X , ξ) and integers k′ ≤ k. If there exists anα-competitive (randomized) algorithm A for k-resource problem on (X , ξ), thenthere exists an α-competitive (randomized) algorithm A′ for k′-server problemon (X , ξ).Proof. Consider any input σserv for k′-server problem; we show how to constructan input σres for k-resource problem. We choose any node v ∈ X , and at thebeginning of σres we increase the demand at v to k − k′. Then every round ofthe original instance is translated into two rounds for the k-resource problem:a request at x is converted to an increase of resource demand at x by 1 in thefirst round and decrease back by 1 in the second round. The algorithm A′ runsalgorithm A on σres and returns A’s movements of units as its own solution.

Note that A has only k′ free units; the other ones are bound to v for thewhole runtime. Thus, the movements of these units correspond to a feasible so-lution for k′-server problem. Moreover, the costs of these two solutions coincide:

4

Page 5: The k-Resource Problem on Uniform and on Uniformly Decomposable

CA′(σserv) = CA(σres) − β′, where β′ is the cost of initial movement of k − k′units to v.

Let β be the maximum possible cost of sending k− k′ units from any pointsof X to v. Note that β depends only on the structure of the metric space and noton the input sequence. Therefore, any optimal solution for σserv yields a solutionS for σres with the cost at most β greater. Thus, COPT(σres) ≤ CS(σres) ≤COPT(σserv) + β.

Summing up, since A is α-competitive, there exists a constant ρ, such thatCA(σres) ≤ α · COPT(σres) + ρ. Therefore,

CA′(σserv) ≤ CA(σres) ≤ α · COPT(σres) + ρ ≤ α · COPT(σserv) + (α · β + ρ) ,

which proves the α-competitiveness of A′.The result for the randomized case follows when we replace CA and CA′ with

their expected values. ut

By means of Lemma 1, we may apply known lower bounds for k-server (whichare: k for a deterministic scenario [8], Ω(log k/ log log k) for a randomized one[1,2], and Hk = Θ(log k) for a randomized one in uniform spaces [6]) to achievethe bounds on k-resource problem. Since the bounds on k-server hold if k issmaller than the number of points of the metric space, we relate the k-resourceproblem to a (mink, n − 1)-server problem, where n is the number of pointsin X . If X is an infinite space, then mink, n− 1 = k.

Corollary 1. Fix any space (X , ξ) consisting of n points, any integer k, and anyα-competitive algorithm A for the k-resource problem. Let f = mink, n− 1. IfA is deterministic, then α ≥ f ; if A is randomized, then α = Ω(log f/ log log f).Moreover, if (X , ξ) is a uniform metric, then for a randomized A, α ≥ Hf , where

Hi =∑ij=1 1/j = Θ(log i), the i-th harmonic number.

3 Uniform metric spaces

In this section, we investigate the k-resource problem on a uniform graph of n ≥ 2nodes. First, we present some definitions and notations. Then, we specify a verygeneral class of phase-based algorithms and prove crucial properties about them.It appears that any (deterministic) algorithm from this class is O(minn, k)-competitive. Finally, we show that by carefully using randomness, we are able tosubstantially reduce this factor to O(log(minn, k)). By Corollary 1, our resultsare asymptotically optimal.

Preliminaries. Formally, by a vector we understand a vector of n integers. Forany vector A, let |A| =

∑ni=1A[i]. We say that a vector A covers B (we write

A ≥ B) if A[i] ≥ B[i] for all 1 ≤ i ≤ n. For any two vectors A and B, we definethe distance between them as δ(A,B) := 1

2 ·∑ni=1 |A[i]−B[i]|.

Recall that at the beginning of each step t, the resource vector Xt−1 definesthe assignment of resources to graph nodes. The demand vector dt must be

5

Page 6: The k-Resource Problem on Uniform and on Uniformly Decomposable

satisfied by the algorithm at the end of time step t, i.e., the algorithm has tomove resources so that Xt ≥ dt. It is straightforward to see that for uniformmetrics the algorithm has to pay at least δ(Xt−1, Xt) for changing the resourcesfrom Xt−1 to Xt, and it is possible to schedule the movements in such a waythat the cost is equal to δ(Xt−1, Xt). In the following we omit subscript t if itcan be deduced from the context.

Dynamic-resource (DR) problem. Since we want to use our algorithms forthe uniform spaces as building blocks in the construction for more complicatedspaces, we have to slightly generalize the model. Precisely, at the beginningof each step t, the number of available resources may change. If it increases,the algorithm may choose freely where to place the additional resources; if itdecreases, the algorithm may choose which units are removed. We also generalizethe competitive analysis for this problem: the number of units available to theonline algorithm in step t (denoted by kt) is not necessarily equal to the numberof units at optimal offline algorithm’s disposal (kOPT

t ). Naturally, in each step|dt| ≤ kt and |dt| ≤ kOPT

t .We call such extended problem the dynamic-resource problem (DR). In gen-

eral, it seems to be much harder than k-resource, and we do not aim at con-structing competitive algorithms for it. Instead, we construct algorithms whichperform well on some instances of DR, for example when kt ≥ kOPT

t , kOPTt

is non-increasing, and kt is non-decreasing. Note that this includes the settingkt ≡ kOPT

t ≡ k, corresponding to the original k-resource problem.

Division of input into phases. First, we show how to deterministically par-tition the whole input sequence σ into phases; each phase consist of severaltime steps. The procedure is described in Figure 1. In each phase, we trackthe maximum demand occurring at any node, and we store this information invector Dt. Within one phase, D is non-decreasing and since the change of d isrestricted, only one entry of D can change, and only by 1. At the beginning ofthe phase Pq, we store the current number of units, kt, in the variable κq. Notethat a phase Pq may end because either kt < κq or |Dt| > κq. If the formercondition holds, we call such Pq unfair, otherwise Pq is fair. Note that any k-resource instance consists only of fair phases. As a byproduct, we get that withina phase |dt| ≤ |Dt| ≤ κq. Note that the partitioning into phases depends onlyon the input sequence and can be computed online.

3.1 Phase-based algorithms for the DR problem

In this section, we construct a class of phase-based algorithms. Although thealgorithms will always produce a feasible solution for the DR problem, we provetheir competitiveness in fair phases only. This immediately yields their compet-itiveness on k-resource instances.

The proof consists of two parts: in the first one we relate the cost of theoptimal offline algorithm in any two consecutive phases Pq−1 and Pq to the

6

Page 7: The k-Resource Problem on Uniform and on Uniformly Decomposable

subroutine StartPhase (q, t)Pq ← t; κq ← kt; Dt ← dt

q ← 1; StartPhase (q, 1) /* Pq = current phase */for t← 2 to |σ| do

for each node i let Dt[i]← maxt′∈Pq∪t dt′ [i]if kt < κq or |Dt| > κq

then q ← q + 1; StartPhase (q, t) /* new phase starts now */else Pq ← Pq ∪ t

return (P1, P2, . . . , Pq)

Fig. 1. Division of input into phases

difference of the values of D at the end of these phases; in the second one werelate the cost of our algorithm to the same amount.

Algorithm construction. A phase-based algorithm PB bases its choices solelyon the contents of vector D, namely it always tries to maintain an invariantX ≥ D. This simplifies the analysis as we may assume that the adversary ma-nipulates vector D directly instead of changing the demands. Moreover, in phasePq, the algorithm uses only κq units, and we explicitly assume it in the analy-sis, i.e. |X| = κq. The surplus of units is left untouched by the algorithm andis stored in a fixed node vS. If the real number of units decreases, the surplusdecreases, and if surplus diminishes below zero, it implies the end of the phasebecause of the condition kt < κq.

First, we describe the behavior of PB in the first step of a phase Pq. If thepreceding phase was fair, then κq ≥ κq−1. If this inequality is strict, then thealgorithm has to increase the number of resources it is actually using. We simplyassume that at the very beginning of Pq, the vector X increases by the surplusunits, so that |X| = κq. This introduces no additional cost to the algorithm. If thepreceding phase was unfair, then the situation is a little bit more complicated,because κq < κq−1, and the algorithm has to remove some units. In such case,in the first step a reorganization is performed, i.e., PB moves all the units, sothat the demand is fulfilled exactly: X[i] = d[i] for each node i but vS, where allthe remaining units are stored.

To precisely describe the behavior of PB within a phase, we divide the nodesinto three groups. A node i is called saturated when X[i] = D[i], unsaturatedwhen X[i] > D[i], and infringing when X[i] < D[i]. It usually makes a difference,when these conditions are checked: before or after the algorithm’s decision instep t. In the former case, Dt is compared with Xt−1, and in the latter with Xt.

Phase-based algorithms are lazy (as introduced earlier for the k-server prob-lem in [8]). It means that if the invariant holds at the beginning of time step t,i.e. if Xt−1 ≥ Dt, the algorithm does nothing, setting Xt = Xt−1. Otherwise,

7

Page 8: The k-Resource Problem on Uniform and on Uniformly Decomposable

note that Xt−1 covers Dt−1 and since D may change only at one node, say j,there is at most one infringing node j. The algorithm may not move any of theunits from saturated nodes without further violating the invariant, and thereforeit considers the set of unsaturated nodes Ut = i ∈ V : Xt−1[i] > Dt[i]. Sincethroughout the phase |Dt| ≤ κq = |Xt| and there exists one infringing node,Ut is non-empty. PB chooses now one node i ∈ Ut, according to some rule calledU-rule, and moves one unit from node i to j (we write that j borrows one unitfrom i). Note that PB is not fully defined, as we have some freedom in choosingthe U-rule. It appears that we may show some properties of PB and the boundson its performance which hold for any U-rule.

Basic observations. We start with an easy observation on the structure of Utsets and node saturation process.

Lemma 2. For any two consecutive steps t and t+1 from one phase, Ut+1 ⊆ Ut.Additionally, at the very end of a fair phase all nodes are saturated.

Proof. For the first part of the lemma, it suffices to show that within a phase itis impossible for a node to change its state to unsaturated. Assume the contrary,i.e. that a node i changed its state into unsaturated. Since D is non-decreasing,it can only happen if the number of resources at i increased, i.e. Xt+1[i] > Xt[i].But the algorithm PB increases the number of resources only when a nodeis infringing. Then, after the increase, the node becomes saturated (and notunsaturated).

For proving the second part of the lemma, we fix any fair phase Pq. At theend of each step t from Pq, we have Xt ≥ Dt and |Xt| = κq. Since Pq is fair, atthe end of its last step it holds that |D| = κq, and thus X = D, i.e., all nodesare saturated. ut

Now fix any phase Pq. For the sake of analysis, if reorganization of X occursat the end of the first step of Pq, we assume that it is performed at the verybeginning of Pq, before the demands are presented to the algorithm in the firststep. This assumption simplifies the notations below. Let Fq be the resourcevector X at the very beginning of Pq (but after the reorganization step, if any)and let F ′q be the resource vector at the very end of Pq. Obviously, it holdsthat |Fq| = |F ′q| = κq. Furthermore, as shown in the lemma below, Fq does notdepend on the used U-rule.

Lemma 3. The values of Fq do not depend on the U-rule used by the algorithm.

Proof. Note that the division into phases is based on the input sequence only.We show the lemma by an induction on the number of phases. At the beginning,F1 = X0. Assume that the condition holds for the first q phases. If phase Pqis fair, then by Lemma 2 at its end X = D, and then surplus nodes at vS are(possibly) added to X so that |X| = κq+1. Thus, Fq does not depend on PBchoices. On the other hand, if Pq is unfair, then during the reorganization theresource vector is created solely on the basis of the demand ds and ks, where sis the first step of phase Pq+1. ut

8

Page 9: The k-Resource Problem on Uniform and on Uniformly Decomposable

Lower bound on the optimal algorithm. Recall that if at some node we needa resource unit, we borrow it from a node which has too many units comparedto its current demand. If we always borrowed from a “correct” node (one thatwill not need this unit anymore in this phase), we would pay exactly δ(Fq, F

′q)

in phase Pq (neglecting the cost of reorganization step). It appears that on fairphases no algorithm which uses few resources can asymptotically beat the costof δ(Fq, F

′q).

To give the reader more insight in the structure of the lower bound, weconsider the k-resource problem, i.e. kt ≡ kOPT

t ≡ k, and consider the followingoffline strategy Off: at the beginning of any phase Pp, set the resource vectorto F ′p and do not change it throughout the whole phase. Of course, such a resourcevector is valid for all the demands occurring in the phase, and thus inside a phaseOff pays nothing. A drawback of this algorithm is that the changing betweenphase Pq−1 and Pq costs δ(F ′q−1, F

′q) = δ(Fq, F

′q). The lemma below shows that

this “switching” cost is unavoidable by any algorithm, even the optimal offlineone. Moreover, this lower bound holds asymptotically not only for k-resourceinstances, but also for fair phases of DR instances.

Lemma 4. For any two consecutive fair phases Pq−1 and Pq, any algorithm forthe DR problem that has at most minκq−1, κq units in these phases pays atleast δ(Fq, F

′q).

Proof. Recall that F ′q−1 and F ′q are the values of vector D at the end of phasesPq−1 and Pq, respectively. Furthermore, |F ′q−1| = κq−1 and |F ′q| = κq. Let κ =minκq−1, κq. Let fi = maxF ′q−1[i], F ′q[i], i.e., fi is the maximum demandoccurring at node i during the given two phases. Consider the following thoughtexperiment: we have

∑i fi slots, at most κ slots are occupied by units at the

beginning. We want each slot to be occupied at some moment of time as this isa condition necessary to have fi resources at node i at some time step. To eachof∑i fi − κ slots, which are initially empty, we have to move a unit, and thus

the total amount paid is at least∑i fi−κ. Hence, it suffices to lower-bound this

term by δ(Fq, F′q).

As Pq−1 is a fair phase, Fq ≥ F ′q−1. Hence, using |Fq| = |F ′q|, we obtain

δ(Fq, F′q) =

∑i:F ′q [i]>Fq [i]

(F ′q[i]− Fq[i]) ≤∑

i:F ′q [i]>F′q−1[i]

(F ′q[i]− F ′q−1[i])

=∑

i:F ′q [i]>F′q−1[i]

(F ′q[i]− F ′q−1[i]) +∑

i:F ′q [i]≤F ′q−1[i]

(F ′q−1[i]− F ′q−1[i])

=∑i

maxF ′q−1[i], F ′q[i]

−∑i

F ′q−1[i]

=∑i

fi − κq−1 ≤∑i

fi − κ ,

which finishes the proof. ut

9

Page 10: The k-Resource Problem on Uniform and on Uniformly Decomposable

Note that, generally, the lemma above does not hold for unfair phases. Inparticular τ vectors might be small there, and thus it might be possible for analgorithm to have a resource vector which is “good” for both phases.

Tokens and cost in one phase. In an online setting it is usually not possibleto borrow units in an optimal way. If — to fulfill the demand — node i borrowsfrom some node j, which will need this unit in the future, we only get rid of thedeficiency for a while and when the demand at node j increases appropriately,it will have to borrow from some other node.

To analyze the performance of our algorithm, we introduce a concept oftokens. One may think of a token as a kind of currency used to pay for unitssent from remote nodes. The phase begins with no tokens in the graph; at the endof a phase all tokens are removed. Whenever node i borrows a unit from node jit has to pay j, i.e., give j a token in exchange. If i has no tokens, then prior tothe exchange it has to produce one. In effect, the cost paid by the algorithm inone phase is equal to the number of node changes of all the tokens produced inthis phase. We denote the number of tokens at node i at the end of time step tby Tt[i]. On the basis of the description above, one can deduce that only at mostδ(Fq, F

′q) tokens are produced during any phase Pq.

To prove this, we first formulate the relation between the D, X and T , andthe bound on the number of tokens produced.

Lemma 5. Fix any phase Pq. For any time step t from Pq and any node i, itholds that Xt[i] + Tt[i] ≥ Fq[i]. Moreover, if Xt[i] > Dt[i] or Tt[i] > 0, thenXt[i] + Tt[i] = Fq[i].

Proof. We prove the lemma by induction on the number of steps within phase Pq.At the beginning of Pq, there are no tokens at node i and Xt[i] = Fq[i], so theinduction basis trivially holds. Assume that the conditions of the lemma holdfor time step t. For the vectors X or T to change in time step t + 1, D has toincrease at some node i, so that i becomes an infringing node and has to borrowone unit from a node j. We consider the lemma condition separately at node iand j.

1. If there were some tokens at i in time step t, then a token was sent inexchange for a unit, and thus Xt+1[i] + Tt+1[i] = Xt[i] + Tt[i]. If there wereno tokens at i, then in effect, there are still no tokens at i and the number ofunits X[i] increases. Since the node was already saturated at t and Tt[i] = 0,the increase of X[i] does not violate the second condition of the lemma.

2. Note that j has to be unsaturated, i.e., Xt[j] > Dt+1[j] ≥ Dt[j] (otherwise itwould not be chosen by our algorithm). Since a unit is exchanged for a token,Xt+1[j] +Tt+1[j] = Xt[j] +Tt[j]. By inductive hypothesis, the latter term isequal to Fq[j]. ut

Lemma 6. The number of tokens produced within any phase Pq is δ(Fq, F′q).

10

Page 11: The k-Resource Problem on Uniform and on Uniformly Decomposable

Proof. Since the number of tokens does not decrease within a phase, it is suf-ficient to show that the total number of tokens at the end of phase Pq is atmost δ(Fq, F

′q). Let t be the last time step of Pq, i.e. Xt = F ′q. By Lemma 5, for

any i it holds that Tt[i] = 0 or Tt[i] = Fq[i] − Xt[i] = Fq[i] − F ′q[i]. Therefore,|Tt| =

∑i:Fq [i]>F ′q [i]

(Fq[i]− F ′q[i]) = δ(Fq, F′q). ut

Bounds for one phase of PB. The following lemma shows an essential upperbound on the cost of the PB algorithm in one phase.

Lemma 7. Let unfq be a binary indicator variable denoting whether phase Pqwas unfair. For any phase Pq, it holds that CPB(Pq) ≤ minn−1, κq·δ(Fq, F ′q)+κq · unfq−1.

Proof. If the previous phase was unfair, then the cost of the reorganization atthe beginning of Pq is at most κq. By our earlier observation, the number ofproduced tokens is at most δ(Fq, F

′q) and therefore it is sufficient to show that

each token is moved at most minn− 1, κq times.Fix any time step t. First, note that if node i borrows a unit from node j,

then i /∈ Ut and j ∈ Ut. Therefore a token is sent from the node outside Ut to thenode inside Ut. Let y denote the size of set Ut when the first borrowing of thephase takes place. We have y ≤ n−1 and y ≤ κq. Since, by Lemma 2, Ut+1 ⊆ Ut,a token can be sent only y times. This concludes the proof. ut

Sequences of fair phases. When we combine Lemma 4 and Lemma 7, wecan relate the cost of the optimal algorithm in two consecutive fair phases Pq−1

and Pq to the cost of the algorithm PB in Pq. Clearly, these bounds hold for allphases of input sequences of the k-resource problem.

Lemma 8. Fix any phase-based algorithm A and any input sequence σ. Assumethat for any two consecutive fair phases Pq−1, Pq, it holds that CA(Pq) ≤ γ(κq) ·δ(Fq, F

′q) where γ is some function. Then, A is O(γ(k))-competitive for the k-

resource problem.

Proof. Fix any input sequence σ and let P1, P2, . . . , Pp be its division into phases.Since we are dealing with the k-resource problem, all these phases are fair andκq = k for all 1 ≤ q ≤ p. By Lemma 4, the inequality CA(Pq) ≤ O(γ(k)) ·[COPT(Pq−1) + COPT(Pq)] holds for any phase Pq, such that 2 ≤ q ≤ p − 1.Furthermore, as δ(Fq, F

′q) ≤ k, for any phase Pq it holds that CA(Pq) ≤ γ(k) · k.

Therefore,

CA(σ) ≤ CA(P1) + CA(Pp) +

p−1∑q=2

CA(Pq)

≤ 2 · k · γ(k) +

p−1∑q=2

O(γ(k)) · COPT(Pq) +

p−2∑q=1

O(γ(k)) · COPT(Pq)

≤ 2 · O(γ(k)) · COPT(σ) +O(k · γ(k)) ,

11

Page 12: The k-Resource Problem on Uniform and on Uniformly Decomposable

which finishes the proof. ut

Theorem 1. Any (deterministic) phase-based algorithm PB is O(minn, k)-competitive for the k-resource problem.

3.2 Randomized phase-based algorithm for DR problem

In this section we show a randomized phase-based algorithm for the DR problem,which — on k-resource instances — is O(log(mink, n))-competitive. We onlyhave to specify the U-rule: the algorithm chooses a node with the smallest numberof tokens. If there is more than one such node, it is chosen uniformly at random.We denote the resulting algorithm by PBR.

Distribution of tokens. Our goal is to define the whole game between theadversary and the algorithm in terms of changes in token positions. For eachtime step t, we introduce the notion of set U ′t = i ∈ V : Xt[i] > Dt[i], i.e.,the set of all nodes that are unsaturated after the algorithm moves its unit.Similarly to the proof of Lemma 2, we get that U ′t+1 ⊆ Ut+1 ⊆ U ′t. Let `t denotethe minimum number of tokens at a node from U ′t. We can show that each nodefrom U ′t has either `t or `t + 1 tokens.

Lemma 9. In step t the number of tokens at any node is at most `t + 1.

Proof. We prove the lemma by the induction on the number of time steps. Atthe very beginning of the phase, there are no tokens, `t = 0 and the lemmatrivially holds. Assume that the condition holds for time step t. Since in timestep t+ 1 a new token can appear only in set Ut+1 ⊆ U ′t and it can only appearat the nodes with `t tokens, the new number of tokens at any node is at most`t + 1. The number of tokens at set U ′ can only increase, and thus this amountis at most `t+1 + 1. ut

There are two reasons for a node i ∈ U ′ to become saturated and in effectexcluded from U ′. The first one occurs when the demand D[i] increases to thelevel equal to X[i]. The second one occurs when a unit from i is borrowed bysome other node and in effect X[i] decreases to the value of D[i]. Althoughsimilar, these cases substantially differ. In the former case, the choice of node ismade by the adversary; in the latter case, the node is chosen in random fashionby the algorithm and not known precisely to the adversary.

The key to the analysis is the set At = U ′t ∪ i ∈ V : Tt[i] = `t + 1.Informally, At contains all the nodes that are either unsaturated or these forwhich the adversary cannot be sure that they are saturated. Obviously, eachnode from At contains `t or `t + 1 tokens. The following lemma redefines thewhole game between the algorithm and the adversary in terms of token shifting.

Lemma 10. In step t+ 1, there are two possible actions concerning tokens andset A that can be incurred by the adversary.

12

Page 13: The k-Resource Problem on Uniform and on Uniformly Decomposable

A. A token is moved from i /∈ At to j ∈ At. If i had no tokens, then one tokenwas produced at i.

B. A node i is removed from set At. If i had `t+ 1 tokens, `t tokens remain at iand one is moved to j ∈ At.

In both actions, node j is chosen uniformly at random amongst these nodes ofAt that have `t tokens. Additionally, as a result of Action A, set A may decrease.Furthermore, set A does not depend on the random choices made by PBR.

Proof. When can the distribution of tokens or the set A change? Obviously,a necessary condition is that the vector D has to change (increase), becauseotherwise the algorithm makes no action at all. Let i be the node at which thedemand D increased, i.e. Dt+1[i] = Dt[i] + 1. We consider several cases.

– i /∈ At. Since Xt[i] = Dt[i], Xt[i] < Dt+1[i], and node i has to borrow a unit.In this case, a token is produced at i if necessary, and moved from node ito node j chosen randomly from Ut+1. We show that in this case Action Atakes place.Let us take a closer look at the structure of Ut+1 set. We have Ut+1 ⊆ U ′t ⊆At, and since at the beginning of step t+1 the demand increased outside At,Ut+1 = U ′t. By Lemma 9, U ′t consists of nodes with either `t or `t + 1 tokens,and so does Ut+1. Additionally, the Ut+1 nodes that have `t tokens are exactlythe same nodes as the ones from At with `t tokens. Therefore, j is in factchosen uniformly at random amongst At nodes with `t tokens.If after moving a token to At in step t+1, all nodes from A have `t+1 tokens,`t+1 = `t + 1. In effect set A changes: all saturated nodes are removed fromit. Note that this change is deterministic: By Lemma 5, Xt[i] = Fq[i]−Tt[i] =Fq[i]− `t − 1 for any node i ∈ At, i.e., the number of resource units at anysuch node is deterministic. Thus, the property of being saturated at the endof time t also does not depend on the random choices made by PBR.

– i ∈ At. Let Pq be the current phase. By Lemma 5, we get that Xt[i]+Tt[i] =Fq[i]. We first show that

Dt+1[i] ≤ Fq[i]− `t . (1)

It is sufficient to show that Dt[i] < Fq[i]− `t. If Tt[i] = `t + 1, then Dt[i] ≤Xt[i] = Fq[i] − `t − 1. Otherwise Tt[i] = `t, and thus i ∈ U ′t, which impliesDt[i] < Xt[i], and in effect Dt[i] < Fq[i]− `t.By (1), it suffices to consider two subcases, depending on the demand atnode i.• Dt+1[i] ≤ Fq[i] − `t − 1. Since Xt[i] = Fq[i] − Tt[i] ≥ Fq[i] − `t − 1, the

algorithm has nothing to do. Although such a change may cause i tobecome saturated, this happens only if i has `t + 1 tokens, and thereforeset A does not change.• Dt+1[i] = Fq[i]−`t. We show that this case corresponds to one Action B.

If i has `t tokens, then sinceXt[i] = Fq[i]−`t, the algorithm does nothing.If i has `t + 1 tokens, it has Fq[i]− `t − 1 units and has to borrow one.

13

Page 14: The k-Resource Problem on Uniform and on Uniformly Decomposable

In effect it chooses randomly a node j from the set Ut+1 and a tokenis sent from i to j. It holds that Ut+1 = U ′t \ i, and thus, as above,the algorithm chooses in fact node j uniformly at random amongst thesenodes of At that have `t tokens. In both cases i becomes saturated andtherefore removed from sets U ′ and A.

ut

Note that the adversary can compute the set At, but since it is oblivious itdoes not know exactly which nodes have `t tokens and which `t + 1. Let rt bethe number of At nodes with `t + 1 tokens. In the appendix, we prove that thenodes with higher number of tokens are distributed uniformly in At.

Lemma 11. The probability that a node from At has `t + 1 tokens is equal tort/|At|.

Number of token movements. In order to bound the expected number oftoken movements in one phase, we construct a potential function Φ, which relatesthis amount to the current distribution of tokens.

We fix any phase Pq and any time step t ∈ Pq. Let Lt =∑i/∈At Tt[i], the

number of tokens outside set At. Let

Φt = |Tt| − δ(Fq, F ′q) ·H|At| − Lt ,

where Hi =∑ij=1 1/j. Below we show that the expected cost of PBR in one

step is bounded by the change in the potential.

Lemma 12. In time step t+ 1, E[CPBR(t+ 1)] ≤ Φt+1 − Φt.

Proof. By Lemma 10, we have to consider two types of events.Assume that Action A occurs. If a token is produced at node i /∈ At, both |T |

and L increase by 1, which does not change the potential. The cost of movinga token is paid by the decrease of L by 1. Finally, set A may decrease, but thiscan only increase the change in the potential.

Assume that Action B occurs. Then, At+1 = At \ i and `t tokens areremoved from set A. E[CPBR(t+ 1)] = rt/|At|, because rt/|At| is the probabilityof moving a token. Therefore, the change in the potential is equal to

Φt+1 − Φt = δ(Fq, F′q) · [H|At| −H|At+1|]− `t =

δ(Fq, F′q)

|At|− `t ≤

rt|At|

,

where the last inequality holds because the number of tokens in At, `t · |At|+ rt,is at most δ(Fq, F

′q). ut

Since it always holds that |At| ≤ minn, κq and |Tt| ≤ δ(Fq, F′q), the ab-

solute value of Φ is bounded by O(log(minn, κq)) · δ(Fq, F ′q). By Lemma 12,the same bound holds for the expected number of token movements in phase Pq,and thus we get the following lemma.

14

Page 15: The k-Resource Problem on Uniform and on Uniformly Decomposable

Lemma 13. For any phase Pq, E[CPBR(Pq)] = O(log(minn, κq)) · δ(Fq, F ′q) +κq · unfq−1.

We note that Lemma 8 holds also for randomized algorithms. Thus, we getthe following conclusion.

Theorem 2. PBR is O(log(minn, k))-competitive for the k-resource problem.

4 Uniformly decomposable metric spaces

Up to this point, we have been considering the k-resource problem in uniformmetric spaces. We now turn our attention to a metric space (X , d) which isuniformly decomposable into a set Λ of components, each being a uniform metricspace. Let z = |Λ| and let Γ denote the distance between components.

Outline of the solution. To solve the k-resource problem on a uniformlydecomposable metric space, we have to care about an appropriate resource as-signment on two levels: the available resources must be split accordingly betweenthe components of the metric space and they must be assigned to single pointsof the metric space within each of the components.

The resource assignment in each of the components is managed by separateinstances of algorithms for the dynamic-resource problem (we use the algorithmPBR introduced in the previous section). Note that if we look only at the higherlevel and we treat each component as one point of the space, we have a usualk-resource game on a uniform metric. However, if we solve it naively, neglect-ing what really happens inside particular components, we obtain an inefficientalgorithm. For example, if the whole activity takes place in one component, butthe total demand in this component is constant, the naive algorithm on thehigher level does nothing and may assign much fewer resources to this compo-nent than the optimal algorithm. Therefore, the algorithm PBR working insidethis particular component has no chance to be competitive.

Thus, the PBR algorithms running inside the components have to give thehigher level assignment algorithm hints in which components the resource de-mand changes in a significant manner. Nevertheless, even with these hints, theproblem seems to be difficult, and therefore we give to our algorithm a little bitmore resources than to the optimal one (i.e., we use resource augmentation).This guarantees that there will be many phases in which PBR algorithms haveat least as many resources as Opt. By the previous section, we know that theratio between their costs in such phases is at most logarithmic in k and in thenumber of nodes in the specific component.

Upper level of DMR. We introduce an algorithm DMR. It works by usingseparate instances PBRλ of the algorithm PBR in each component λ ∈ Λ.After the adversary changes the demands in component λ, the algorithm DMRchecks whether more resources must be moved to component λ. If necessary, this

15

Page 16: The k-Resource Problem on Uniform and on Uniformly Decomposable

movement is performed and afterwards the algorithm PBRλ is used to handlethat request with the resources available locally in λ.

Let Dt(λ), kt(λ), Fq(λ), unfq(λ) and κq(λ) denote, respectively, the variablesDt, kt, Fq, unfq and κq for the algorithm PBRλ (as introduced in the analysisof PBR). For any step t belonging to phase q we define a padding gt(λ) as

gt(λ) =∑

i:Dt(λ)[i]>Fq(λ)[i]

(Dt(λ)[i]− Fq(λ)[i]) . (2)

Let w[λ] denote the total demand for resources in a component λ, i.e. wt[λ] =∑p∈λ dt[p]. The assignment of resources to components is performed by an al-

gorithm which depends on changes of the padding g. In particular, we constructthe following sequence of vectors:

Wt[λ] =

maxWt−1[λ] + 1/Γ,wt[λ] if t > 2 and gt−1(λ) > gt−2(λ),

maxWt−1[λ], wt[λ] otherwise.

Note that by this definition only two elements of W can increase per time step.The recursive definition is still incomplete as we have to give some starting con-ditions. Using the values of W , the algorithm DMR divides the input sequence σinto epochs E1, E2, . . .. The first epoch starts with the first time step. At thebeginning of each epoch we set W = w. An epoch ends at the end of a step t(after PBR executed all its actions in t) in which |Wt| ≥ (1 + c) · k − 2. Since|W | can increase by at most 1 + 1/Γ per step, at the very end of the epoch|W | ≤ (1 + c) · k. We call each increase of W at time t due to the conditiongt−1(λ) > gt−2(λ) a hit in component λ.

Let a vector Bt denote the number of resources available in the components.Obviously |Bt| = (1 + c) · k. In step t, we assign exactly bWt[λ]c resources tocomponent λ by setting kt(λ) = bWt[λ]c. If there are too few resources in λ (i.e.bWt[λ]c > Bt−1[λ]), then a resource item is moved from another component.This is always possible since we have (1 + c) · k resource units available and∑λ∈ΛbWt[λ]c ≤ (1 + c) · k by the way epochs are constructed.In effect, DMR constructs a part of the input sequence for the dynamic-

resource problem solved by PBRλ by changing the number of assigned resources.In any time step, the DMR algorithm moves resources between components priorto the algorithms PBRλ. This assures that each PBRλ has bWt[λ]c ≥ wt[λ]resources available to fulfill the demand. The PBRλ algorithm may only use theassigned resources to fulfill the demand, and not all the resources really availablein the component. Such construction implies that not all resources are alwaysused; this appears counterproductive at first glance, but it keeps the divisioninto epochs deterministic and dependent only on the input sequence.

Analysis of DMR. Before we analyze the cost of DMR and Opt inside ofepochs, we note that the division into epochs depends only on the input se-quence σ. Epochs are determined by the values of W , and it can be easily seenthat the values of Wt depend only on Wt−1 and gt−1. The values of g depend

16

Page 17: The k-Resource Problem on Uniform and on Uniformly Decomposable

on Fq in particular components and hence a simple induction together withLemma 3 implies that the values of Wt and gt does not depend on the randomchoices of the algorithm.

We denote all costs of DMR and Opt due to transferring resources betweencomponents by CT

DMR and CTOPT, respectively. Then, it holds that CDMR(σ) =

CTDMR(σ) +

∑λ∈Λ CPBRλ(σ|λ), where σ|λ denotes the part of input relevant for

component λ and with the number of assigned resources set by the algorithmDMR. Similarly, COPT(σ) = CT

OPT(σ) +∑λ∈Λ COPTλ(σ|λ).

Lemma 14. For any epoch Ey, it holds that E[CDMR(Ey)] = ((1 + c) · Γ + z) ·k · O(log(minn, k)), where the expectation is taken w.r.t. all random choicesmade by the algorithms PBRλ.

Proof. The number of resource transfers between components within epoch Eyis determined by the changes in |W |. The algorithm DMR moves a resourcebetween components only if bW c has increased and this can happen at most(1 + c) · k times during an epoch. Thus,

CTDMR(Ey) ≤ (1 + c) · k · Γ . (3)

Consider now a specific component λ and let hλ(Ey) denote the number ofhits issued in component λ within epoch Ey. As for each hit |W | grows at least by1/Γ , the total number of hits issued in a phase is

∑λ∈Λ hλ(Ey) ≤ (1 + c) · k ·Γ .

Let Pp, . . . , Pp′ denote the smallest set of phases by PBRλ that contains theepoch Ey. Within an epoch, the number of resources assigned to λ may only

increase, and thus only Pp′ may be unfair. Hence,∑p′

q=p unfq−1(λ) ≤ 1 and

p′−1∑q=p+1

δ(Fq(λ), F ′q(λ)) ≤ hλ(Ey) + 1 ,

where the additional cost of 1 comes from the fact that an increase of g in thelast time step of Ey may contribute to a hit in Ey+1 instead of Ey. By Lemma 13,the expected cost of PBRλ in epoch Ey is then

E[CPBRλ(Ey|λ)] =

p′∑q=p

(O(log(minn, k)) · δ(Fq(λ), F ′q(λ)) + k · unfq−1(λ)

)= O(log(minn, k)) · (k + hλ(Ey)) ,

since δ(Fq(λ), F ′q(λ)) ≤ k for any phase q. Summing over all components, weobtain ∑

λ∈Λ

E[CPBRλ(Ey|λ)] = O(log(minn, k)) · ((1 + c) · Γ + z) · k (4)

Relations (3) and (4) together yield the lemma. ut

17

Page 18: The k-Resource Problem on Uniform and on Uniformly Decomposable

Bounding OPT. A lower bound on the cost of Opt relies on the notion offair timespans. In such a timespan, the algorithm PBRλ has at least the samenumber of resources as Opt, which allow us to use the bounds from Section 3.Since DMR has (1 + c) · k resources available, we can guarantee that there existfair timespans of appropriate length during an epoch.

Lemma 15. Let z ≤ c · Γ/4. Then, for any epoch Ey, COPT(Ey) = Ω(c · k · Γ ).

Proof. By Wt[λ] we denote the number of resources maintained by Opt in com-

ponent λ at time t. Let η[λ] = maxt∈Ey Wt[λ] and η[λ] = maxt∈Ey Wt[λ]. Notethat in the latter definition, the maximum is achieved at the last step of epoch Ey,denoted e. Since Opt has only k resource units, it has moved at least |η| − kunits during Ey, and therefore

CTOPT(Ey) ≥ (|η| − k) · Γ . (5)

We now want to lower bound the cost of Optλ. Let λ be a component, suchthat η[λ] > η[λ]. Let s be the time step when bWs[λ]c ≥ η[λ] for the first timein epoch Ey and let tλ denote the interval [s, e].

Since Opt is able to serve the demands, using only η[λ] units, wt[λ] ≤ η[λ]for any t ∈ tλ. Therefore, the increase of W [λ] from η[λ] to η[λ] during interval tλcould have only happened due to hits in λ. Thus, hλ(tλ) ≥ (η[λ]− η[λ]) ·Γ , wherehλ(tλ) denotes the number of hits in component λ during tλ. Let Pp, . . . , Pp′ bethe smallest set of PBRλ phases that contain tλ. Note that except possiblyPp′ all of them are fair, and except possibly Pp and Pp′ they are contained inepoch Ey.

Note that hλ(tλ) is upper-bounded by the number of hits in phases Pp, . . . , Pp′ .In the following, we bound the latter amount. In any fair phase Pq, the valueof padding g increases from 0 to δ(Fq(λ), F ′q(λ)). In any unfair phase Pq thepadding increases from 0 to at most k. By the definition of W , each such in-crease corresponds to a hit one step later. Thus, the number of hits in phases

Pq, . . . , Pp′ is at most 1 + k+ k+∑p′−1q=p+2 δ(Fq(λ), F ′q(λ)) + k, where the term 1

may come from the possible increase of padding g in the last step of phase Pp−1.Hence,

p′−1∑q=p+2

δ(F ′q(λ), Fq(λ)) ≥ hλ(tλ)− 3k − 1 ≥ (η[λ]− η[λ]) · Γ − 3k − 1 . (6)

To lower-bound the cost of Opt in Ey, we look at a phase Pq where q ∈p+2, . . . , p′−1. For any such q, both phases Pq−1 and Pq are fair. Furthermore,in both these phases, the number of units at Opt disposal (in component λ) isat most η[γ] ≤ minκq−1(λ), κq(λ). Thus, by Lemma 4, it holds that

COPTλ(Ey) ≥p′−1∑q=p+1

COPTλ(Ey) ≥p′−1∑q=p+2

12 · δ(Fq(λ), F ′q(λ)) . (7)

18

Page 19: The k-Resource Problem on Uniform and on Uniformly Decomposable

Recall that (7) holds for components λ for which η[λ] > η[λ]. Hence, by combin-ing (5), (6) and (7), we obtain

2 · COPT(Ey) ≥ 2 · CTOPT(Ey) +

∑λ:η[λ]>η[λ]

2 · COPTλ(Ey)

≥ (|η| − k) · Γ +∑

λ:η[λ]>η[λ]

((η[λ]− η[λ]) · Γ − 3k − 1

)≥ (|η| − k) · Γ +

∑λ

((η[λ]− η[λ]) · Γ − 3k − 1

)= − k · Γ + |η| · Γ − (3k + 1) · z≥ Γ · (c · k − 2)− (3k + 1) · z ,

where in the last inequality, we used that |η| ≥ (1 + c) · k − 2. For z ≤ c · Γ/4,the last term is Ω(c · k · Γ ). ut

The competitive ratio. The following theorem follows easily since each inputsequence is deterministically partitioned into epochs and DMR is competitive forevery finished epoch by the two former lemmas. The last potentially unfinishedepoch contributes only an additive term.

Theorem 3. Let (X , ξ) be a uniformly decomposable metric space with com-ponent set Λ. Then DMR is O((1 + 1/c) · log(minn, k))-competitive for thek-resource problem on (X , ξ) with c-resource augmentation, provided that |Λ| ≤c · Γ/4 and Γ ≥ k.

Note that Theorem 3 holds analogously for the k-server problem by thereduction from Lemma 1.

References

1. Y. Bartal, B. Bollobas, and M. Mendel. A Ramsey-type theorem for metric spacesand its applications for metrical task systems and related problems. In Proc. of the42nd IEEE Symp. on Foundations of Computer Science (FOCS), pages 396–405,2001.

2. Y. Bartal, N. Linial, M. Mendel, and A. Naor. On metric Ramsey-type phenomena.In Proc. of the 35th ACM Symp. on Theory of Computing (STOC), pages 463–472,2003.

3. Y. Bartal and M. Mendel. Randomized k-server algorithms for growth-ratebounded graphs. Journal of Algorithms, 55(2):192–202, 2005.

4. S. Ben-David, A. Borodin, R. M. Karp, G. Tardos, and A. Wigderson. On thepower of randomization in online algorithms. In Proc. of the 22nd ACM Symp. onTheory of Computing (STOC), pages 379–386, 1990.

5. B. Csaba and S. Lodha. A randomized on-line algorithm for the k-server problemon a line. Random Structures and Algorithms, 29(1):82–104, 2006.

6. A. Fiat, R. M. Karp, M. Luby, L. A. McGeoch, D. D. Sleator, and N. E. Young.Competitive paging algorithms. Journal of Algorithms, 12(4):685–699, 1991.

19

Page 20: The k-Resource Problem on Uniform and on Uniformly Decomposable

7. E. Koutsoupias and C. H. Papadimitriou. On the k-server conjecture. Journal ofthe ACM, 42(5):971–983, 1995. Also appeared in Proc. of the 26th STOC, pages507–511, 1994.

8. M. S. Manasse, L. A. McGeoch, and D. D. Sleator. Competitive algorithms forserver problems. Journal of the ACM, 11(2):208–230, 1990. Also appeared asCompetitive algorithms for on-line problems in Proc. of the 20th STOC, pages322–333, 1988.

9. S. S. Seiden. A general decomposition theorem for the k-server problem. In Proc.of the 9th European Symp. on Algorithms (ESA), pages 86–97, 2001.

10. D. D. Sleator and R. E. Tarjan. Amortized efficiency of list update and pagingrules. Communications of the ACM, 28(2):202–208, 1985.

11. N. E. Young. On-line file caching. Algorithmica, 33(3):371–383, 2002. Also ap-peared in Proc. of the 9th SODA, pages 82–86, 1998.

A Technical proofs

Proof (of Lemma 11). We prove a stronger condition. For a set I ⊆ At, suchthat |I| = rt, by EtI we denote an event that at the end of round t, I is the setof nodes with `t + 1 tokens. We show inductively that

Pr[EtI]

=1(|At|rt

) . (8)

Before we prove the equality above, we show how the lemma follows from it. Fixany node x ∈ At. There are exactly

(|At|−1rt−1

)sets with rt elements that contain x.

Since EtI are mutually exclusive events, the probability that that x contains `t+1

tokens is equal to(|At|−1rt−1

)· 1

(|At|rt)

= rt|At|

At the beginning, there are no tokens in the graph, rt = 0 and (8) triviallyholds. Assume that in round t, (8) is fulfilled for all I, such that |I| = rt.

If Action A occurs, then one token is added to a node j ∈ At with Tt[j] = `t.If after this action all nodes have `t + 1 tokens, `t+1 = `t + 1, rt+1 = 0 andthe condition (8) trivially holds. Otherwise rt+1 = rt + 1. Choose any set I ′ ⊆At+1 = At, such that |I ′| = rt+1. Then,

Pr[Et+1I′]

= Pr[∃x∈I′ Et(I′\x) ∧ token was added to x in round t+ 1

]= rt+1 ·

[1(|At|rt

) · 1

|At| − rt

]

=1(|At+1|rt+1

) .

If Action B occurs, then we can divide such action into two parts. In thefirst part, a node (either with `t or with `t + 1 tokens) is removed from At. Inthe second part a token is added to the reduced A set. The events of the lattertype were already analyzed above and thus it remains to consider the removal of

20

Page 21: The k-Resource Problem on Uniform and on Uniformly Decomposable

nodes from At. Assume that the removed node i had `t tokens. Then rt+1 = rt.Pick any set I ′ ⊆ At+1, such that |I ′| = rt+1. It holds that

Pr[Et+1I′]

= Pr[EtI′ | i has `t tokens

]=

Pr [EtI′ ∧ i has `t tokens]

Pr [i has `t tokens],

and since event EtI′ implies that i has `t tokens,

Pr[Et+1I′]

=Pr [EtI′ ]

Pr [i has `t tokens]=

1/(|At|rt

)|At|−rt|At|

=1(|At|−1rt

) =1(|At+1|rt+1

) .

Otherwise, the removed node i had `t+1 tokens. In this case we pick any setI ′ ⊆ At+1, such that |I ′| = rt+1 = rt − 1. The proof is analogous, i.e. it holdsthat

Pr[Et+1I′]

= Pr[Et(I′∪i) | i has `t + 1 tokens

]=

Pr[Et(I′∪i) ∧ i has `t + 1 tokens

]Pr [i has `t + 1 tokens]

,

and since event Et(I′∪i) implies that i has `t + 1 tokens,

Pr[Et+1I′]

=Pr[Et(I′∪i)

]Pr [i has `t + 1 tokens]

=1/(|At|rt

)rt|At|

=1(|At|−1

rt−1

) =1(|At+1|rt+1

) .

Thus, for either action, (8) holds for step t+ 1. ut

21