a note on the traveling repairman problem

5
A Note on the Traveling Repairman Problem Alfredo Garcı ´a, Pedro Jodra ´ , Javier Tejel Dpto. Me ´todos Estadı´sticos, Facultad de Ciencias, Universidad de Zaragoza, 50009 Zaragoza, Spain Given a finite set of N nodes and the time required for traveling among nodes, in the traveling repairman prob- lem, we seek a route that minimizes the sums of the delays for reaching each node. In this note, we present a linear algorithm for solving the traveling repairman prob- lem when the underlying graph is a path, improving the (N 2 ) time and space complexity of the previously best algorithm for this problem. We also provide a linear algorithm for solving the walk problem with deadlines (WPD) on paths. © 2002 Wiley Periodicals, Inc. Keywords: traveling repairman problem; minimum latency problem; dynamic programming; Monge matrices; computational complexity 1. INTRODUCTION Suppose that we have a graph with N nodes, in each one there is a machine that has to be repaired, and there is only one repairman. We are given the time required by the repairman to travel among nodes. In the traveling repairman problem (TRP), also known as the delivery man problem or the minimum latency problem, the objective is to find a route T that minimizes the total waiting time of all the machines. The service time is assumed to be insignificant or, equivalently, the same for all the machines. If the re- pairman is initially located at a distinguished starting node s , then the TRP consists in finding a route T that minimizes ¥ i 1 N l i , where l i denotes the waiting time of machine i , that is, the time elapsed until the first visit of node i through T. When a weight w i 0 is assigned to each node, the optimal route must minimize ¥ i 1 N w i l i . This problem is known as the weighted traveling repairman problem (WTRP). These weights can be interpreted as the number of machines in each node (or the significance of each ma- chine). Another interesting interpretation of the WTRP is the following: Suppose that we want to find an item of information that is on some node of a network, but we can only navigate the net following its edges and we know the cost of traversing each edge. Then, interpreting w i as the probability that the information sought is at node i , the solution of WTRP is the route that minimizes the expected cost of finding the item. The TRP is well known to be NP-hard for a general graph, and only in a few particular cases, polynomial algo- rithms have been found, such as the TRP on a path (Afrati et al. [1]) or on a tree with unit edge weights (Minieka [7]). Related results can be found in [1, 3, 8] when deadlines, release times, or service times are assigned to each node. Using a simple dynamic programming formulation, Af- rati et al. [1] gave a ( N 2 ) time and space algorithm for the TRP when the underlying graph is a path with N nodes. In this paper, we will provide a linear algorithm for the WTRP on paths, by reformulating the problem in a different dy- namic programming way. In Section 2, we will prove that the WTRP on paths can be reformulated as a problem of calculating the minima in a Monge path-decomposable tri- dimensional array, so that the linear algorithm given in [5] can be used for solving this problem. For other problems where the concepts of Monge arrays (or totally monotone arrays) are used for improving the efficiency of algorithms based on dynamic programming, see [2, 4, 6, 9]. In the same notable paper [1], a ( N 2 ) algorithm was provided for the problem (WPD) of finding a walk through all nodes of a path such that each node i is visited before a given deadline t ( i ). Such a walk is called feasible. The same authors showed that solving TRP is NP-hard even on paths, if only feasible walks are allowed. In Section 3, we will prove that, on paths, the WPD can be reformulated in a similar way to the one used in Section 2, and we will present a linear algorithm for this problem. 2. THE WTRP ON A PATH Let { p m , p m1 ,..., p 1 , s , q n , q n1 ,..., q 1 } be the nodes of the path graph from one end of the path to the other, s being the starting node. We will denote w( p j ) 0 and w( q k ) 0 as the associated weights of nodes p j and q k , respectively. The travel time between two arbitrary nodes through the path graph will be denoted by d( , ) 0. Any d( , ) can be calculated from the d( s , ) values, so we only need ( m n) input data. If T is a walk starting at s and visiting all the nodes, the waiting time for the first visit of a node through T will be denoted by d T ( s , ). The Received July 2000; accepted April 2002 Correspondence to: A. Garcı ´a; e-mail: [email protected] Published online 00 Month 2002 in Wiley InterScience (www.interscience.wiley.com). DOI 10.1002/net.10031 © 2002 Wiley Periodicals, Inc. NETWORKS, Vol. 40(1), 27–31 2002

Upload: alfredo-garcia

Post on 15-Jun-2016

224 views

Category:

Documents


1 download

TRANSCRIPT

A Note on the Traveling Repairman Problem

Alfredo Garcıa, Pedro Jodra, Javier TejelDpto. Metodos Estadısticos, Facultad de Ciencias, Universidad de Zaragoza, 50009 Zaragoza, Spain

Given a finite set of N nodes and the time required fortraveling among nodes, in the traveling repairman prob-lem, we seek a route that minimizes the sums of thedelays for reaching each node. In this note, we present alinear algorithm for solving the traveling repairman prob-lem when the underlying graph is a path, improving the�(N2) time and space complexity of the previously bestalgorithm for this problem. We also provide a linearalgorithm for solving the walk problem with deadlines(WPD) on paths. © 2002 Wiley Periodicals, Inc.

Keywords: traveling repairman problem; minimum latencyproblem; dynamic programming; Monge matrices; computationalcomplexity

1. INTRODUCTION

Suppose that we have a graph with N nodes, in each onethere is a machine that has to be repaired, and there is onlyone repairman. We are given the time required by therepairman to travel among nodes. In the traveling repairmanproblem (TRP), also known as the delivery man problem orthe minimum latency problem, the objective is to find aroute T that minimizes the total waiting time of all themachines. The service time is assumed to be insignificantor, equivalently, the same for all the machines. If the re-pairman is initially located at a distinguished starting nodes, then the TRP consists in finding a route T that minimizes¥i�1

N li, where li denotes the waiting time of machine i, thatis, the time elapsed until the first visit of node i through T.

When a weight wi � 0 is assigned to each node, theoptimal route must minimize ¥i�1

N wili. This problem isknown as the weighted traveling repairman problem(WTRP). These weights can be interpreted as the number ofmachines in each node (or the significance of each ma-chine). Another interesting interpretation of the WTRP isthe following: Suppose that we want to find an item ofinformation that is on some node of a network, but we canonly navigate the net following its edges and we know thecost of traversing each edge. Then, interpreting wi as the

probability that the information sought is at node i, thesolution of WTRP is the route that minimizes the expectedcost of finding the item.

The TRP is well known to be NP-hard for a generalgraph, and only in a few particular cases, polynomial algo-rithms have been found, such as the TRP on a path (Afratiet al. [1]) or on a tree with unit edge weights (Minieka [7]).Related results can be found in [1, 3, 8] when deadlines,release times, or service times are assigned to each node.

Using a simple dynamic programming formulation, Af-rati et al. [1] gave a �(N2) time and space algorithm for theTRP when the underlying graph is a path with N nodes. Inthis paper, we will provide a linear algorithm for the WTRPon paths, by reformulating the problem in a different dy-namic programming way. In Section 2, we will prove thatthe WTRP on paths can be reformulated as a problem ofcalculating the minima in a Monge path-decomposable tri-dimensional array, so that the linear algorithm given in [5]can be used for solving this problem. For other problemswhere the concepts of Monge arrays (or totally monotonearrays) are used for improving the efficiency of algorithmsbased on dynamic programming, see [2, 4, 6, 9].

In the same notable paper [1], a �(N2) algorithm wasprovided for the problem (WPD) of finding a walk throughall nodes of a path such that each node i is visited before agiven deadline t(i). Such a walk is called feasible. The sameauthors showed that solving TRP is NP-hard even on paths,if only feasible walks are allowed. In Section 3, we willprove that, on paths, the WPD can be reformulated in asimilar way to the one used in Section 2, and we will presenta linear algorithm for this problem.

2. THE WTRP ON A PATH

Let { pm, pm�1, . . . , p1, s, qn, qn�1, . . . , q1} be thenodes of the path graph from one end of the path to theother, s being the starting node. We will denote w( pj) � 0and w(qk) � 0 as the associated weights of nodes pj and qk,respectively. The travel time between two arbitrary nodesthrough the path graph will be denoted by d( � , � ) � 0.Any d( � , � ) can be calculated from the d(s, � ) values, sowe only need �(m � n) input data. If T is a walk startingat s and visiting all the nodes, the waiting time for the firstvisit of a node through T will be denoted by dT(s, � ). The

Received July 2000; accepted April 2002Correspondence to: A. Garcıa; e-mail: [email protected] online 00 Month 2002 in Wiley InterScience(www.interscience.wiley.com). DOI 10.1002/net.10031© 2002 Wiley Periodicals, Inc.

NETWORKS, Vol. 40(1), 27–31 2002

amount w( pj)dT(s, pj) is known as the latency of node pj inwalk T, and LT � ¥j�1

m w( pj)dT(s, pj) � ¥k�1n w(qk)dT(s,

qk) is the latency of T. We are seeking a walk T withminimum latency.

Although an optimal walk can finish at pm or q1, we willonly describe how to calculate an optimum finishing at pm.One finishing at q1 can be calculated in the same way.Naturally, the one with less latency will be the optimum.(However, it is computationally cheaper to add a new node,pm�1, connected to pm and with weight zero. In this way,the walk finishes at pm�1, and the optimal walk without thislast node is an optimum for the original graph.) We will alsoassume that w(q1) � 0.

Henceforth, in this section, we will consider only walksT starting at s, finishing at pm, and visiting all the nodes. Wecan represent this walk as a sequence ( pj1

, qk1, pj2

,qk2

, . . . , pjh, qkh

, pjh�1� pm). This means that, after s,

nodes p1, . . . , pj1are visited first, then nodes qn, . . . , qk1

,next the walk comes back and visits nodes pj1�1, . . . , pj2

,and so on [see Fig. 1(a)]. When qn is the first node visitedjust after s, the corresponding sequence begins ( p0,qk1

, . . .), where p0 is identified with s. Hence, we have 0� j1 � j2 � . . . � jh � jh�1 � m and n � k1 � k2 � . . .

� kh � 1.To find an optimal route T, we will first solve the

problem assuming that, among the q-nodes, only q1 haslatency (i.e., only in that node are there some machines to berepaired; the other q-nodes have zero weight). Then, we willsolve the problem when nodes q1 and q2 have latency andso on until all of the q1, . . . , qn nodes have latency (thep-nodes always maintain their initial weights).

So, we will define problem Pi as the original problemexcept that w(qn) � w(qn�1) � . . . � w(qi�1) � 0. Forany walk T, we will define L(T, i) as the latency of Tcorresponding to problem Pi [note that L(T, n) � LT]. The

latency of an optimal solution of Pi will be denoted by L(i),that is, L(i) � minT L(T, i). For P0, walk s, p1, p2, . . . ,pm is the optimum. It will be represented by sequence ( pm),and its latency, L(0), is ¥l�1

m w( pl)d(s, pl).Suppose that T is represented by sequence ( pj1

, qk1, pj2

,qk2

, . . . , pjh, qkh

, pm). Let T� be walk ( pj2, qk2

, . . . , pjh,

qkh, pm) when k1 � 1 and walk ( pm) when k1 � 1 (Fig.

1(a, b) show T and T� , respectively). We can observe that

dT �s, pj� � �dT� �s, pj� for j � 1, . . . , j1

dT� �s, pj� � 2d�pj1, qk1� for j � j1 � 1, . . . , m.

Similarly, if k1 � 1,

dT �s, qk� � �dT� �s, qk� � 2d� pj1, pj2� for k � k1, . . . , ndT� �s, qk� � 2d�pj1, qk1� for k � 1, . . . , k1 � 1

and dT(s, qk) � 2d(s, pj1) � d(s, qk), @k, when k1 � 1.

Let us define W( pj) � ¥l�1j w( pl), W(qk) � ¥l�1

k

w(ql), and l(qk) � ¥l�1k w(ql)d(s, ql). For any i such that

k1 � i � n, L(T, i) can be obtained from L(T� , k1 � 1) byadding

The increase of latency of nodes pj1�1, . . . , pm, that is:

1� j1, k1� � 2d� pj1, qk1��W� pm� � W� pj1��,

the increase of latency of nodes qk1�1, . . . , q1, that is:

2� j1, k1� � 2d� pj1, qk1�W�qk1�1�,

and the latency of nodes qk1, qk1�1, . . . , qi, that is:

3� j1, k1, i� � �l�k1

i

�2d�s, pj1� � d�s, ql��w�ql�

� 2d�s, pj1��W�qi� � W�qk1�1��

� l�qi� � l�qk1�1�.

Hence, we have

L�T, i� � L�T� , k1 � 1� � 1� j1, k1�

� 2� j1, k1� � 3� j1, k1, i�.

As k1 can be 1, in order for the previous formulas to becorrect, we define l(q0) � 0 and W(q0) � 0. In Figure 1(a,b) the nodes with zero weight used in each case to calculateL(T, i) and L(T� , k1 � 1) are shown as blank dots.

A characterization of optimal walks is given in the fol-lowing lemma:

Lemma 2.1. For a given i, 0 � i � n, let T1 � (pj1, qk1

, pj2,

qk2, . . . , pjh

, qkh, pm) be an optimal solution to Pi, and let

FIG. 1. Walks T and T� .

28 NETWORKS—2002

T2 � (pj1, qk1

, . . .) be an optimal solution to Pk1�1. Then, k1� k1, j1 � j1, T1 is an optimal solution to Pk1�1, and T2

� (pj1, qk1

, pj1, qk1

, . . .) is an optimal solution to Pi.

Proof. The lemma is true for k1 � 1, because, in thiscase, T1 � ( pj1

, q1, pm) and T1 � ( pm) is the only optimalwalk to P0.

So suppose that k1 � 1. Note that T1, being optimal toPi, implies that k1 � i, because if k1 � i, then L(T1, i)� L(i), since qi�1, . . . , qn have zero weight. Therefore,

L�i� � L�T1, i� � L�T1, k1 � 1�

� 1� j1, k1� � 2� j1, k1� � 3� j1, k1, i�. (1)

In the same way, T2, being optimal to Pk1�1, implies that k1� k1. In addition, it is easy to verify that 2( j1, k1) � 0and that L(T2, i) � L(T2, k1 � 1) � 3( j1, k1, i). Hence,j1 � j1, because, otherwise, 3( j1, k1, i) � 3( j1, k1, i)and L(T2, i) would be less than L(i).

Thus, T2 is well defined and

L�T2, i� � L�k1 � 1� � 1� j1, k1�

� 2� j1, k1� � 3� j1, k1, i�. (2)

(1) and (2) clearly imply that L(k1 � 1) � L(T1, k1 � 1)and L(T2, i) � L(i). �

The lemma establishes that L(i) can be obtained from anoptimal latency L(k1 � 1) with k1 � i, and, as we do notknow the values of j1 and k1, we can take the minimumfrom all their possible values. Hence, we have

L�i� � min1�k1�i

min0�j1�m

�L�k1 � 1� � 1� j1, k1�

� 2� j1, k1� � 3� j1, k1, i��.

Replacing j1 by m � j and defining

● b(i, j) � 3(m � j, k1, i) � 2d(s, pm�j)W(qk1�1)� l(qk1�1)

● c( j, k1) � 1(m � j, k1) � 2(m � j, k1) � 2d(s,pm�j)W(qk1�1) � l(qk1�1),

then the previous scheme of dynamic programming can berewritten as

L�i� � min1�j�m

mink1�i

�L�k1 � 1� � b�i, j� � c� j, k1��,

i � 1, . . . , n.

As the travel times among nodes in the graph and theweights are nonnegative numbers, it is easy to verify that B� {b(i, j)} and C � {c(i, j)} are Monge matrices [an n m matrix A is called Monge if a(i, j) � a(i � 1, j � 1)

� a(i � 1, j) � a(i, j � 1), i � 1, . . . , n � 1, j� 1, . . . , m � 1]. In addition, as quantities W( pj), j� 1, . . . , m, W(qk), k � 1, . . . , n, and l(qk), k� 1, . . . , n can be precalculated in linear time and space,the entries of matrices B and C can be calculated in constanttime. Thus, we can use the algorithm MINIMA given in [5]for specifically solving this particular type of recurrence.This algorithm has �(n � m) time and space complexityand provides, for each value i, the indices ( j(i), k(i) � i)such that

L�i� � L�k�i�� � b�i, j�i�� � c� j�i�, k�i� � 1�.

The optimal walk is then given by the sequence

� pm�j�n�, qk�n�, pm�j�k�n��, qk�k�n��, . . . , q1, pm�.

3. THE WPD ON A PATH

Let us suppose again that the underlying graph is a path,with nodes { pm, pm�1, . . . , p1, s, q1, q2, . . . , qn}.(Notice that the numbering of q-nodes is now reversed.)d( � , � ) is the travel time between two arbitrary nodes andnow each node v has to be visited for the first time before aspecified time t(v) (the deadline of that node). So, we areinterested only in walks T beginning in s, which obey dT(s,v) � t(v). Walks satisfying all of these deadline restrictionswill be called feasible. As we said previously, Afratti et al.proved that the TRP restricted to feasible walks is NP-hardeven in path graphs. They also provided a �(nm) algorithmfor finding, when there exists, a feasible walk in path graphs(in fact, one of the shortest feasible walks). In this section,we will present a linear algorithm for this latter problem.

As in the previous section, we can assume that T is awalk beginning at s, visiting all the nodes and finishing atpm. [Again, pm or qn is the last node visited for any feasiblewalk T. But, as in Section 2, by connecting a new nodepm�1 to pm, with d( pm, pm�1) � t(qn) and an infinitedeadline, we can ensure that the last node visited is pm�1.]

The following lemma allows us to simplify the subse-quent reasonings:

Lemma 3.1. If deadlines t(pj) are changed to t�(pj) � F1(j)� d(s, pj), where F1(j) � minj�j(t(pj) � d(s, pj)), anddeadlines t(qk) are changed to t�(qk) � F2(k) � d(s, qk),where F2(k) � mink�k(t(qk) � d(s, qk)), then the set offeasible routes is the same with both deadlines.

Proof. Let T be a feasible walk with deadlines t�, sothat t(v) � dT(s, v). By definition, F1( j) � t( pj1

) � d(s,pj1

) for some j1 � j, and in this case, dT(s, pj1) � dT(s, pj)

� d( pj, pj1). Hence,

t�� pj� � t� pj1� � d�s, pj1� � d�s, pj�

� t� pj1� � d� pj, pj1�

NETWORKS—2002 29

� dT�s, pj1� � d� pj, pj1�

� dT�s, pj�.

So, pj is visited by deadline t�( pj). Similar reasonings can beused for the q-nodes.

Reciprocally, as F1( j) � t( pj) � d(s, pj), then t( pj)� t�( pj), and, similarly, t(qk) � t�(qk). So, if a walk visitsthe nodes by deadlines t��, then it also visits these nodes bydeadlines t�. �

Observe that the functions F1( j) and F2(k) are nonde-creasing and that if F1(1) or F2(1) are � 0 there is no walksatisfying the deadlines.

Again, as in Section 2, to find an optimal route T (ashortest feasible walk), we will first solve the problemassuming that, among the q-nodes, only q1 has to be visited.We will then solve the problem when only nodes q1 and q2

have to be visited and continue until all of nodes q1, . . . , qn

are visited. For this reason, we will define problem Pi as theoriginal problem except that only the first i q-nodes must bevisited.

A walk T visiting all the p-nodes and only the first iq-nodes will be represented as a sequence ( pj1

, qk1, pj2

,qk2

, . . . , pjh, qkh

, pm), where, now, 0 � j1 � j2 � . . . �jh � m and 1 � k1 � k2 � . . . � kh � i � n. L(T)� dT(s, pm) will denote its length and T� will be the walk( pj1

, qk1, pj2

, qk2, . . . , pjh�1

, qkh�1, pm). Obviously, L(T)

� L(T� ) � 2d( pjh, qkh

). The length of an optimal solutionto Pi will be denoted by L(i). Note that, for P0, ( pm) isfeasible if and only if F1(1) � 0, and its length, L(0), isd(s, pm).

Lemma 3.2. Given i, 0 � i � n, let T1 � (pj1, qk1

, pj2,

qk2, . . . , pjh

, qi, pm) be an optimal solution to Pi and let T2

� (pj1, qk1

, pj2, qk2

, . . . , pjh�1, qkh�1

, pm) be an optimalsolution to Pkh�1 (assume that Pkh�1 is P0, if h � 1). Then, T1

is an optimal solution to Pkh�1, and T2 � (pj1, qk1

, pj2,

qk2, . . . , pjh�1

, qkh�1, pjh

, qi, pm) is well defined and it is anoptimal solution to Pi.

Proof. First, note that if there is a feasible walk for Pi

there is also a feasible walk for Pk if k � i.When h � 1, then T1 � ( pj1

, qi, pm) and T1 � ( pm)is the only optimal walk for P0. Thus, the lemma is obvi-ously true in this case.

Suppose that h � 1. Then, we have jh�1 � jh�1,because, otherwise, we can verify that walk T � ( pj1

,qk1

, pj2, qk2

, . . . , pjh�1, qi, pm) would be feasible and

with length L(T) � L(T2) � 2d(qkh�1, qi) � L(T1)

� 2d( pjh, qi) � L(i).

Therefore, walk T2 � ( pj1, qk1

, pj2, qk2

, . . . , pjh�1,

qkh�1, Pjh

qi, pm) is well defined. Besides, it is feasible andL(T2) � L(kh�1) � 2d( pjh

, qi). Then, necessarily, L(T1)� L(kh�1) and L(T2) � L(i). �

Given i � 0, the previous lemma tells us that, if weknow kh�1 and jh, then L(i) � L(kh�1) � 2d( pjh

, qi).Suppose that h � 1, kh�1 � k, and that Tk � ( pj1

, qk1, pj2

,qk2

, . . . , pjh�1, qk, pm) is an optimal solution to Pk. For j

� jh�1, the length of walk ( pj1, qk1

, pj2, qk2

, . . . , pjh�1, qk,

pj, qi, pm) is L(k) � 2d( pj, qi). Since this amount isnondecreasing in j, jh must be the minimum j � jh�1 suchthat the new walk is feasible. But for this new walk to befeasible, nodes pj�1, . . . , pm must be visited by theirdeadlines, so we need

L�k� � d� pj, pm� � 2d� pj, qi� � d� pj, pj� � t�� pj�

j � 1 � j � m. (3)

Also, similarly, nodes qkh�1�1, . . . , qi must be visited bytheir deadlines, so we need

L�k� � d� pj, pm� � d� pj, qk� � t��qk�

kh�1 � 1 � k � i. (4)

When h � 1, by taking kh�1 � 0 and jh�1 � �1, theprevious formulas are still correct and the range of possiblej is from 0 to m � 1. When h � 1, we can also extend therange of j from 0 to m � 1 instead of from jh�1 � 1 to m� 1. Because if j � jh�1 satisfies (3) and (4), then walk( pj1

, qk1, . . . , pjl

, qkl, pj, qk, pm) would be feasible and

shorter than Tk, l being the value such that jl � j � jl�1.Also, if j � jh�1 satisfies (3) and (4), then walk ( pj1

, qk1,

pj2, qk2

, . . . , pjh�1, qi, pm) would be feasible and shorter

than L(k) � 2d( pj, qi). Therefore,

L�i� � min0�k�i,0�j�m

�L�k� � 2d�pj, qi��,

taken among the indices ( j, k) satisfying (3) and (4). Usingthe fact that F1( j) and F2(k) are nondecreasing, we onlyneed constraints (3) and (4) to be fulfilled by j � j � 1 andk � k � 1. Thus, we can rewrite these conditions as

F1� j � 1� � d�s, pm� � L�k� � 2d� pj, qi� (5)

F2�k � 1� � d�s, pm� � L�k� � 2d�s, pj�. (6)

If there are no values k � i and j satisfying conditions (5)and (6), then there is no feasible walk visiting the first iq-nodes.

We can observe that, given i, since L(k) is nondecreas-ing, if pair ( j, k) satisfies (5), then so does ( j, k), when k� k. Equally, if ( j, k) satisfies (6), then so does ( j, k),when j � j, as d(s, pj) is nondecreasing. Hence, if ( j1, k1)and ( j2, k2) satisfy (5) and (6), these conditions are alsosatisfied by the pair (min( j1, j2), min(k1, k2)). So, if

j�(i) � min{ j � ( j, k) satisfy (5) and (6) for some k � i}and

30 NETWORKS—2002

k� (i) � min{k � i � ( j, k) satisfy (5) and (6) for somej},

then L(i) � L(k� (i)) � 2d( pj�(i), qi), and to calculate L(i),we only need to know the ( j�(i), k�(i)) values for i � 1, . . . , n.

Furthermore, as d( pj, qi) is nondecreasing in i, if ( j, k)satisfy (5) and (6) for a value i, this pair also satisfies (5)and (6) for value i � 1, so j�(i) � j�(i � 1) and k� (i) � k� (i� 1). Therefore, to calculate j�(i) and k� (i), we must first testconditions (5) and (6) for the ( j � j�(i � 1), k � k� (i � 1))candidate pair. If pair ( j, k) satisfies the conditions, thenthis is the required pair. If it does not satisfy (5), we willtake ( j � 1, k) as a candidate pair, and if it does not satisfy(6), we will try pair ( j, k � 1). We will go on with the sameprocess of testing with these new candidate pairs until onewhich satisfies both conditions is found or until j � m or k� i.

In Figure 2, we describe this algorithm called FEASI-BLE in a pseudocode. We can observe that the variables j

and k are initialized with zero and that, in the innermostwhile loop, only one of them is increased by 1. Since theprocess finishes if j � m or k � i � n, then the algorithmcomputes all the j�(i), k� (i), and L(i) values in �(m � n)time and space when they exist. So, we have the followingtheorem:

Theorem 3.3. The algorithm FEASIBLE determineswhether a feasible walk exists, and in this case, it providesa shortest feasible walk. Its complexity is �(m � n) timeand space.

REFERENCES

[1] F. Afrati, S. Cosmadakis, C.H. Papadimitriou, G. Papageor-giou, and N. Papakostantinou, The complexity of the travel-ling repairman problem, Theor Info Appl 20 (1986), 79–87.

[2] A. Aggarwal and J.K. Park, Improved algorithms for eco-nomic lot size problems, Oper Res 41 (1993), 549–571.

[3] I. Averbakh and O. Berman, Sales-delivery man problems ontreelike networks, Networks 25 (1995), 45–58.

[4] Z. Galil and J.K. Park, A linear-time algorithm for concave-unidimensional dynamic programming, Info Process Lett 33(1990), 309–311.

[5] A. Garcıa, P. Jodra, and J. Tejel, An efficient algorithm foron-line searching of minima in Monge path-decomposabletridimensional arrays, Info Process Lett 68 (1998), 3–9.

[6] L.L. Larmore and B. Schieber, On-line dynamic program-ming with applications to the prediction of RNA secondarystructure, J Alg 12 (1991), 490–515.

[7] E. Minieka, The Delivery Man Problem on a Tree Network,Ann Oper Res 18 (1989), 261–266.

[8] J.N. Tsitsiklis, Special cases of traveling salesman and re-pairman problems with time windows, Networks 22 (1992),263–282.

[9] R. Wilber, The concave least-weight subsequence problemrevisited, J Alg 9 (1988), 418–425.

FIG. 2. The algorithm FEASIBLE.

NETWORKS—2002 31