#### Abstract

In this paper we study an inverse approach to the traveling salesman reoptimization problem. Namely, we consider the case of the addition of a new vertex to the initial TSP data and fix the simple “adaptation” algorithm: the new vertex is inserted into an edge of the optimal tour. In the paper we consider the conditions describing the vertexes that can be inserted by this algorithm without loss of optimality, study the properties of stability areas, and address several model applications.

#### 1. Introduction

Stability of the traveling salesman problem (TSP) has been studied from the 1970s [1, 2] in case the weight matrix is subject to perturbation. This work was continued in a much more general way [3–9]. Another approach to the stability of the TSP is connected with the* master tour property* [10, page 435] with the key result [11]. At last there is the* reoptimization* [12, 13] approach to face the case where the weight matrix remains undisturbed while the number of cities varies (with the correspondent variation of the weight matrix size). Usually, reoptimization of NP-hard problems is NP-hard. Even if the optimal solution of the initial instance is known for free, the reoptimization remains NP-hard [14]. Moreover, the situation is not improved if all optimal solutions are known [15].

In this work we consider the following inverse reoptimization problem: we fix an “adaptation” algorithm and study what distortions of the initial data may be “adapted” by this algorithm. Specifically, we consider the conditions under which a new city may be inserted between two consequent cities of an optimal tour without loss of optimality. Sufficient condition is always polynomial; however necessary and sufficient conditions are only polynomial if the solution of the initial instance and the solutions of some “close” instances are provided by an oracle. These results sharpen the previous author’s work on TSP adaptive stability [16, 17] (in Russian) for “open-ended” tours which is a special case of the general approach to the adaptive stability of discrete optimization problems [18, chapter 1] (in Russian).

#### 2. Designations and Definitions

Let us restrict all possible TSP cities to the elements of a* finite* set and introduce a cost function . For each initial set of cities we fix the set of permutations . Henceforth we associate the elements of with the circular tours on , supposing the existence of the additional edge . The cost of a circular tour is naturally defined as
A tour is called* optimal* over if

The insertion of a new city into an existing tour after the city gives the “disturbed” tour the insertion cost may be expressed as where for each

We say an optimal tour * is adaptively stable to the addition of a city * if there exists an element of such that is optimal over . In the following section we study the conditions for such stability. One can define another way to adopt an optimal tour to the addition of a new city and thus obtain other stability conditions. The only requirement for the adaptation algorithm is apparently its low complexity (in comparison with the complexity of finding ).

Let us introduce the set of “potential pairs” for each Evidently because . At last, we introduce the minimum cost of tour over all tours of containing the fixed edge :

#### 3. Adaptive Stability Conditions

We start with the simple and sufficient condition that allows checking “easily” whether it is possible to insert a new city in a known optimal tour while preserving its optimality.

Theorem 1 (sufficient). *Let be an optimal tour and . Tour is optimal if
*

*Proof. *Let us consider an arbitrary tour and the correspondent . If , then
else and, thus,

The proposed condition is evidently polynomial in both time and space . In Section 4 we study if it allows formulating the algorithms that solve particular TSP instances in polynomial time by consequent addition of new vertexes from the stability areas (see Algorithm 1 in Section 5).

*Observation 1. * in (8) may be equivalently replaced by .

*Proof. *Firstly, and thus
Conversely, for all , (a) if , then by definition
(b) if , then , so
because . Thus we have the equivalent, but more clear and compact, condition

The usage of (8) instead of (14) is reasonable if the set is known for free. Otherwise the computation of is comparable by complexity with the direct checking of condition (14).

In the following theorem we give a simple, necessary, and sufficient condition for TSP adaptive stability based on Bellman’s principle of optimality.

Theorem 2 (necessary and sufficient). *Let be an optimal tour and . Tour is optimal if and only if
*

*Proof. *First we will show that (15) leads to the optimality of and that this part is similar to the proof of Theorem 1. Let denote the right-hand side of (15), consider an arbitrary tour , and introduce . If , then
else and

Conversely, suppose that is optimal. Let minimize and is attained on some
The equality is achieved when , where evidently is equal to and .

The proposed condition requires the solution of NP-hard problems (computation of for each ). Such a requirement is too “expensive” to check whether an optimal tour is adaptively stable to the* single* addition of or not. But when such a test must be performed for a variety of possible additions (not consequent) and , the condition becomes less computationally expensive than the direct solution of TSP, because one needs to compute the values of only once and is able to use them for every new . Thus we solve less than NP-hard problems instead of .

*Observation 2. * in (15) may be equivalently replaced by .

*Proof. *Inclusion leads to

On the other hand, let . If , then

Else and
Two opposite inequalities result in the equality

The usage of polynomially computed in (15) may help to avoid NP-hard computations of for in comparison with condition (22). If one wants to check the stability of for a variety of new elements , it is reasonable to construct as the first step the set and as the second step compute only for . Nevertheless (22) may still be used for the sake of simplicity and clearness.

The described reiterated application of (15) and (22) for is actually the construction of the stability areas (see Section 4). It is probably one of the most appropriate ways to use Theorem 2, where the computational time savings become apparent. The time complexity of TSP exact solution (2) is [20], where . The time complexity of the application of condition (22) to each may be expressed as the sum of operations (to prepare for each ) and operations (to check (22) for each ): whereas the direct solution of TSP (2) over for each inserting would take It is easy to see that if , the application of Theorem 2 is reasonable, because the heaviest multipliers and are “separated.”

We finish the section with a brief mention of simple necessary conditions for TSP adaptive stability which are based on Bellman’s principle. Namely, if some “subtour” (consisting of the successive cities of an optimal tour) is not adaptively stable to the addition of a new city, then the complete tour is not adaptively stable to this addition too [18] (in Russian). “Subtour” may be “short” (3–5 edges) to obtain the computationally effective conditions or “long” (comparable to the complete tour) to get closer to the necessary and sufficient conditions.

The applicability of the necessary conditions in combination with various local search techniques deserves a particular investigation that mostly goes beyond the paper, except for one example with the cheapest insertion heuristic [21] (see Algorithm 3 in Section 5).

#### 4. Adaptive Stability Areas

The* Adaptive stability area (ASA)* of a tour is defined as the maximal (with respect to inclusion) subset of ; each element of which may be inserted in at least one edge of with an optimal tour as a result. Necessary and sufficient conditions (15) and (22) allow constructing ASA efficiently for a large finite . Firstly, we introduce formally the* edge ASA (eASA)* for each single edge of a tour. Let be all the edges of a tour ; for all , for all

The sufficient conditions (8) and (14) allow constructing the similar set,* edge sufficient ASA (eSASA):*

The examples of eASAs and eSASAs are given in Figure 2 for the uniform grids over the finite regions of the Euclidean plane. Finally, we introduce the stability areas associated with the necessary conditions. Let us define some auxiliary notations related to “noncyclic subtours” of a cyclic tour. Let and, from now on, indexes outside the set are defined cyclically, ; . The insertion of a new city into “-subtour” of a cyclic tour is defined as (see Figure 1) Let be the set of unique elements of the sequence . The set of all possible noncyclic tours starting from , finishing at , and passing through all the cities from is denoted as . By analogy with the cyclic tours the cost of a noncyclic tour is the sum of the costs of its edges; optimal noncyclic tour is a tour of minimal cost.

**(a)**

**(b)**

**(c)**

The* edge necessary ASA (eNASA)* for is defined as

The unions of eASAs, eSASAs, or eNASAs over all give the correspondent ASA, SASA, or NASA of :

In consequence of the definitions and Bellman’s principle of optimality for all , for all and as a result

In all the examples of stability areas within the paper: (1) optimal TSP solutions are obtained by Concorde TSP solver [22] with the built-in QSopt LP solver [23]; (2) the distance function is integer Euclidean: for all , and for all let ; (3) the eSASAs and eASAs within the correspondents SASAs and ASAs are marked off by different tones that serve the sole purpose to separate the neighbor edge areas.

For the continuous variant of the eASA, eSASA, and eNASA of any edge of any finite tour are closed (as the continuous preimages of closed sets). Supposedly the areas are also path-connected and simply connected.

Figure 3 shows the dependence of the relative size of ASA and SASA in a finite uniform grid over the Euclidean plane. It is interesting to note that while the relative area of SASA in Figure 3 seems to converge asymptotically to zero, the relative area of ASA seems to go to approximately 0.6 as . The pronounced reduction of SASA’s size in case of growing is demonstrated by the examples in Figure 4. One can see that whereas the total relative area of the colored regions in the first picture of the first raw is approximately 20%, the last two pictures ( and 300) of the first raw contain the colored regions in which related areas do not exceed 3%.

**(a)**

**(b)**

#### 5. Algorithms and Model Applications

Theorem 1 gives a natural instrument for the polynomial solution of some TSP instances. Suppose we need to solve problem (2), where .

*Algorithm 1 (stable growth). *Consider the following.(1)Select 3 arbitrary points from and construct the trivial tour (evidently it is optimal over ). Let .(2)While ,(a)if , , then
(b)else exit the algorithm and announce that optimal tour cannot be constructed.(3)Return as the desired optimal tour.

Algorithm 1 is polynomial in both time and space. Unfortunately the more cities included into the intermediate tour are, the smaller is (see Figure 3), and thus the probability that Algorithm 1 will be interrupted at 2(b) increases. Step 2(b) may be replaced by the application of some heuristic, but in this case the obtained solution would not necessarily be optimal.

The conditions (15) and (22) are not polynomial and thus the analog of Algorithm 1 for the Theorem 2 does not make any practical sense. Namely, every addition of a new element to the initial data not only requires the solutions of NP-hard problems for finding and , but may also change the “old” values of , so they should be recomputed.

In spite of the fact that Theorem 2 does not contribute to the solution process, it can be used for postoptimal analysis. Assume we have several optimal TSP solutions and the objective function does not allow selecting “the best.” Each TSP solution may reflect some underlying laws behind the initial data (e.g., a chain of events in history or evolution). From this contensive point of view, a “good” solution should not only minimize the objective function, but also stay structurally stable even in case of the addition of new data from the same data source. In the simplest case the solutions having the largest ASA among all optimal solutions may be considered the preferable. Here we come to the problem of constructing stability areas and, as it was noted before, condition (15) allows avoiding the solution of a new TSP for each new element tested for the stable insertion. In Algorithm 2 we consider a more general case, where the elements tested for the insertion are weighted by some function (it can be the probability of the appearance in the nearest future or the “importance” of the element in some sense).

*Algorithm 2 (selection among equally optimal TSP solutions). *Consider the following.(1)Suppose we have a set of optimal tours
and a weight function .(2)For each use (15) to construct ASA .(3)Return the set of preferable tours

Let us consider a simple model example of the application of Algorithm 2 (Figure 5). Let, for clarity, some evolution process be described in terms of two dimensions (Euclidean plane), for example, the weight and the length of an animal. Suppose we know that the point 1 is the ancient ancestor and that the point 4 is the modern descendant. The points 2 and 3 should be ordered (it is “fixed start-free end” TSP that can be polynomially reduced to a cyclic TSP). The tours and have equal cost (length); thus we cannot order 2 and 3 according to the TSP solution. Let us suppose the existence of two complementary (may be even yet undiscovered) organisms, corresponding to points B1 and B2. If we know that the existence of the organism B2 is more “probable” than the existence of B1 (), then we may prefer as the tour that preserves its structure in case of probable insertion.

**(a)**

**(b)**

**(c)**

**(d)**

In case of relatively large the computation time savings related with the application of (15) in ASA construction may be significant. Suppose we have 10 feature dimensions to describe each of 50 organisms (). Let the values of each coordinate vary from 0 to 100; then . The purpose is to reconstruct the most probable evolution order over , assuming, for example, that the origin organism is known. If there is more than one optimal solution, it is possible to compare them by Algorithm 2 applying some known weight function . This method implies the multiple constructions of ASAs. According to (24) and (25) the direct construction of ASA will take operations as far as the optimal TSP solutions over for each new are needed. The application of Theorem 2 allows reducing it to . This example allows recommending the condition (15) for postoptimal analysis of the TSP solutions in multidimensional feature spaces.

The last application of the adaptive stability we intend to concern in the paper is devoted to the usage of adaptive stability within local search. Such a combination seems to deserve a particular investigation which mostly goes beyond this paper. Here we give only a basic example of the application of NASAs to the decision-making process in the well-known* cheapest insertion* (CI) heuristic.

NASAs seem to be the most convenient choice to combine with the fast heuristics, because, as it was shown before, the ASAs are too hard to compute in case of problem size growing, while the SASAs are too “narrow” (see Figures 3 and 4).

*Algorithm 3 (cheapest insertion with NASA). *Consider the following.(1)The algorithm has two parameters: —the size of subtour, and —the number of the first best insertions to be tested against NASA.(2)Use CI to construct an initial cycle , where . Set (evidently ).(3)Repeat while :(a)for each construct and fix one of the edges , where the minimum is attained;(b)order by ascending of ; select top-ranked cities , so that is the cheapest insertion;(c)search for the smallest for which ;(i)if such exists, then ; ;(ii)else do the cheapest insertion ; .(4)Return as the desired tour.

The results of the empirical experiments comparing the application of Algorithm 3 with simple CI are given in Table 1. One can see that the most advantageous values of lay in range . Relatively large subtour size () leads to the situation where Step 3(c)i of Algorithm 3 is rare in comparison with Step 3(c)(ii); thus Algorithm 3 tends to work exactly as CI.

#### 6. Conclusion

Similar definitions, conditions, and adaptive stability areas may be constructed for the deletion or substitution of a city in a tour. Examples of such conditions are given in [16, 18] (in Russian). However, in practice, addition of a new city remains the most interesting case of the distortion.

The described approach to the stability of TSP may be applied to an arbitrary combinatorial optimization problem in a very general way: we fix an “adaptive algorithm” that assigns each solution of the original problem an “adapted set” of solutions of the correspondent disturbed problem. If the “adapted set” constructed for the optimal solution of the original problem contains an optimal solution of the disturbed problem, then the original optimal solution is considered to be “adaptively stable” in the sense of the fixed “adaptive algorithm” (-stable) [24] (in Russian).

#### Conflict of Interests

The author declares that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgment

The work is supported by Russian Foundation for Basic Research (14-08-00419, 13-01-96022, 13-08-00643, 13-01-90414, and 13-04-00847).