Travelling salesman paths on Demidenko matrices

In the path version of the Travelling Salesman Problem (Path-TSP), a salesman is looking for the shortest Hamiltonian path through a set of n cities. The salesman has to start his journey at a given city s, visit every city exactly once, and finally end his trip at another given city t. In this paper we identify a new polynomially solvable case of the Path-TSP where the distance matrix of the cities is a so-called Demidenko matrix. We identify a number of crucial combinatorial properties of the optimal solution, and we design a dynamic program with time complexity O(n^6).

Authors

• 3 publications
• 1 publication
• 6 publications
08/04/2016

A Polynomial-Time Deterministic Approach to the Traveling Salesperson Problem

We propose a new polynomial-time deterministic algorithm that produces a...
02/05/2022

LotRec: A Recommender for Urban Vacant Lot Conversion

Vacant lots are neglected properties in a city that lead to environmenta...
06/08/2020

A New Integer Programming Formulation of the Graphical Traveling Salesman Problem

In the Traveling Salesman Problem (TSP), a salesman wants to visit a set...
03/28/2020

Single-Point Visibility Constraint Minimum Link Paths in Simple Polygons

We address the following problem: Given a simple polygon P with n vertic...
10/10/2019

Variational Path Optimization of Linear Pentapods with a Simple Singularity Variety

The class of linear pentapods with a simple singularity variety is obtai...
12/18/2019

Busca de melhor caminho entre múltiplas origens e múltiplos destinos em redes complexas que representam cidades

Was investigated in this paper the use of a search strategy in the probl...
12/18/2021

Out to Explore the Cybersecurity Planet

Security ceremonies still fail despite decades of efforts by researchers...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

The travelling salesman problem (TSP) is one of the best studied problems in operational research. This is not only due to the numerous appearances of the TSP in various practical applications, but also due to its pivotal role in developing and testing new research methods. We refer the reader to the books by Applegate, Bixby, Chvátal & Cook [2], Gutin & Punnen [14], and Lawler, Lenstra, Rinnooy Kan & Shmoys [18] for a wealth of information on these issues. We also emphasize the role of the TSP in education and in the popularization of science. There is hardly any text book on operational research where the TSP would not be mentioned. The book [4] of Cook is an excellent example of how the TSP is used in the popularization of science.

An instance of the TSP consists of cities together with an symmetric distance matrix that specifies the distance between any pair and of cities. The objective in the TSP is to find a shortest closed route which visits each city exactly once; such a closed route is called a TSP tour. In the Path-TSP the instance also specifies two cities and (with ), and the goal is to find a shortest route starting at city , ending at city , and visiting all the other cities exactly once. Both the TSP and the Path-TSP are NP-hard to solve exactly (see for instance Garey & Johnson [11]), and both problems are APX-hard to approximate (Papadimitriou & Yannakakis [20]; Zenklusen [21]). These intractability results hold even in the metric case, where the distances between the cities are non-negative and satisfy the triangle inequality. Given the intractability of TSP and Path-TSP, the characterization of tractable special cases is of obvious interest and forms a well-established and vivid branch of research.

Polynomially solvable cases of the TSP.

The literature contains an impressive number of polynomially solvable cases for the classical TSP, as certified by the surveys of Burkard & al [3], Deineko, Klinz, Tiskin & Woeginger [5], Gilmore, Lawler & Shmoys [12], and Kabadi [15], and the references therein. We now briefly discuss three tractable cases of the TSP that are relevant for the current paper.

In the so-called Convex-Euclidean TSP, the cities are points in the Euclidean plane which are all located on the boundary of their convex hull. A folklore result says that the optimal tour in the Convex-Euclidean TSP is the cyclic walk along the convex hull, taken either in clockwise or in counter-clockwise direction. If we number the cities as in clockwise order along the convex hull, then the cities satisfy the so-called quadrangle inequalities:

 cij+ckℓ ≤ cjℓ+cik \qquad for all~{}1≤i

These quadrangle inequalities state the fact that in a convex quadrangle, the total length of two opposing sides is less or equal to the total length of the two diagonals. Kalmanson [16] observed that whenever a TSP instance satisfies these quadrangle inequalities (1)–(2), the tour is a shortest TSP tour. This extends the tractability of the Convex-Euclidean TSP to the tractability of the TSP on so-called Kalmanson matrices, where the distances satisfy (1)–(2). We stress that the class of Kalmanson distance matrices is large and goes far beyond the Convex-Euclidean case: Consider for instance a rooted ordered tree with non-negative edge lengths, place a city in each of the leaves, and number the cities from left to right. Then the shortest path distances between cities and determine a Kalmanson matrix, as the inequalities (1) and (2) can easily be verified for any quadruple of leaves. Finally, we mention the TSP on Demidenko matrices, where the distances satisfy

 cij+ckℓ ≤ cjℓ+cik \qquad for all~{}1≤i

Note that condition (3) coincides with condition (1). Hence Demidenko matrices form an obvious generalization of Kalmanson matrices, and it is known that this generalization is proper. A famous result of Demidenko [8] shows that the TSP on Demidenko matrices is solvable in polynomial time. The gist of this paragraph is that the Convex-Euclidean TSP, the TSP on Kalmanson matrices, and the TSP on Demidenko matrices form three tractable TSP cases of strictly increasing generality.

Polynomially solvable cases of the Path-TSP.

Whereas the literature on polynomially solvable cases of the classical TSP forms a rich and comprehensive body, we are only aware of a single result on polynomially solvable cases of the Path-TSP: Garcia & Tejel [9] derive an algorithm for the Path-TSP with cities on Convex-Euclidean distance matrices. The follow-up work [10] by Garcia, Jodra & Tejel uses sophisticated search techniques to improve the time complexity to linear time . Figure 1 provides an example for the Convex-Euclidean Path-TSP, which is taken from Figure 3 in [9]; this example illustrates the diverse and manifold shapes of TSP-paths under Convex-Euclidean distances.

Now by looking deeper into the papers [9, 10] and by carefully analyzing the flow of arguments, one realizes that the approach does not exploit any geometric property of the Convex-Euclidean case that would go beyond the quadrangle inequalities (1)–(2). In other words, the arguments in [9, 10] do not only settle the Path-TSP on Convex-Euclidean distance matrices, but they do also yield (without additional effort, and without changing a single letter) a polynomial time solution for the Path-TSP on Kalmanson matrices. Note that this step from Convex-Euclidean matrices to Kalmanson matrices for the Path-TSP runs perfectly in parallel with the step from Convex-Euclidean matrices to Kalmanson matrices for the classical TSP.

Contribution and organization of the paper.

In this paper we take the logically next step in this line of research and show that the Path-TSP is polynomially solvable on Demidenko matrices. This substantially generalizes and extends the results in [9, 10] for the Path-TSP on Convex-Euclidean matrices and Kalmanson matrices. We first analyze the combinatorial structure of an optimal TSP-path on Demidenko matrices, and prove that there always exists an optimal solution of a certain strongly restricted and nicely structured form. Then we show that we can optimize in polynomial time over the TSP-paths of that nicely structured form. By combining these results, we get our polynomial time result for Demidenko matrices.

The remainder of the paper is organized as follows. In Section 2 we summarize definitions and notations related to paths and tours as well as concrete matrix classes of relevance in this paper. In Section 3 we introduce the concept of forbidden pairs of arcs and show that for arbitrary cities and there always exists an optimal -TSP-path which does not contain forbidden pairs of arcs. Then we show some implications of this result in terms of the solution of the Path-TSP for and , and of structural properties of the optimal solution of the problem in the more general case with and arbitrary . Section 4 shows how to exploit the findings presented in Section 3 to efficiently solve the Path-TSP for and for arbitrary by dynamic programming. Finally, Section 5 shows how to efficiently solve the Path-TSP in the most general case, where there are no restrictions on and . Section 6 concludes the paper with some final remarks.

2 Definitions, notations and preliminaries

In this section we summarize various definitions and notations that will be used throughout the rest of the paper.

2.1 Paths and tours

We consider a set of cities with a symmetric distance matrix . We use the notation for the set of all integers between and , for any two integers , and with .

A tour visiting cities, , is a sequence with , and , for all , such that every city from except for is contained at most once in the sequence. We say that the tour visits the cities , , . A tour visiting all cities is called a TSP tour. A tour is called pyramidal if there exists an such that , and hold. A TSP tour which is pyramidal is called a pyramidal TSP tour.

An -path visiting cities is a sequence of cities which starts at , ends at , and contains every city from exactly once, where , . An -TSP-path is an -path visiting all cities. An -path is called -pyramidal if there exists an index such that and . An -path is called -pyramidal if there exists an index such that and . (In the last two definitions one of the chains of inequalities would become obsolete if or .)

Given a tour or an -path and two indices , , then is called the successor of in and is called the predecessor of in

. An ordered pair

, for , is called an arc in . If (), is called an increasing arc (decreasing arc). An -path such that all its arcs are increasing (decreasing) arcs is called a monotone increasing path (monotone decreasing path). For a city in is called a peak in if and . A city is called a valley in if and . Thus a peak (a valley) in an -path is a city which is reached along an increasing (a decreasing) arc and is left along a decreasing (an increasing) arc. The first city of an -path () is called a peak if and a valley if . The last city of an -path () is called a peak if ) and a valley if . Given a tour or an -path and two indices , , the subsequence of starting at city and ending at city is called the -subpath of .

Next we introduce the four quantities , , , and for integers , which represent the lengths of certain -pyramidal paths or -pyramidal paths in the following way: For with denote by the length of a shortest -pyramidal -path visiting the cities . Notice that due to the symmetry of the distance matrix is also the length of a shortest -pyramidal -path visiting the above set of cities. Clearly in a -pyramidal -path as above city is either the successor of or the predecessor of . Analogously in a pyramidal TSP-tour city is visited right before or right after city . Thus the optimal length of a pyramidal tour equals . If , then and the corresponding path consists just of the arc .

For , , let be the length of a shortest -pyramidal -path which visits the cities (and also the length of a shortest -pyramidal -path visiting the above set of cities). Clearly in a -pyramidal -path as above city is either the successor of or the predecessor of . If , then and the corresponding path consists just of the arc .

Next we introduce notations for the length of shortest -pyramidal paths and shortest -pyramidal paths which visit contiguous sets of cities, i.e. sets of cities which consist of all cities between and for some pair of cities , .

For , , let be the length of the shortest -pyramidal -path which visits the cities . Due to the symmetry of the distance matrix is also the length of a shortest -pyramidal -path which visits the set of cities as above. In the special case , is the length of the monotone increasing path through the cities .

For , , let be the length of a shortest -pyramidal -path visiting the cities (and also the length of a shortest -pyramidal -path visiting the above set of cities). In the special case , is the length of the monotone increasing path through the cities .

If or we omit the subscript or in , , , , and use simply , and , , respectively.

Observe that for every , the quantities with , , can be computed in time by the dynamic programming recursions (4)-(5). Analogously for every , the quantities with , , can be computed in time by the recursions (6)-(7).

 Em(i,j)=Em(j,i)=min{Em(j+1,j)+ci,j+1,Em(i,j+1)+cj+1,j}, (4) for i∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯1,m−2, j∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯i+1,m−1,%  and Em(i,m)=Em(m,i):=cim, for i∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯1,m−1. (5)
 Dw(i,j)=Dw(j,i)=min{Dw(j−1,j)+ci,j−1,Dw(i,j−1)+cj−1,j}, (6) for j∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯w+1,n−1, i∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯j+1,n,%  and Dw(i,w)=Dw(w,i):=ciw, for i∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯w+1,n. (7)

In particular the entries and the entries , , , can be computed in time.

Summarizing we get the following result:

Observation 2.1

The quantities for , with , can be computed in time. Analogously the quantities for , with , can be computed in time. The quantities and with , can be computed in time.

Since, as mentioned above, the optimal length of a pyramidal tour equals Observation 2.1 implies the following result known already in the 1970’s.

Theorem 2.2

(Klyaus [17]; Gilmore, Lawler & Shmoys [12])
A shortest pyramidal TSP tour visiting the cities can be determined in time.

The quantities , with , , and , with , , can also be computed efficiently by dynamic programming as shown in the following simple observation. We set or , for or , respectively.

Observation 2.3

The quantities with , , and with , , can be computed in time. In particular, for and the quantities with , , and , with , , can be computed in time.

Proof.  For the quantities the claim follows directly from Observation 2.1 and the following equalities which hold for any triple in the given range of indices:

 Λm(i,p)=ci,i+1+ci+1,i+2+...+cp−2,p−1+Em(p−1,p), % if i
 Λm(i,p)=Em(p−1,p), if i=p−1.

Analogously, for the quantities the claim follows directly from Observation 2.1 and the following equalities which hold for any triple in the corresponding range of indices:

 Vw(j,q)=cq,q−1+cq−1,q−2+...+cj+2,j+1+Dw(j+1,j), if j
 Vw(j,q)=Dw(q,q−1),if j=q−1.

Clearly the quantities can be computed in a preprocessing step in time for all pairs with and .

In what follows we assume that all quantities , , , with indices in their corresponding ranges are computed in a preprocessing step. Moreover we use the straightforward relationships

 Dw(i,j)=min{ci,k+Vw(j,k):k∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯w,j−1}  for i>j.

Finally let us notice that we will use a schematic representation of paths to illustrate their combinatorial properties. An -TSP-path , , visiting the cities for , is visualized on an grid by placing city in the grid node with coordinates . For example, Figure 2(a) shows the shortest -TSP-path , , for the set of points in Figure 3. The schematic representation of is shown in Figure 2(b).

2.2 Classes of matrices

A symmetric matrix is a Kalmanson matrix if it satisfies the Kalmanson conditions in (1)–(2), and is a Demidenko matrix if it satisfies the Demidenko conditions in (3). Note that a principal submatrix of an Kalmanson (Demidenko) matrix obtained from by deleting the rows and columns with indices in a subset , , is again a Kalmanson (Demidenko) matrix. The reversed matrix results from matrix by simultaneously reversing the order of rows and columns in ; in other words, the matrix is specified by . A reversed Kalmanson (Demidenko) matrix is again a Kalmanson (Demidenko) matrix.

The example in Figure 3 shows that the Demidenko matrices form proper superset of the Kalmanson matrices. It can be checked that the distance matrix of the Euclidean distances of these points in the Euclidean plane is a Demidenko matrix but not a Kalmanson matrix. Indeed, some points lie far from the boundary of the convex hull of all points and the matrix of their Euclidean distances is not even a permuted Kalmanson matrix. We refer the reader to Deineko, Rudolf, Van der Veen & Woeginger [6] for an explicit characterization of Euclidean sets of points that satisfy the Kalmanson conditions or the Demidenko conditions.

Back in 1979, Demidenko [8] proved that an optimal TSP tour on a set of cities with a Demidenko distance matrix can be found among the pyramidal TSP-tours. Together with Theorem 2.2 this implies the following result:

Theorem 2.4

(Demidenko [8])
For an -city TSP instance with a Demidenko distance matrix, an optimal TSP tour can be found among the pyramidal TSP tours; hence it can be determined in time.

Throughout this paper, we will assume that all considered distance matrices have non-negative entries. This assumption can be made without loss of generality, as Demidenko matrices can be transformed into non-negative Demidenko matrices by simply adding a sufficiently large constant to each entry. Clearly the Path-TSP with a distance matrix and the Path-TSP with a distance matrix for some are equivalent, in the sense that the sets of their optimal solutions coincide.

3 Forbidden pairs of arcs and structural properties of optimal TSP-paths starting at city 1

In this section we investigate the combinatorial structure of optimal -TSP-paths in the case where the distance matrix of the cities is a Demidenko matrix. An essential concept used in our investigations is that of a forbidden pair of arcs. We show first that there always exists an optimal -TSP-path which does not contain forbidden pairs of arcs. As implications of this fact we obtain the solution of the -Path-TSP and further structural properties of the optimal -TSP-path for .

Definition 3.1

In an -path a pair of arcs and is called a forbidden pair of arcs if either or holds.

Lemma 3.2

Consider a Path-TSP instance with a Demidenko distance matrix . There exists an optimal -TSP-path which does not contain forbidden pairs of arcs.

Proof.  Let be an optimal (i.e. shortest) -TSP-path with some forbidden pair of arcs and . Assume without loss of generality that and that city is reached earlier than city in . Apply a standard transformation technique (see for instance Burkard & al [3]) to construct an optimal -TSP-path which does not contain the pair and of forbidden arcs: invert the -subpath of into , and replace the forbidden pair of arcs by the new pair of arcs and . Clearly the resulting path is an -TSP-path. Moreover the Demidenko conditions (3) imply that , and therefore the length of does not exceed the length of . So is an optimal -TSP-path which does not contain the pair and of forbidden arcs. If this path still contains a forbidden pair of arcs we apply the above transformation again and repeat this process as long as the current optimal -TSP-path contains a forbidden pair of arcs.

In order to see that this transformation process terminates after a final number of steps consider a potential function which maps any -TSP-path to a non-negative integer . It can easily be seen that the transformation described above reduces the value of the potential function, i.e. . Since the potential function takes only non-negative integer values the process stops after a final number of steps.

Lemma 3.2 implies the following result on the -TSP-paths.

Theorem 3.3

is a shortest -TSP-path for the Path-TSP with a Demidenko distance matrix.

Proof.  We show that any -TSP-path with a non-trivial peak, i.e. a peak different form , contains a forbidden pair of arcs. The proof of the lemma is then completed by observing that is the unique -TSP-path without a non-trivial peak.

Let be the first peak in a -TSP-path . Since is a peak, there is an arc in a -subpath of such that . If , then and build a forbidden pair of arcs. If , then on the monotone increasing -subpath of there exists an arc such that . By observing that we conclude that the pair and is a forbidden pair of arcs in this case.

The following corollary is a statement about the monotonicity of peaks and valleys in optimal -TSP-paths.

Corollary 3.4

Consider a Path-TSP on cities with a Demidenko distance matrix. For any , , there exists an optimal -TSP-path with peaks decreasing and valleys increasing from the left to the right in the path, i.e. if peak (valley ) is reached earlier than peak (valley ) in the path, than () holds.

Proof.  The proof is done by induction on the number of cities. The statement is trivially true for . So assume that .

The correctness of the statement for follows immediately from Theorem 3.3: the -TSP-path contains just the (trivial) valley and the (trivial) peak . Thus we assume without loss of generality that and let be an optimal -TSP-path. Let , with , , be the -subpath of . Since a principal submatrix of a Demidenko matrix is a Demidenko matrix, as mentioned in Subsection 2.2, by applying Theorem 3.3 we can reorder the cities of increasingly and obtain a -path of the same length which visits the same cities as . So we can assume without loss of generality that there is no peak in the -subpath but , and hence is also the first peak in -TSP-Path . Now we distinguish two cases: (a) the last city is the smallest city in the -subpath of and (b) there is a city with in the -subpath of . In Case (a) we can assume without loss of generality that there are no other peaks but in the -subpath of (by applying similar arguments to the one mentioned above for the -subpath of ); this assumption is justified by Theorem 3.3 and by the fact that a reversed Demidenko matrix is a Demidenko matrix. So. we assume w.l.o.og. that the -subpath of is monotone deareasing the statement of the corollary holds in this case. (Notice, that in this case we can find an optimal -TSP-path which is -pyramidal.)

In Case (b) the -subpath from to contains at least one valley which is smaller than . Let be the smallest valley in the -subpath of , for . Analogously as for the -subpath and for Case (a) we can assume without loss of generality that the -subpath of contains no peaks, but . Denote by the -subpath of , . Since the distance matrix of the cities visited by is a Demidenko matrix (as a principal submatrix of a Demidenko matrix), the induction hypothesis applies and this completes the proof.

Lemma 3.5

Consider a Path-TSP with a Demidenko distance matrix and an optimal -TSP-path which contains no forbidden pairs of arcs and such that its peaks decrease and its valleys increase from the left to the right in the path. Let and , , be two consecutive peaks in . Let be the valley that precedes peak . let be the valley that follows and precedes , and let be the valley that follows . Then the following statements hold:

• The -subpath of contains no city for which holds.

• The -subpath of contains no city for which holds.

Proof.  Figure 4 illustrates the structure of a path with the properties described in the lemma. We prove here only statement (i), statement (ii) can be proved by using similar arguments.

Consider the -subpath of and assume that (i) does not hold. Let be the largest city on the -subpath such that . If , then and hence , build a forbidden pair of arcs contradicting the assumption of the lemma. If , then on the -subpath of there exists an arc such that . In this case and build a forbidden pair of arcs and this contradicts the assumption of the lemma.

In particular, the statements in the above lemma imply that the cities are placed on consecutive positions in path and form a -pyramidal subpath of it.

4 Efficient solution of the Path-TSP with a Demidenko distance matrix: the case s=1

In this section we first derive recursive equations for the length of an optimal -TSP-path through the cities . These equations yield an dynamic programming algorithm for the solution of the Path-TSP with a Demidenko distance matrix where the starting city is and the destination city arbitrary.

The recursive equations for . Due to Lemma 3.2, Corollary 3.4 and Lemma 3.5, we consider without loss of generality an optimal -TSP-paths which contains no forbidden pairs of arcs, has decreasing peaks and increasing valleys from the left to the right and fulfills the statements of Lemma 3.5. We distinguish two cases: (1) the optimal -TSP-path contains no valleys but and , and (2) the optimal -TSP-path contains at least one valley with . In the first case the optimal -TSP-path is -pyramidal and thus . In the second case let , , be the left-most (and the smallest) non-trivial valley in .

Since is the first peak, valley is reached after in . According to Lemma 3.5 (see also Figure 4 where the role of is played by ), starts with a monotone increasing -subpath visiting the cities , followed first by a -pyramidal path with the peak , then by a -pyramidal path with valley , and so on, until the final city is reached. For cities , , such that and denote by be the length of an optimal -path starting at and then visiting the cities of the set with the first peak in this path being , and the valley that follows being . Here could also coincide with , in which case would be reached along a decreasing sequence of cities from to . Then the length of the optimal -TSP-path is given as follows

 Hn(1,t)=min{Λn(1,t),min{V1(1,j)+Γ(j,n,j+1):j=1,…,t−2}}. (8)

where is defined as in Subsection 2.1.

Next we give a recursive equation for the computation of the quantities above. To this end denote by the length of an optimal -path visiting the cities of the set with first valley and first peak such that precedes , for cities , , such that and . Here could also coincide with in which case would be reached along an increasing sequence of cities from to .

According to Lemma 3.2, Corollary 3.4 and Lemma 3.5 and as illustrated in Figure 5 the values , for with , can be calculated by the following recursions:

 Γ(j,m,w)=Em(j,t), if w=t, and Γ(j,m,w)=min{cj,m+L(m,w,m−1),min{αj,m,w(p,k):p∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯t,m−2,k∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯p+2,m}, if w

where .

The above recursions (9) cover the following cases which are also illustrated in Figure 5.

Case . The -path has only one peak (since ), starts at , ends at and goes through the cities . The optimal length of the pyramidal path on these cities equals (see the definition before Observation 2.1). This case corresponds to the first line in (9) and is illustrated in Figure 5(a).

Case . In this case there will be another peak (different from ) to the right of the valley . Let this peak be , with according to Corollary 3.4. We again distinguish two subcases: and . If , then according to Lemma 3.5 the path starts with the arc followed by -subpath which starts at and goes through the cities , with the first valley in this path being and peak reached after valley . The optimal length of such a path is given by and in this case is calculated as shown in the second line of (9) and illustrated in Figure 5(b).

If , then the -path starts with an arc connecting to the left-most city of a -pyramidal path with peak containing the cities and either starting or ending at city . Let the other end-city of this -pyramidal path be . Then the length of the -path is calculated as shown in the third line of (9) and illustrated in Figures 5(c) and 5(d). These pictures correspond to the cases where above mentioned -pyramidal path starts or ends at , respectively.

The values , for with , can be computed recursively in a similar way:

 L(k,w,p)=Dw(k,t), if p=t, and L(k,w,p)=min{min{βk,w,p(v,j):v∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯w+2,t,j∈¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯w,v−2}ck,w+Γ(w,p,w+1),if p>t, (10)

where .

Based on equations (8)-(10) we obtain the following result about the computation of the optimal -TSP path in the case of a Demidenko distance matrix.

Theorem 4.1

Consider a Path-TSP on cities with a Demidenko distance matrix. An optimal -TSP-path can be found in time.

Proof.  Recall that all values , for with , and , for , with , can be calculated in time in a preprocessing step, see Observation 2.3. Further, according to equation (8) the computation of the length of the optimal -TSP-path (for ) involves the quantities , for . The quantities , for with , are computed recursively together with the quantities , for with . Observe that the computation of , for some in the corresponding range, just involves quantities for which the difference between the specified peak and valley is strictly smaller than the difference between the specified peak and the specified valley in . Analogously, the computation of , for some in the corresponding range, involves quantities for which the difference between the specified peak and valley is strictly smaller than the difference between the specified peak and the specified valley in . So the recursion would start with the trivial values for with , and for with . The effort needed for the recursive computation of all other values of and is the computation of the minimum over