5
Information Processing Letters 75 (2000) 225–229 Polynomial time algorithms for some minimum latency problems Bang Ye Wu Chung-Shan Institute of Science and Technology, PO Box 90008-6-8, Lung-Tan, Taiwan Received 13 August 1999; received in revised form 3 April 2000 Communicated by F.Y.L. Chin Abstract Given a graph and an origin, the minimum weighted latency problem looks for a tour starting at the origin and visiting all the vertices so as to minimize the sum of the latencies of the vertices multiplied by their weights, in which the latency of a vertex is the distance from the origin to the first visit of the vertex on the tour. In this paper, we show that the minimum weighted latency problem on some graphs can be solved in polynomial time by dynamic programming. The dynamic programming algorithm generalizes the previous results in the literature and includes some other cases. We also give an O(n 2 ) time algorithm for finding the starting vertex to minimize the latency on a path, and an O(n 4 ) time algorithm for the minimum latency problem with multiple repairmen on a path. 2000 Elsevier Science B.V. All rights reserved. Keywords: Algorithms; Minimum latency problem; Dynamic programming 1. Introduction Consider a repairman facing a set of requests, each of which is a vertex of a graph. The length of an edge on the graph represents the time for traveling the edge. The repairman must find a tour to visit the vertices so as to minimize the total time the requests wait before being visited. (Assume that a request is serviced instantaneously when visited.) This is the minimum latency problem, and also known in the literature as the deliverary problem or the traveling repairman problem. The minimum latency problem, abbreviated as MLP, has a reputation for being much harder than the TSP. Polynomial time algorithms for the optimal solu- tions are only known for the cases when the graph is E-mail address: [email protected] (B.Y. Wu). a path [1], an edge-unweighted tree [8], a tree with di- ameter 3 [3], or a tree with a constant number of leaves [7]. For the problem of edge-weighted trees or even caterpillars (paths with edges sticking out), it is still open whether it is NP-hard. For the MLP on a metric space, it is NP-hard and also MAX-SNP-hard [3]. The first constant ratio approximation algorithm appeared in [3]. Blum et al. [3] gave a 144-approximation al- gorithm for the metric case and an 8-approximation for the trees. Both ratios were then improved to 21.55 and 3.59 respectively by Goemans and Kleinberg [4]. As stated in [2], the ratio 21.55 can be further im- proved to 10.78 by Grag’s result of a 3-approximation algorithm for the minimum tree spanning k nodes [5]. Arora and Karakostas gave quasipolynomial time ap- proximation schemes for the cases of trees and Euclid- ean spaces [2]. Koutsoupias, Papadimitriou, and Yan- 0020-0190/00/$ – see front matter 2000 Elsevier Science B.V. All rights reserved. PII:S0020-0190(00)00102-2

Polynomial time algorithms for some minimum latency problems

Embed Size (px)

Citation preview

Information Processing Letters 75 (2000) 225–229

Polynomial time algorithmsfor some minimum latency problems

Bang Ye WuChung-Shan Institute of Science and Technology, PO Box 90008-6-8, Lung-Tan, Taiwan

Received 13 August 1999; received in revised form 3 April 2000Communicated by F.Y.L. Chin

Abstract

Given a graph and an origin, the minimum weighted latency problem looks for a tour starting at the origin and visiting all thevertices so as to minimize the sum of the latencies of the vertices multiplied by their weights, in which the latency of a vertex isthe distance from the origin to the first visit of the vertex on the tour. In this paper, we show that the minimum weighted latencyproblem on some graphs can be solved in polynomial time by dynamic programming. The dynamic programming algorithmgeneralizes the previous results in the literature and includes some other cases. We also give an O(n2) time algorithm forfinding the starting vertex to minimize the latency on a path, and an O(n4) time algorithm for the minimum latency problemwith multiple repairmen on a path. 2000 Elsevier Science B.V. All rights reserved.

Keywords:Algorithms; Minimum latency problem; Dynamic programming

1. Introduction

Consider a repairman facing a set of requests, eachof which is a vertex of a graph. The length of an edgeon the graph represents the time for traveling the edge.The repairman must find a tour to visit the verticesso as to minimize the total time the requests waitbefore being visited. (Assume that a request is servicedinstantaneously when visited.) This is theminimumlatency problem, and also known in the literature asthe deliverary problemor the traveling repairmanproblem.

The minimum latency problem, abbreviated asMLP, has a reputation for being much harder than theTSP. Polynomial time algorithms for the optimal solu-tions are only known for the cases when the graph is

E-mail address:[email protected] (B.Y. Wu).

a path [1], an edge-unweighted tree [8], a tree with di-ameter 3 [3], or a tree with a constant number of leaves[7]. For the problem of edge-weighted trees or evencaterpillars (paths with edges sticking out), it is stillopen whether it is NP-hard. For the MLP on a metricspace, it is NP-hard and also MAX-SNP-hard [3]. Thefirst constant ratio approximation algorithm appearedin [3]. Blum et al. [3] gave a 144-approximation al-gorithm for the metric case and an 8-approximationfor the trees. Both ratios were then improved to 21.55and 3.59 respectively by Goemans and Kleinberg [4].As stated in [2], the ratio 21.55 can be further im-proved to 10.78 by Grag’s result of a 3-approximationalgorithm for the minimum tree spanningk nodes [5].Arora and Karakostas gave quasipolynomial time ap-proximation schemes for the cases of trees and Euclid-ean spaces [2]. Koutsoupias, Papadimitriou, and Yan-

0020-0190/00/$ – see front matter 2000 Elsevier Science B.V. All rights reserved.PII: S0020-0190(00)00102-2

226 B.Y. Wu / Information Processing Letters 75 (2000) 225–229

nakakis gave a 1.662-approximation algorithm for anedge-unweighted graph [7].

The minimum weighted latency problem, abbrevi-ated as MWLP, is the vertex-weighted generalizationof the MLP, in which the goal is to minimize thesum of the latencies of the vertices multiplied by theirweights. In this paper, we show that the MWLP onsome graphs can be solved in polynomial time by dy-namic programming. The dynamic programming gen-eralizes the previous results in the literature and in-cludes some other cases not been considered previ-ously.

We also consider two related problems of theMWLP on paths. The optimal repairman origin prob-lem is to find an origin for the repairman such that theminimum latency starting at the origin is as small aspossible. Thek-MWLP is to find k subtours for thegiven k origins such that the total latency of the ver-tices is minimum. We show that the optimal repairmanorigin problem on a path can be solved in O(n2) time,and thek-MWLP on a path can be solved in O(n3)

time for k = 2 and in O(n4) time fork > 2.

2. Preliminaries

In this paper, a graph is a simple and connectedgraph. The weight of a vertex and the length of anedge are nonnegative. Throughout this paper, the inputgraph isG, andn is the number of nodes of graphG.The vertex weight function ofG is w, and the edgelenth function isd . An origin is a vertex ofG. A tour isa route from the origin and visiting each vertex at leastonce. A subtour is a partial or a complete tour startingat the origin. LetH be a subgraph or a subtour. Theset of vertices ofH is denoted byV (H), andw(H)denotes the total weight of the vertices inV (H). Foru,v ∈ V (G), we usedG(u, v) to denote the length ofthe shortest path betweenu andv onG. For a subtourP , dP (u, v) denotes the distance from the first visit ofu to the first visit ofv on P , andd(P ) denotes thelength ofP .

Definition 1. LetP be a subtour starting ats on graphG. For a vertexv visited by P , the latency ofv isdefined asdP (s, v), which is the distance from theorigin to the first visit ofv onP . The weighted latencyof a tourP isL(P)=∑v∈V (P ) w(v)dP (s, v).

Now, we define the minimum weighted latencyproblem formally.

Definition 2. Given a graphG and an origins, theminimum weighted latency problem is to find a tourP starting ats such that the weighted latency ofP isminimum.

Definition 3. Let P be a subtour on graphG. Wedefinec(G,P )= L(P)+ (w(G)−w(P))d(P ).

WhenP is a tour,c(G,P ) is exactly the weightedlatency ofP onG. It should also be noted thatc(G,P )is not determined only by the local structure ofP . Italso depends on the weights of the nodes which havenot been visited. If we change the weight of only onevertex, the path minimizing the value of functioncmay change quit a lot. It is believed that the non-localproperty make the problem so hard to solve.

Definition 4. Given a graphG, theoptimal repairmanorigin problemis to find a vertexs onG such that theminimum weighted latency with origins is minimumamong all possible origins.

When there are multiple repairmen, a vertex may bevisited by any repairman, and the latency of the vertexis the minimal one among all subtours containing it.

Definition 5. Given a graphG and k not necessar-ily distinct origins, thek-minimum weighted latencyproblem is to find k subtours starting at thek ori-gins respectively such that the total weighted latencysummed over all vertices is minimum.

Since the latency of a vertex is infinite if it is notvisited by any subtour, each vertex of the graph isvisited by at least one subtour.

3. A dynamic programming algorithm for MWLP

In this section, we show that the MWLP on somegraphs can be solved in polynomial time by dynamicprogramming. The main idea here is that if a graph canbesplit into some subgraphs and we can determine theorder of the vertices within each subgraph on the globeoptimal tour, then the optimal tour can be computed

B.Y. Wu / Information Processing Letters 75 (2000) 225–229 227

by dynamic programming. The simplest case is a path.Given a path and an origin, the path can be split at theorigin into two subpaths. Obviously the order of thevertices within each subpath is fixed. We now formallydefine the splitting of a graph, in which a cut node is anode whose deletion makes the graph disconnected.

Definition 6. Let v be a cut node of a connected graphG, andG1, G2 be connected subgraphs ofG. We saythatG is split intoG1 andG2 atv if V (G1)∩V (G2)={v} and the union ofG1 andG2 isG.

The splitting of a graph into more than two sub-graphs is defined recursively. That is, ifG is split intoG1 andG2 at nodev1, andG1 is further split intoG3andG4 at nodev2. We say thatG is split intoG2,G3,andG4 at nodesv1 and v2, in which v1 and v2 arenot necessarily distinct. For a subgraphH split froma graph atv, sincev is a cut node,v will be visitedbefore any node ofH if H does not contain the origin.Therefore, although the subgraphs split from a graphshare some common nodes, they can be considered asdisjoint.

Theorem 1. Suppose that a graphG can be splitinto k subgraphs at some cut nodes. If the order ofthe nodes within each subgraph on the globe optimaltour can be determined inO(f (n)) time, then theMWLP onG can be solved by dynamic programmingin O(k2((n/k)+ 1)k + f (n)) time.

Proof. Since the order of the nodes within eachsubgraph on the globe optimal tour is fixed, the state ofthe subtour visitingm nodes can be represented by ak-component integer vectorl = (l1, l2, . . . , lk) and anintegerr 6 k, in which the sum of thek components ofl is m. Each componentli indicates how many nodesin ith subgraph have been visited and the integerr

indicates which subgraph the subtour stops at.DefineT (l, r)=minP {c(G,P )}, in which the min-

imum is taken among all subtours whose states arerepresented byl andr. Let vi be the last visited nodeof ith subgraph in each subtour whose state is repre-sented byl, andu be the node to be visited next inrthsubgraph. Assume thatl′ is the vector obtained by in-creasing therth component ofl by one. The functionT (l′, r) can be computed by the following dynamicprogramming formula:

T (l′, r)= min

16i6k{T (l, i)+ (w(G)−w(V (l)))dG(vi, u)},

whereV (l) is the set of the vertices visited by anysubtour whose state is represented byl. Here weassume thatu is not the origin and thatvr is not the lastnode in therth subgraph. Also, we defineT (l, i)=∞if ith component ofl is zero.

The minimum weighted latency is equal tomin16i6k{T (l∗, i)}, in which l∗ is the vector repre-senting the entire vertex set. Since there are at most((n/k) + 1)k such vectors, the number of states isk((n/k)+ 1)k. The time complexity follows since theT function can be computed in O(k) time for eachstate. 2

Although the dynamic programming seems easy toobtain, there is something that should be noticed. Ifwe defineT ′(l, r) as the minimum weighted latencyamong all subtours visitingV (l), it is impossible tocomputeT ′(l′, r) by a similar formula because theoptimal subtour visitingV (l′)may contain none of theoptimal subtours visitingV (l). It is the reason why wedefineC(G,P) in such a way.

To utilize Theorem 1, we need to know the kinds ofsubgraphs whose visiting order on the globe optimaltour can be determined locally. The obvious case is apath. For a tree with onlyk leaves, we can split thetree intok paths at the origin and nodes with degreeslarger than 2. It is easy to see that the visiting orderof the vertices within each path is fixed. Therefore,the MWLP on such a graph can be solved in O(nk)time for any constantk. In the following, we show thatthe visiting order of the vertices of astar can be alsodetermined locally.

A star is a tree with only one internal node. Withoutloss of generality, we assume the internal node tobe the first visited vertex. When the vertices areunweighted, it is easy to determine the visiting orderof the vertices: a leaf connected by a shorter edgewill be visited earlier. Therefore, by Theorem 1, wemay conclude that the (unweighted) minimum latencyproblem on a tree with onlyk internal nodes canbe solved in O(nk + n logn) time, in which we takeO(n logn) time to determine the visiting order of thenodes within each star by sorting. This result alsogeneralizes the case for a tree with diameter 3 in [3].

228 B.Y. Wu / Information Processing Letters 75 (2000) 225–229

But it is not so obvious when the vertices areweighted. A leaf connected by a longer edge may bevisited earlier due to its heavy weight. The key point tosolve the problem is the following property. Note thata star split from a graph at its internal node impliesthat the external nodes of the star are also external inthe original graph.

Lemma 2. AssumeH to be a star split from graphGat the internal nodep of H . For any leavesi and jof H , i will be visited beforej on the optimal tourif w(i)/d(p, i) > w(j)/d(p, j), and the tie can bebroken arbitrarily.

Proof. Suppose thatj is visited beforei in the optimaltourP . The tourP can be written asX,p, j,p,Y,p, i,p,Z, in whichX, Y andZ are routes. First, we showthatw(j)/d(p, j) > 2w(Y )/d(Y ) if Y is not empty.Otherwise, letP ′ =X,p,Y,p, j,p, i,p,Z. Since thelatency does not change for any node not inV (Y ) ∪{j }, we have

L(P ′)−L(P)=w(j)d(Y )−w(Y )(2d(p, j))< 0.

It is a contradiction to the optimality ofP .Similarly, 2w(Y )/d(Y ) > w(i)/d(p, i) if Y is not

empty. Consequently, ifj is visited beforei and Yis not empty, thenw(j)/d(p, j) > w(i)/d(p, i). Thecase whenY is empty can be shown similarly, and theproof is completed. 2

By Lemma 2, the visiting order of the leaves canbe determined by a sorting procedure. We have thefollowing corollary.

Corollary 3. AssumeH to be a star split from graphG at the internal node ofH . The visiting order of theleaves ofH in the optimal tour can be determined inO(n logn) time.

By taking any vertex as a subgraph split from agraph at the vertex, a graph can be split at any vertex.That is, any vertex may be thought as a cut vertexcutting itself from the graph. In this way, Theorem 1provides a method for solving the MWLP on anygraph, even for the complete graph, in O(n22n) time.Essentially the method is the same as that providedby Held and Karp for solving the TSP by dynamicprogramming [6]. Furthermore a graph withk internal

nodes can be split intok stars, where each star isformed by one internal node and the external nodes ofG connected with it. By Theorem 1 and Lemma 2, wehave the following corollary, which includes the caseof a tree withk internal nodes.

Corollary 4. The MWLP on a graph withk internalvertices can be solved inO(k2((n/k)+ 1)k + n logn)time.

As a corollary the MWLP on any tree can be solvedin O(n23n/2) time since a tree can be split in at mostn/2 paths and stars at the nodes with degree morethan 2.

4. The origin problem and thek-MWLP on a path

We now consider the optimal repairman originproblem on a path. The optimal origin problem can besolved in O(n3) by trying all possible origins. We shallshow that the problem can be solved in O(n2) time.To solve the origin problem by dynamic programming,one may try to compute the latency with origins1 fromthe latency with another origins2. But such an idea ishard to achieve because the structures of the optimaltours with different origins may differ quit a lot. Themain idea here is to compute the latency in the reverseorder. The reason is that the optimal tour may start atany vertex but it must end at one of the two endpointsof the path. The result is given in the following:

Theorem 5. The optimal repairman origin problemon ann-vertex path can be solved inO(n2) time.

Proof. Let the input pathG = (1,2, . . . , n). ByU(i, j) we denote the vertex set{1, . . . , i}∪ {j, . . . , n}for i < j . Assume that vertex 1 is the endpoint of theoptimal tour. The other case can be computed simi-larly. Let P be the optimal tour starting at vertexsand ending at vertex 1. We may cutP into a subtourand asuffix subtour. A subtour on a path visits verticeswithin an interval coverings and stops at the left orthe right endpoint of the interval. Leti and j be thetwo endpoints of the interval, in whichi < j . The suf-fix subtour either starts ati and visitsU(i, j + 1), orstarts atj and visitsU(i − 1, j). Note that the suffixsubtour maypass throughthe vertices in{i, . . . , j } but

B.Y. Wu / Information Processing Letters 75 (2000) 225–229 229

it does not visit them since these vertices have beenvisited by the subtour. LetT (i, j,0) andT (i, j,1) bethe latencies of the optimal suffix subtours visiting allvertices inU(i, j) and starting ati andj respectively.For i > 1,

T (i, j,0)

=min{T (i − 1, j,0)+w(U(i − 1, j)

)d(i − 1, i),

T (i − 1, j,1)+w(U(i − 1, j))dG(j, i)

}.

Similarly, for j < n+ 1,

T (i, j,1)

=min{T (i, j + 1,0)+w(U(i, j + 1)

)dG(i, j),

T (i, j + 1,1)+w(U(i, j + 1))d(j + 1, j)

}.

The initial conditions are given byT (1, n + 1,0) =0, andT (i, n + 1,1) = ∞ for any i. The minimumlatency with the optimal origin is the minimum amongT (i, i + 1,0) andT (i, i + 1,1) for all i. Since thereare O(n2) intervals, the time complexity is O(n2). 2

Now we turn to the MWLP withk repairmen ona path. Given ann-vertex path andk not necessarilydistinct origins, the problem is to findk subtours tovisit the vertices with minimum total weighted latency.Since a vertex may be visited by any subtour, it iseasy to see that the subtours never overlap except thattwo subtours may start at the same origin. Also, ifmore than two repairmen start at one vertex, only twoof them are useful. Therefore, it suffices to considerthe case that the given origins are distinct. In thefollowing, we show that the problem can be solved inO(n4) time.

Theorem 6. Thek-MWLP on a path can be solved inO(n3) time fork = 2, and inO(n4) time fork > 2.

Proof. Let the input pathG= (1,2, . . . , n). By inter-val I (i, j), we denote the subpath(i, i + 1, . . . , j ) fori 6 j . For an intervalI (i, j), we defineA(i, j) as theminimum total weighted latency of the vertices in theinterval and visited by the repairmen whose origins arewithin the interval.

Initially, we computeA(i, j) for each intervalI (i, j) containing only one origin. The number of such

intervals is O(n2) for k > 2 and O(n) for k = 2. Sinceit takes O(n2) time to compute the latency for each in-terval, this step takes O(n4) time fork > 2, and O(n3)

time fork = 2.Let the given origins bes1, s2, . . . , sk in the ascend-

ing order. Forsi 6 m < si+1 and 1< i < k, we haveA(1,m)=minsi−16j<si {A(1, j)+ A(j + 1,m)}, andA(1, n) = minsk−16j<sk {A(1, j)+ A(j + 1, n)}. Ob-viously, the total time complexity is dominated by theprevious step, and the proof is completed.2

For thek-MWLP on a cycle, the minimum latencycan be computed similarly. But there are O(n2) inter-vals even whenk = 2. Therefore, we have the follow-ing corollary:

Corollary 7. Thek-MWLP on a cycle can be solvedin O(n4) time.

References

[1] F. Afrati, S. Cosmadakis, C. Papadimitriou, G. Papageorgiou,N. Papakostantinou, The complexity of the traveling repairmanproblem, Informatique Theorique et Applications (TheoreticalInformatics and Applications) 20 (1) (1986) 79–87.

[2] S. Arora, G. Karakostas, Approximation schemes for minimumlatency problems, in: Proc. 31st ACM Symposium on theTheory of Computing (STOC’99), 1999, pp. 688–693.

[3] A. Blum, P. Chalasani, D. Coppersmith, B. Pulleyblank,P. Raghavan, M. Sudan, The minimum latency problem, in:Proc. 26th ACM Symposium on the Theory of Computing(STOC’94), 1994, pp. 163–171.

[4] M. Goemans, J. Kleinberg, An improved approximation ratiofor the minimum latency problem, in: Proc. 7th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’96), 1996,pp. 152–158.

[5] N. Grag, A 3-approximation for the minimum tree spanningk vertices, in: Proc. 37th IEEE Symposium on Foundations ofComputer Science (FOCS’96), 1996, pp. 302–309.

[6] M. Held, R. Karp, A dynamic programming approach tosequencing problems, SIAM J. Appl. Math. 10 (1) (1962) 196–210.

[7] E. Koutsoupias, C. Papadimitriou, M. Yannakakis, Searching afixed graph, in: Proc. 23rd Colloquium on Automata, Languagesand Programming, Lecture Notes in Comput. Sci., Vol. 1099,1996, pp. 280–289.

[8] E. Minieka, The delivery man problem on a tree network, Ann.Oper. Res. 18 (1989) 261–266.