1 Introduction

Consider an employee in the Google IT division. He is responsible for replacing malfunctioning disks in Google’s huge computer farms. During his shift he receives requests to replace disks at some points in time. Each request is associated with a deadline. If the disk will not be replaced before the deadline, there is a high probability that the performance of the Search Engine will experience a significant hit. Replacing a disk takes unit time (service time). However, before the employee can replace it, he must travel from his current location to the location of the disk. The goal is to maximize the number of disks replaced before their deadline. What path should the employee take and how should the path change with new requests? Irani et al., SODA 2002 [15, 18] called this online problem the Dynamic Traveling Repair Problem (DTRP). They considered the special case of a fixed size time window, where the window of a request is the period between its release time and its deadline. In contrast, we consider the general case of an arbitrary size time window. In this paper we characterize the competitive ratio for each metric space separately. We determine whether the competitive ratio is constant or not depending on the minimum laxity (the minimum length of a time window) and the diameter of the metric space (the maximum distance between nodes in the metric space). In addition, we consider the case where the laxity is large compared to the optimal TSP solution of the metric space (the minimum distance to traverse all nodes). Specifically, we provide matching lower and upper bounds for these cases. These bounds depend on the ratio between the laxity and the optimal TSP solution of the metric space.

We note that even when the service time is not negligible, our problem can be reduced to TSP with time windows and zero service time [5] by changing the metric space. However, our competitive ratio depends on the properties of the metric space and the reduction might change the parameters of the metric space significantly. Hence, it might influence a crucial parameter which determines the competitive ratio. Therefore, we take service time into account in our model. Moreover, in our main result, where the laxity is larger than the optimal TSP solution of the metric space, without service time it is easy to design a 1-competitive algorithm by traveling over an optimal TSP solution periodically.

Offline Problem. Note that in the offline case (i.e., when the sequence is known in advance), if the service time is negligible compared to the minimum positive distance between nodes (or 0) then the problem becomes TSP (or vehicle routing) with time windows and zero service time [5]. Moreover, if in addition all deadlines are the same and all release times are zero then the problem reduces to the (offline) orienteering problem [1, 3, 14]. Vehicle routing problem (with time windows and zero service time) has been extensively studied both in computer science and the operations research literature, see [11, 12, 19,20,21,22]. For an arbitrary metric space Bansal et al. [5] showed an \(O(\log ^2 n)\)-approximation (for certain cases a better approximation can be achieved [8]). Constant factor approximations have been presented for the case of points on a line [6, 17, 23]. For the orienteering problem, i.e., all release times are zero, all deadlines are the same, and the service time is zero, there are constant factor approximation algorithms [5, 7, 9, 10]. A restricted online version of the Vehicle Routing problem (without deadlines) was considered in [2, 13, 16].

Application for Packet Scheduling. Another motivation for our problem is the Colored Packets with Deadlines and Metric Space Transition Cost problem. In this setting we are given a sequence of incoming colored packets. Each colored packet is of unit size and has a deadline. There is a reconfiguration cost (setup cost) to switch between colors (the cost depends on the colors). The goal is to find a schedule that maximizes the number of packets that are transmitted before the deadline. Note that for one color the earliest deadline first (EDF) strategy is known to achieve an optimal throughput. The unit cost color has been considered in [4]. In particular, when we apply our results to the uniform metric space we improve the previous lower bound and match the known upper bound.

1.1 Our Results

Denote by \(\sigma \) the sequence of requests. The window of request i is \([r_i,d_i]\), where \(r_i\) is the release time of the request and \(d_i\) is the deadline of the request. Let \(L = \min _{i \in \sigma } \{d_i - r_i\} \ge 1\) be the minimum laxity of the requests (the minimum length of a time window). Note that the laxity has to be at least 1 since the service time equals 1. Denote by \(\varDelta (G)\) the diameter of the metric space G, i.e., the largest distance between two nodes. Denote by TSP(G) the weight of a minimal TSP solution in the metric space G and MST(G) the weight of a minimal spanning tree.

In this paper we characterize when it is possible to achieve a \(\varTheta (1)\) competitive algorithm for the Dynamic Traveling Repair Problem with an arbitrary time window, and when the best competitive algorithm is unbounded. Moreover, we characterize the rate of convergence of the competitive ratio, which approaches 1 as the laxity increases. Specifically, we provide matching lower and upper bounds depending on the ratio between the laxity and the optimal TSP solution of the metric space.

It is also interesting to mention that in many cases the competitive ratio of an algorithm is computed as the supremum over all metric spaces while lower bounds are proved for one specific metric space. In contrast, we prove more refined results. Specifically, we show an upper bound and a lower bound for each metric space separately. Hence, one cannot design a better competitive algorithm for the specific metric space that one encounters in the real specific instance. Hence, even for specific metric spaces, we show it is impossible to do better.

We consider three cases. The last two cases are done for completeness of the result while the first case is our main result.

  • Case A: \(L > TSP(G)\). Let \(\delta = TSP(G) / L < 1\). We show a strictly larger than 1 lower bound. Specifically, if \(\delta \le \frac{1}{256}\) we provide a lower bound of \(1 + \varOmega \big (\sqrt{\delta }\big )\) as well as a matching upper bound of \(1 + O\big (\sqrt{\delta }\big )\).

    We note that without service time it is easy to design 1-competitive algorithm by traveling over an optimal TSP solution periodically. Recall that there is a reduction from the service time model to a model without service time that seems to contradict the lower bound (see [5]). However, the reduction modifies the metric space and hence increases \(\delta \) such that \(\delta \) is not smaller than \(\frac{1}{256}\).

  • Case B: \(3\varDelta (G) < L \le TSP(G)\). We design a O(1)-competitive algorithm and a 1.00054 lower bound.

  • Case C: \(L < \varDelta (G) / 2\). For any metric space the competitive ratio of any deterministic online algorithm is unbounded (easily proved). For randomized algorithms the competitive ratio depends on the metric space. For example, for a metric space which consists of 2 points one can easily show a 4-competitive algorithm even for \(L = 0\). In contrast, in a uniform metric space the competitive ratio is at least |V| where V is the number of nodes in the metric space, even for \(L < \varDelta (G)\).

    Note that in the remaining cases, i.e., \(\varDelta (G) / 2 \le L \le 3\varDelta (G)\), the question of whether there exists a constant competitive algorithm depends on the metric space for both deterministic and randomized algorithms. Specifically, for deterministic algorithms where \(L = \varDelta (G)\) it is easy to prove that there is no constant competitive algorithm for the uniform metric space. In contrast, there is a constant competitive algorithm for the line metric space. As mentioned above, for randomized algorithms the bound depends on the number of nodes in the metric space for a given diameter.

Application. For the uniform metric space (when all distances are unit size), our problem is equivalent to the Colored Packets with Deadlines problem. In this case our result improves the lower bound of [4]. Specifically, we improve their \(1 + \varOmega \big (\delta \big )\) lower bound to \(1 + \varOmega \big (\sqrt{\delta }\big )\) and match their upper bound for the uniform metric space.

Embedding Result. One of the techniques that we use for the lower bound is the following embedding. Let \(w(\mathrm{S})\) denote the weight of the star metric S (i.e., the sum of the weights of the edges of S). We prove that for any given metric space \(\mathrm{G}\) on nodes V and for any vertex \(v_0 \in V\) there exists a star metric \(\mathrm{S}\) with leaves V and an embedding \(f: \mathrm{G} \rightarrow \mathrm{S}\) from \(\mathrm{G}\) to \(\mathrm{S}\) (f depends on \(v_0)\) such that:

  1. 1.

    \(w(\mathrm{S}) = \mathrm{MST(G)}\).

  2. 2.

    The weight of every Steiner tree in S that contains \(v_0\) is not larger than the weight of the Steiner tree on the same nodes in G.

Note that this embedding is different from the usual embedding since we do not refer specifically to distances between vertices. Typically, an embedding is used to prove an upper bound by simplifying the metric space. In contrast, our embedding is used to prove a lower bound.

In order to prove the lower bound we first establish it for the star metric, and then extend it to general metric spaces. Note that a lower bound for a sub-graph is not a lower bound for the original graph. For example, a lower bound for an MST of a metric space G is not a lower bound for G since the algorithm may use additional edges to reduce the transition time.

2 The Model

We formally model the Dynamic Traveling Repair Problem with an arbitrary time window as follows. Let \(G = (V,w)\) be a given metric space where V is a set of n nodes and w is a distance function. Let \(s \in V\) be a given initial node. We are given an online sequence of requests for service. Each request is characterized by a pair \(([r_{i}, d_{i}], v_{i})\), where \(r_{i} \in N_{+}\) and \(d_{i} \in N_{+}\) are the respective arrival time and deadline of the request, and \(v_{i} \in V\) is a node in the metric space G. The time to traverse from node \(v_i\) to node \(v_j\) is \(w(v_i, v_j)\). For simplicity we assume that \(w(v_i, v_j)\) is integral. Serving a request at some node requires unit size service time. The goal is to serve as many requests as possible within their time windows \([r_i,d_i]\), starting from node s.

Note that when all \(r_i\) are equal to 0 and all \(d_i\) are equal to B and the service time is negligible the problem reduces to the well-known orienteering problem with budget B and a prize for each node which is equal to the number of requests at this node. That is, finding a path of total distance at most B that maximizes the prize of all visited nodes.

Let \(\mathrm {ALG}(\sigma )\), \(\mathrm {OPT}(\sigma )\) denote the respective throughput of the online, optimal offline algorithms with respect to a sequence \(\sigma \). We consider a maximization problem and hence \(\inf _{\sigma } \!\mathrm{OPT}(\sigma )/\mathrm{ALG}(\sigma ) \ge 1\).

3 Lower Bounds

3.1 Lower Bound for a Small Diameter Laxity Ratio (Case A and B)

In this section we consider Cases A and B. Let \(\delta = TSP(G) / L\). If \(\delta < 1\) (Case A), we show a strictly larger than 1 lower bound. Specifically, if \(\delta \le \frac{1}{256}\) we provide a lower bound of \(1 + \varOmega \big (\sqrt{\delta }\big )\). If \(\delta > 1\) (Case B) we can use requests with a laxity of \(256TSP(\mathrm{G})\) (i.e., \(\delta = \frac{1}{256}\)), and obtain a lower bound of 1.00054. Therefore, from now on we only consider Case A.

Lower Bound for a Star Metric. In this section we consider the case where the traveling time between nodes is represented by a star metric. This is also equivalent to the case where the traveling time from node i is \(w_{i}\).

The general idea is that the adversary creates many requests with a large deadline at node \(v_0\) at each time unit, and also blocks of fewer requests with close deadlines at other nodes. Any online algorithm must choose between serving many requests with a large deadline or traveling between many nodes and serving requests with close deadlines.

Recall that \(w(\mathrm{S})\) denotes the weight of the star metric S (i.e., the sum of the weights of the edges of S). Let \(w_i\) denote the weight of the edge incident to vertex \(v_i\). We define \(F = \sqrt{w(\mathrm{S})L}\). Let \(\delta = \frac{\mathrm{TSP(G)}}{L} = \frac{2w(\mathrm{S})}{L}\).

Theorem 1

No deterministic or randomized online algorithm can achieve a competitive ratio better than \(1 + \varOmega \big (\sqrt{\delta }\big )\) for any given star metric \(\mathrm S\) when \(\delta \le \frac{1}{256}\). Otherwise, if \(\delta > \frac{1}{256}\), the bound becomes 1.00054.

Proof

Let S be a given star metric with nodes \(V = \{v_0,\ldots ,v_{n-1}\}\). We will construct a sequence \(\sigma (\mathrm{S}, \mathrm {ALG})\) such that:

$$\frac{\mathrm {OPT}(\sigma )}{E(\mathrm {ALG}(\sigma ))} \ge min \left\{ \frac{3 - \delta }{3 - \frac{1}{8}\left( \sqrt{\delta /2}\right) }, \frac{3}{3 - \frac{1}{4}\left( \sqrt{\delta /2}\right) }, \frac{3}{3 - \frac{1}{48}\left( \sqrt{\delta /2}\right) } \right\} $$

Note that we can assume, without loss of generality, that \(\delta \le \frac{1}{256}\), since otherwise one may use requests with a laxity of \(256w(\mathrm{S})\) (i.e., \(\delta = \frac{1}{256}\)), and obtain a lower bound of 1.00054. Let \(v_0 \in V\) be a type A node and the rest of the nodes type B. Let type A requests and type B requests refer to requests at a type A node and type B node, respectively. We begin by describing the sequence \(\sigma (\mathrm{S}, \mathrm {ALG})\).

Sequence Structure: Recall that each request is characterized by a pair \(([r_{i}, d_{i}], v_{i})\), where \(r_{i} \in N_{+}\) and \(d_{i} \in N_{+}\) are the respective arrival time and deadline of the request, and \(v_{i}\) is a node in S. There are up to \(N=\frac{L}{3F}=\frac{1}{3}\sqrt{\frac{L}{w(\mathrm{S})}}\) blocks, where each block consists of 3F time units. Let \(t_i = 1 + 3(i-1)F\) denote the beginning time of block i. For each block i, where \(1 \le i \le N\), F requests located at various nodes arrive at the beginning of the block. Specifically, \(\frac{w_j}{w(\mathrm{S})-w_0}F\) type B requests \(([t_i,L+t_i],v_j)\), for each \(1 \le j \le n-1\), are released. A type A request \(([t,3L],v_0)\) is released at each time unit t in each block. Once the adversary stops the blocks, additional requests arrive (we call this the final event). The exact sequence is defined as follows:

  1. 1.

    \(i \leftarrow 1\).

  2. 2.

    Add block i.

  3. 3.

    If with probability at least 1/4 there are at least F / 2 unserved type B requests at the end of block i (denoted by Condition 1), then L requests \(([t_{i+1},L+t_{i+1}],v_1)\) are released and the sequence is terminated. Clearly, \(t_{i+1}\) is the time of the final event. Denote this by Termination Case 1.

  4. 4.

    Else, if with probability at least 1/4, at most 2F requests are served during block i (denoted by Condition 2), then 3L requests \(([t_{i+1},3L],v_0)\) are released and the sequence is terminated. Clearly, \(t_{i+1}\) is the time of the final event. Denote this by Termination Case 2.

  5. 5.

    Else, if \(i = N\) (there are N blocks, none of which satisfy Conditions 1 or 2) then 3L requests \(([L+1,3L],v_0)\) are released, and the sequence is terminated. Clearly, \(L+1\) is the time of the final event. Denote this by Termination Case 3.

  6. 6.

    Else (\(i < N\)) then \(i \leftarrow i + 1\), Goto 2.

We make the following observations: (i) Each block consists of 3F time units. Hence, if \(\mathrm {ALG}\) served at most 2F requests during a block, there must have been at least F idle time units. (ii) There are up to \(\frac{1}{3}\sqrt{\frac{L}{w(\mathrm{S})}}\) blocks and each block consists of 3\(\sqrt{w(\mathrm{S})L}\) time units. Hence, the time of the final event is at most \(L+1\). (iii) Exactly one type A request arrives at each time-slot until the final event. Hence, at most L type A requests arrive before (not including) the final event. (iv) During each block, exactly F type B requests arrive, which sum up to at most L / 3 type B requests before (not including) the final event.

Now we can analyze the competitive ratio of \(\sigma (\mathrm{S}, \mathrm {ALG})\). Consider the following possible sequences (according to the termination type):

  1. 1.

    Termination Case 1: Let Y denote the number of requests in the sequence. According to the observations, the sequence consists of at most L type A requests, and at most \(\frac{4}{3}L\) type B requests (L / 3 until the final event and L at the final event). Hence, \(Y \le L + \frac{4}{3}L \le 3L\).

    • We bound the performance of ALG: At time \(t_{i+1}\) there is a probability of at least 1/4 that \(\mathrm {ALG}\) has \(L + F/2\) unserved type B requests. Since type B requests have a laxity of L, \(\mathrm {ALG}\) can serve at most \(L+1\) of them, and must drop at least \(F/2 - 1\). The expected number of served requests is

      $$ E(\mathrm {ALG}(\sigma )) \le Y - \frac{1}{4}(F/2 - 1) = Y - \frac{1}{8}F + 1/4. $$
    • We bound the performance of an algorithm OPT \(^\prime \): \(\mathrm {OPT}^\prime \) serves the requests in three stages:

      • Type B requests that arrive before the final event: Recall that all type B requests in a block arrive at once in the beginning of the block. In each block \(\mathrm {OPT}^\prime \) first serves all requests at node \(v_{1}\), then all requests at node \(v_{2}\), and so on. It is clear that \(\mathrm {OPT}^\prime \) needs at most \(F+2w(\mathrm{S})\) time units to serve the requests (F for serving and \(2w(\mathrm{S})\) for traveling). \(\mathrm {OPT}^\prime \) serves the requests starting from the beginning of the block. Recall that \(L \ge 256w(\mathrm{S})\) and \(F = \sqrt{w(\mathrm{S})L}\). Therefore \(2F \ge 512w(\mathrm{S})\). Since the block’s size is 3F, there are enough time units. Moreover, since \(L \ge 256w(\mathrm{S})\), \(L \ge 16\sqrt{w(\mathrm{S})L} = 16F > F+2w(\mathrm{S})\). Hence, all requests can be served before their deadline.

      • Type B requests that arrive during the final event: The L requests \(([t_{i+1},\) \(L+t_{i+1}],v_1)\) that arrive during the final release time are served by \(\mathrm {OPT}^\prime \) consecutively from time \(t_{i+1}\). \(\mathrm {OPT}^\prime \) can serve L requests, except for one travel phase, and hence may lose at most \(2w(\mathrm{S})\) requests. According to our observations, the time of the final event \(t_{i+1}\) is at most \(L+1\). Hence, \(\mathrm {OPT}^\prime \) serves all type B requests until time unit 2L.

      • Type A requests: \(\mathrm {OPT}^\prime \) serves the L type A requests consecutively from time unit \(2L+1\). Since the deadlines are 3L, \(\mathrm {OPT}^\prime \) serves all type A requests.

      We conclude that \(\mathrm {OPT}(\sigma ) \ge \mathrm {OPT}^\prime (\sigma ) \ge Y - 2w(\mathrm{S})\).

    The competitive ratio is

    $$\begin{aligned} \frac{\mathrm {OPT}(\sigma )}{E(\mathrm {ALG}(\sigma ))} \ge&\frac{Y - 2w(\mathrm{S})}{Y - \frac{1}{8}F + 1/4} \ge \frac{3L - 2w(\mathrm{S})}{3L - \frac{1}{8}F + 1/4} \ge \frac{3L - 2w(\mathrm{S})}{3L - \frac{1}{8}\left( \sqrt{w(\mathrm{S})L}\right) + 1/4} = 1 + \varOmega \left( \sqrt{\delta }\right) . \end{aligned}$$

    Here the second inequality holds since \(Y \le 3L\), the number is above 1 and the numerator and the denominator increase by the same value.

  2. 2.

    Termination Case 2: The sequence consists of more than 3L type A requests, and all deadlines are at most 3L.

    • We bound the performance of ALG: The probability that \(\mathrm {ALG}\) was idle for F time units is at least 1/4. Hence, the expected number of served requests is \(E(\mathrm {ALG}(\sigma )) \le 3L - \frac{1}{4}F.\)

    • We bound the performance of OPT \(^\prime \): At each time unit until the final event, \(\mathrm {OPT}^\prime \) serves the type A request that arrived at that particular time unit. Consequently, from the final event until time unit 3L, \(\mathrm {OPT}^\prime \) serves the type A requests that arrived at the final event. Therefore, \(\mathrm {OPT}^\prime \) serves 3L type A requests, and so \(\mathrm {OPT}(\sigma ) \ge \mathrm {OPT}^\prime (\sigma ) \ge 3L\).

    The competitive ratio is

    $$ \frac{\mathrm {OPT}(\sigma )}{E(\mathrm {ALG}(\sigma ))} \ge \frac{3L}{3L - \frac{1}{4}F} = \frac{3L}{3L - \frac{1}{4}\left( \sqrt{w(\mathrm{S})L}\right) } = 1 + \varOmega \left( \sqrt{\delta }\right) . $$
  3. 3.

    Termination Case 3: the sequence consists of 3L type A requests, and all deadlines are at most 3L.

    • We bound the performance of ALG: Let \(U_{i}\) be the event that the number of unserved type B requests at the end of block i is less than F / 2. If \(U_{i}\) occurs, then let \(j_{k}\), \(1 \le k \le r\), be the type B nodes visited by \(\mathrm {ALG}\) in block i. At least F / 2 requests that arrived in this block have to be served (recall that F type B requests arrive at the beginning of each block). Therefore,

      $$ \frac{w_{j_{1}}}{w(\mathrm{S})-w_0}F + \frac{w_{j_{2}}}{w(\mathrm{S})-w_0}F + \cdots + \frac{w_{j_{r}}}{w(\mathrm{S})-w_{0}}F \ge F/2, $$

      and so

      $$ w_{j_{1}} + w_{j_{2}} + \cdots + w_{j_{r}} \ge \frac{w(\mathrm{S})-w_{0}}{2}. $$

      Let \(E_{i}\) be the event that more than 2F requests are served during block i. If event \(U_{i-1}\) and \(E_{i}\) occur, then there are at most 3F / 2 unserved type B requests in the beginning of block i (F arrived at the beginning of the block and there are at most F / 2 from the previous block) but more than 2F requests were served. Therefore, at least one type A request was served during the block. Combining the results, if \(U_{i}\), \(U_{i-1}\), and \(E_{i}\) occur then:

      • During block i at least \((w(\mathrm{S})-w_{0})/2\) time units were used for traveling between type B nodes.

      • A Type A request was served during the block.

      A block i is called good if the events \(U_{i}\), \(U_{i-1}\), and \(E_{i}\) occur. For any two (consecutive) good blocks the traveling cost is at least \((w(S)-w_{0})/2 + w_{0} \ge w(S)/2\). Since none of the blocks satisfy Condition 1 or 2, it follows that for all i such that \(\frac{1}{3}\sqrt{\frac{L}{w(\mathrm{S})}} \ge i \ge 1\) we have: \(\mathrm{Pr}[U_{i}] \ge 3/4, \mathrm{Pr}[U_{i-1}] \ge 3/4,\) and \(\mathrm{Pr}[E_{i}] \ge 3/4\). Therefore:

      $$\begin{aligned}&\mathrm{Pr}[U_{i} \cap U_{i-1} \cap E_{i}] = 1 - \mathrm{Pr}[\lnot (U_{i} \cap U_{i-1} \cap E_{i})] \\&\qquad = 1 - \mathrm{Pr}[\lnot U_{i} \cup \lnot U_{i-1} \cup \lnot E_{i}] \ge 1 - 1/4 - 1/4 - 1/4 = 1/4. \end{aligned}$$

      The sequence consists of \(\frac{1}{3}\sqrt{\frac{L}{w(\mathrm{S})}}\) blocks. Therefore, the expected number of good blocks is \(\frac{1}{4} \cdot \frac{1}{3}\sqrt{\frac{L}{w(\mathrm{S})}} = \frac{1}{12}\sqrt{\frac{L}{w(\mathrm{S})}}\) and of disjoint pairs of blocks is \(\frac{1}{24}\sqrt{\frac{L}{w(\mathrm{S})}}\). Consequently, the expected number of lost requests is at least \(\frac{1}{24}\sqrt{\frac{L}{w(\mathrm{S})}} \frac{w(\mathrm{S})}{2}\) and of served requests is:

      $$ E(\mathrm {ALG}(\sigma )) \le 3L - \frac{1}{48}w(\mathrm{S})\sqrt{\frac{L}{w(S)}} = 3L - \frac{1}{48}\left( \sqrt{w(\mathrm{S})L}\right) . $$
    • We bound the performance of OPT \(^\prime \): At each time unit until the final event, \(\mathrm {OPT}^\prime \) serves the type A request that arrived at the same time unit. Consequently, from the final event until time unit 3L, \(\mathrm {OPT}^\prime \) serves the type A requests that arrived at the final event. Therefore, \(\mathrm {OPT}^\prime \) serves 3 L type A requests, and so \(\mathrm {OPT}\ge \mathrm {OPT}^\prime \ge 3L\).

    The competitive ratio is

    $$ \frac{\mathrm {OPT}(\sigma )}{E(\mathrm {ALG}(\sigma ))} \ge \frac{3L}{3L - \frac{1}{48}\left( \sqrt{w(\mathrm{S})L}\right) } = 1 + \varOmega \left( \sqrt{\delta }\right) . $$

    Note that in all 3 cases we get \(1 + \varOmega \big (\sqrt{\delta }\big )\). This completes the proof.

   \(\blacksquare \)

The following straightforward corollary improves the lower bound of \(1 + \varOmega \big (C / L\big )\) from [4]. Recall that n is the number of nodes in the metric space.

Corollary 1

No deterministic or randomized online algorithm can achieve a competitive ratio better than \(1 + \varOmega \big (\sqrt{n / L}\big )\) when all traveling times takes one unit of time and \(L \ge 256n\). Otherwise, if \(L < 256n\), the bound becomes 1.00054.

Proof

Let S be a star metric such that the weight of each edge is equal to 1/2. Clearly, traveling between any two nodes requires one time unit and \(w(\mathrm{S}) = n/2\). Applying Theorem 1, we obtain the lower bound of \(1 + \varOmega \big (\sqrt{n / L}\big )\) (note that in this case \(\delta = n / L\)).    \(\blacksquare \)

Embedding of Metric Spaces. In this section we describe an embedding of a general metric space into a star metric with special properties. We begin by introducing some new definitions:

  • We define \(w(\mathrm{T}) = \sum \limits _{e \in V} w(e)\) for a rooted tree \(\mathrm{T} = (V,E)\), and let \(P_{\mathrm{T}}(v)\) denote the parent of node v in a rooted tree \(\mathrm{T}\).

  • Let \(\mathrm{S}\) be a star metric with a center c. We define \(w_\mathrm{S}(V) = \sum \limits _{v \in V} w(c, v) = \sum \limits _{v_i \in V} w_i\). It is clear that for a star \(\mathrm{S}\) with leaves V, \(w_\mathrm{S}(V) = w(\mathrm{S})\).

  • Let \(\mathrm{T}_\mathrm{G}(V)\) be the minimum weight connected tree that contains the set V (i.e., the minimum Steiner tree on these points) in the metric space G.

Recall that \(MST(\mathrm G)\) denotes the weight of the minimal spanning tree (MST) in the metric space G.

Theorem 2

For any given metric space \(\mathrm{G}\) on nodes V and for any vertex \(v_0 \in V\) there exists a star metric \(\mathrm{S}\) with leaves V and an embedding \(f: \mathrm{G} \rightarrow \mathrm{S}\) from \(\mathrm{G}\) to \(\mathrm{S}\) (f depends on \(v_0)\) such that:

  1. 1.

    Property 1: \(w(\mathrm{S}) = MST(\mathrm{G})\).

  2. 2.

    Property 2: For every \(V' \subseteq V\) such that \(v_0 \in V'\), \(w(\mathrm{T}_\mathrm{G}(V')) \ge w_\mathrm{S}(V').\)

Proof

We prove the theorem by describing a star metric that satisfies the required properties. Let G be a given metric space on nodes V with a vertex \(v_0 \in V\). Let T be the MST for G created by applying Prims’ algorithm with the root \(v_0\). Let S be a star metric with leaves V such that for each \(u \in V\), \(w_u = w(u, P_{\mathrm{T}}(u))\). Clearly, \(w_{v_0} = 0\). We prove that S and \(v_0\) satisfy the theorem’s properties:

Property 1: Clearly, \(w(\mathrm{S}) = w(\mathrm{T})\), and since T is a MST for G, \(w(\mathrm{S}) = w(\mathrm{T}) = \mathrm{MST(G)}\).

Property 2: Assume by a contradiction that there exists \(V' = \{v_0, v_{i_1},\ldots , v_{i_r-1}\} \subseteq V\) such that \(w(\mathrm{T}_\mathrm{G}(V')) < w_S(V') = \sum _{j=1}^{r-1} w(v_{i_j}, P_\mathrm{T}(v_{i_j})).\)

Let \(V'' = \{v_0, v_{i_1},\ldots , v_{i_r-1},\ldots , v_{i_k}\}\) be the vertices of \(T_\mathrm{G}(V')\) (note that \(V' \subseteq V''\)). Consider the following process. Let \(T' = T_\mathrm{G}(V')\). Run Prim’s algorithm from node \(v_0\). Each time Prim’s adds a new node not in \(T'\), we add Prim’s edge to \(T'\). Note that Prim starts from node \(v_0 \in T_\mathrm{G}(V')\) and we add each node not in \(T'\). Hence, when Prim’s algorithm finishes, \(T'\) is a tree on nodes V. Moreover, \(T'\) is T where edges \(\big (v_{i_1}, P_\mathrm{T}(v_{i_1})\big ),\ldots , \big (v_{i_{k}}, P_\mathrm{T}(v_{i_{k}})\big )\) were replaced by the edges of \(T_\mathrm{G}(V')\). Since we assumed that \(w(\mathrm{T}_\mathrm{G}(V')) < \sum _{j=1}^{r-1} w(v_{i_j}, P_\mathrm{T}(v_{i_j}))\), and clearly \(\sum _{j=1}^{r-1} w(v_{i_j}, P_\mathrm{T}(v_{i_j})) \le \sum _{j=1}^{k} w(v_{i_j}, P_\mathrm{T}(v_{i_j}))\), we have \(w(T') < w(T)\). This is a contradiction since T is an MST.    \(\blacksquare \)

Lower Bound for a General Metric Space. In this section we consider the case where the traveling time between nodes is represented by a metric space G. Note that a lower bound for a star metric space does not imply a lower bound for a general metric space. Recall that \(\delta = \mathrm{TSP(G) }/ L < 1\).

We use the embedding from Theorem 2 to prove a \(1 + \varOmega \big (\sqrt{\delta }\big )\) lower bound.

Theorem 3

No deterministic or randomized online algorithm can achieve a competitive ratio better than \(1 + \varOmega \big (\sqrt{\delta }\big )\) for any given metric space \(\mathrm{G}\), when \(\delta \le \frac{1}{256}\). Otherwise, if \(\delta > \frac{1}{256}\), the bound becomes 1.00054.

3.2 Lower Bound for a Large Diameter Laxity Ratio (Case C)

In this section we consider the case where \(L < \varDelta (G) / 2\) (recall that \(\varDelta (G)\) is the diameter and L is the laxity), and we show that the competitive ratio of any deterministic algorithm is unbounded.

Theorem 4

No deterministic online algorithm can achieve a bounded competitive ratio for any metric space in which \(L < \varDelta (G) / 2\).

Proof

Let G be any metric space. Every \(\varDelta (G) + 1\) units of time we introduce a request with a laxity of L to a node which is at a distance of at least \(\varDelta (G) / 2\) from the current location of the online algorithm (note that there is always such a node). It is clear that the algorithm can not serve any requests while \(\mathrm{OPT}\) can serve all the requests.    \(\blacksquare \)

4 Upper Bounds

4.1 Asymptotically Optimal Algorithm for Case A

In this section we design a deterministic online algorithm, for a general metric space. The algorithm achieves a competitive ratio of \(1 + o(1)\) when the minimum laxity of the requests is asymptotically larger than the weight of the TSP (as shown in the previous sections, this is essential).

The algorithm is a natural extension of the BG algorithm from [4]. Our algorithm, which we call TSP-EDF, formally described in Fig. 1, works in phases of \(K = \sqrt{\mathrm{TSP(G)}L}\) time units. In each phase the algorithm serves requests node by node. The order of the nodes is determined by the minimum TSP or an approximation. The algorithm achieves a competitive ratio of \(1 + O\big (\sqrt{\mathrm{TSP(G)}/ L}\big )\) for \(L > \mathrm{10TSP(G)}\).

Fig. 1.
figure 1

Algorithm TSP-EDF.

Theorem 5

The algorithm TSP-EDF attains a competitive ratio of \(1 + O\big (\sqrt{\mathrm{TSP(G)} / L}\big )\).

4.2 Constant Approximation Algorithm for Case B

In this section we design a deterministic online algorithm, for a general metric space where \(L > 9\varDelta (G)\) (recall that \(\varDelta (G)\) is the diameter of G). The algorithm achieves a constant competitive ratio. As shown in the previous section, no online algorithm can achieves a competitive ratio better 1.00054. A more precise analysis can replace \(L > 9\varDelta (G)\) with \(L > (2 + \epsilon )\varDelta (G)\) for any \(\epsilon > 0\) and the approximation becomes \(O(\frac{1}{\epsilon })\).

The algorithm which we call ORIENT-WINDOW (Fig. 2) combines the following ideas.

  • The algorithm works in phase of \(K = 3\varDelta (G)\). In each phase the algorithm serves only requests that arrived in the previous phases, and will not expired during the phase. Due to this perturbation we lose a constant factor.

  • The decision which requests will be served in a phase ignore their deadlines. Due to this violation of EDF we lose a constant factor.

  • In each phase the algorithm serves requests node by node. The order of the nodes is determined by solving an orienteering problem. Since a constant approximation algorithm is known to the orienteering problem, we lose a constant factor.

Fig. 2.
figure 2

Algorithm ORIENT-WINDOW

Theorem 6

The algorithm ORIENT-WINDOW attains a competitive ratio of O(1).