# Introducing Complexity Curtailing Techniques for the Tour Construction Heuristics for the Travelling Salesperson Problem

Authors: Ziauddin Ursani; David W. Corne
Journal: Journal of Optimization
 (2016)

---

## Abstract

In this paper, complexity curtailing techniques are introduced to create faster version of insertion heuristics, that is, cheapest insertion heuristic (CIH) and largest insertion heuristic (LIH), effectively reducing their complexities fromO
(
n
3
) to O
(
n
2
) with no significant effect on quality of solution. This paper also examines relatively not very known heuristic concept of max difference and shows that it can be culminated into a full-fledged max difference insertion heuristic (MDIH) by defining its missing steps. Further to this the paper extends the complexity curtailing techniques to MDIH to create its faster version. The resultant heuristic, that is, fast max difference insertion heuristic (FMDIH), outperforms the “farthest insertion” heuristic (FIH) across a wide spectrum of popular datasets with statistical significance, even though both the heuristics have the same worst case complexity of O
(
n
2
). It should be noted that FIH is considered best among lowest order complexity heuristics. The complexity curtailing techniques presented here open up the new area of research for their possible extension to other heuristics.


---

## Body

## 1. Introduction

The Traveling Salesman Problem (TSP) is one of the most studied problems in the scientific literature and sometimes is referred to as a mother of all combinatorial optimization problems. It continues to be a testing ground for the development of combinatorial optimization methods, while having numerous practical applications in diverse areas, including logistics, genetics, manufacturing, telecommunications, and neuroscience [1]. Examples of real-world application domains with problems that can be naturally formulated as the TSP include VLSI design, vehicle routing, data clustering, and job-shop scheduling [2]. The earliest reference to the TSP can be found in the 1832 German handbook for travelling salesmen [1]. The problem consists of finding the shortest possible tour of a set of n cities, such that the tour starts from and ends at the same city and visits each of the remaining cities precisely once. The problem is simple to state but has proved to be intractable and is included among the seven “millennium prize problems” described by the Clay Mathematical Institute, carrying a prize of one million US dollars for discovery of a polynomial time solution method.Meanwhile, research and practice in the TSP have focused on heuristic methods that yield fast approximate solutions. These heuristic methods tend to cluster into three main groups: (i) tour construction heuristics, (ii) tour improvement heuristics, and (iii) composite heuristics (which combine elements of both tour construction and tour improvement). A tour construction heuristic constructs the tour from scratch, beginning with one city and iteratively expanding the subtour by one city at a time. In contrast, a tour improvement heuristic begins with a complete tour and makes one or more rearrangements in an attempt to improve it. A vast space of “composite” heuristics obscures the distinction between these two categories by using elements of both; for example, in the highly successful Lin-Kernighan heuristic [3], the context is that of iterated tour improvement; however the improvement process consists of repeated construction of full solutions from partial solutions. The concord software code [4], which has solved most problems in TSPLIB to optimality, uses the Lin Kernighan heuristic to find out near optimal tours and then applies various mathematical programming methodologies to achieve optimality.With no general polynomial time solution method yet available, the quest for the development of new heuristics for the TSP remains active. Tour construction heuristics have played an important role in this quest, in particular because they can form components of a wide range of approaches. For example, they can be used to construct the starting solutions for tour improvement heuristics [5], and they can provide rough estimates of the cost of optimal solutions. In turn, they therefore provide interesting analytical grounds for the study of upper bounds on solution quality [6] and provide material for empirical studies [7, 8] that attempt to understand how optimal solutions differ from solutions that arise from tour construction heuristics. Such studies lead to better understanding of the structure of optimal solutions of the TSP, a problem that has now remained centre of our intellectual curiosity for centuries.The basic procedure of tour construction heuristics can be summarised as follows:(1)
Establishment of the initial small subtour (subtour establishment rule).
(2)
Selection of a city not present in the current subtour (selection rule).
(3)
Expansion of the current subtour to include the selected city (expansion rule).
(4)
Iterative application of steps(
2
) and (
3
) until a complete tour is obtained.In the repeated application of steps (
2
) and (
3
), the subtour is “successively augmented” with the insertion of a new city; this is why tour construction heuristics are sometimes also called “successive augmentation” heuristics (see, e.g., [9]). Different tour construction heuristics are characterised by the specific methods they choose for each of the three steps: the initial subtour establishment, selection, and expansion rules. Expansion rules can be grouped into two main types: insertion and addition. An insertion-based expansion rule chooses where in the permutation to place the new city on the basis of the cost of the resulting subtour, whereas an addition-based expansion rule bases this decision on next-hop distance. It has been reported that insertion heuristics generally perform better than addition heuristics (see, e.g., [8]); we have therefore chosen to focus on insertion-based expansion heuristics in this paper.Three insertion heuristics are particularly prominent in the literature, namely, nearest, farthest, and cheapest [10]. We consider these three heuristics in the remainder of this work, along with a further two that are less well known. The first of these two is the “largest-cost insertion heuristic” (LIH) [11], which sits naturally alongside the aforementioned three, despite being rarely considered in the literature. The second is the “max difference insertion heuristic” (MDIH). Tunnel and Heath [12] presented “max difference” as a concept that could be attached to any other heuristic; however we argue that, with appropriate extensions that we later describe (resulting in MDIH), it is more appropriately seen as a tour construction heuristic in itself, and in fact we demonstrate that it is a particularly effective one.The insertion heuristics under study can be divided into two groups, that is, distance based insertion heuristics (DBIH) and cost based insertion heuristics (CBIH). The DBIH has city selection rule based on distance. This group includes nearest (NIH) and farthest insertion heuristics (FIH). The CBIH has city selection rule based on the cost of insertion (see (5)). This group includes cheapest (CIH), largest (LIH), and max difference insertion heuristics (MDIH). The difference in selection rule brings about difference in worst case complexity of heuristics with DBIH having worst case complexity of O
n
2 and CBIH having complexity of O
(
n
3
) (see Section 4). This paper proposes techniques to curtail the complexity of CBIH to O
n
2, effectively creating faster versions of CBIH, that is, FCIH, FLIH, and FMDIH, while addition of “F” denotes the word fast.Previously it has been reported that farthest insertion heuristic (FIH) generally performs best among the community of insertion heuristics ofO
n
2 or lower time complexity (see, e.g., [13]). However we will show that the performance of FMDIH is consistently better than FIH on a wide spectrum of popular datasets even though the complexity of FMDIH is no greater than that of FIH.The remainder of this paper is structured as follows. In Section2, we describe four of the five insertion heuristics of interest: cheapest, largest, nearest, and farthest insertion. In Section 3 we describe the previously overlooked “max difference” concept and build on that to describe the “max difference insertion” heuristic. In Section 4, we discuss design and complexity issues for all five of the heuristics of interest, and in Section 5 we then describe our complexity curtailing techniques to produce accelerated and approximated variants of cost based insertion heuristics. Section 6 provides summaries of empirical results, and we conclude with a statement of our main findings in Section 7. In Appendix, we then show the empirical results for the farthest and max difference insertion heuristics in finer detail.


## 2. Description of Tour Construction Heuristics

Below, we explain the design details of four of the five main heuristics considered in this paper. Our elaboration of the details follows the four-part structure given in Section1 for tour construction heuristics. Being insertion heuristics, the most important elements are the city selection and subtour expansion methods. The city selection method is also salient for another reason, which is the fact that the name of a tour construction heuristic (e.g., cheapest and farthest) tends to reflect the nature of this rule. We come back to this fact in Section 3, when we speculate about why the “max difference” heuristic has been largely overlooked. The simple “initial subtour establishment” rule is also described for completeness and to facilitate replication of our experiments. Meanwhile, it is worth noting an interesting aspect of the city selection rule.


### 2.1. Initial Subtour Establishment

This is the first step in any tour construction heuristic. In each of the standard forms of the cheapest, largest, nearest, and farthest insertion heuristics, this initial “subtour” is simply a single city chosen uniformly at random.


### 2.2. City Selection

Momentarily referring to the subtour expansion rule (in Section2.3), we note that two of the heuristics of interest are based on cost, and two are based on distance. Where subtour expansion is based on cost, the city selection rule is as follows. Let τ be the set of cities in the subtour and let τ
′ be the set of cities not in the subtour, while city k
∈
τ
′ and c
o
s
t
τ
,
k is the expansion cost of subtour τ by insertion of city k. Then, the city k is selected such thatfor CIH(1)
c
o
s
t
τ
,
k
=
min
⁡
∀
j
∈
τ
′
c
o
s
t
τ
,
j
and for LIH(2)
c
o
s
t
τ
,
k
=
max
⁡
∀
j
∈
τ
′
c
o
s
t
τ
,
j
.When subtour expansion is instead based on distance, the city selection rule is different. Now, let d
h
,
k be the distance between cities k and h; the city k is selected such that for NIH(3)
d
h
,
k
=
min
⁡
∀
j
∈
τ
′
,
∀
i
∈
τ
d
i
,
j
and for FIH(4)
d
h
,
k
=
max
⁡
∀
j
∈
τ
′
,
∀
i
∈
τ
d
i
,
j
.


### 2.3. Subtour Expansion

As indicated in the introduction, subtour expansion heuristics can be based around eitherinsertion oraddition. We are only concerned with insertion-based variants in this paper and so will confine our description accordingly. Let k
∈
τ
′ and i
,
i
′
∈
τ, such that i and i
′ are a pair of consecutive cities in τ. Let d
i
,
k be the distance between the cities i and k. The subtour is expanded by inserting the selected city k in the subtour τ such that (5)
c
o
s
t
τ
,
k
=
min
⁡
∀
i
,
i
′
∈
τ
d
i
,
k
+
d
i
′
,
k
-
d
i
,
i
′
.This step is applicable to each of CIH, LIH, FIH, and NIH. From this point onwards, we refer to the edge i
,
i
′ related to c
o
s
t
τ
,
k as theexpansion cost edge. It should be noted that the “largest-cost insertion” heuristic is not published yet, however, an unpublished paper about it is present on the internet [10]. We include it in our experiments, noting that it is the logical counterpoint to CIH, in the same way that FIH is related to NIH. It therefore completes a set of four heuristics of which two are based on minimum and maximum distance ((3)-(4)) while two are based on minimum and maximum expansion cost ((1)-(2)). We later find that LIH outperforms both CIH and NIH, though apparently missing from the literature.


## 2.1. Initial Subtour Establishment

This is the first step in any tour construction heuristic. In each of the standard forms of the cheapest, largest, nearest, and farthest insertion heuristics, this initial “subtour” is simply a single city chosen uniformly at random.


## 2.2. City Selection

Momentarily referring to the subtour expansion rule (in Section2.3), we note that two of the heuristics of interest are based on cost, and two are based on distance. Where subtour expansion is based on cost, the city selection rule is as follows. Let τ be the set of cities in the subtour and let τ
′ be the set of cities not in the subtour, while city k
∈
τ
′ and c
o
s
t
τ
,
k is the expansion cost of subtour τ by insertion of city k. Then, the city k is selected such thatfor CIH(1)
c
o
s
t
τ
,
k
=
min
⁡
∀
j
∈
τ
′
c
o
s
t
τ
,
j
and for LIH(2)
c
o
s
t
τ
,
k
=
max
⁡
∀
j
∈
τ
′
c
o
s
t
τ
,
j
.When subtour expansion is instead based on distance, the city selection rule is different. Now, let d
h
,
k be the distance between cities k and h; the city k is selected such that for NIH(3)
d
h
,
k
=
min
⁡
∀
j
∈
τ
′
,
∀
i
∈
τ
d
i
,
j
and for FIH(4)
d
h
,
k
=
max
⁡
∀
j
∈
τ
′
,
∀
i
∈
τ
d
i
,
j
.


## 2.3. Subtour Expansion

As indicated in the introduction, subtour expansion heuristics can be based around eitherinsertion oraddition. We are only concerned with insertion-based variants in this paper and so will confine our description accordingly. Let k
∈
τ
′ and i
,
i
′
∈
τ, such that i and i
′ are a pair of consecutive cities in τ. Let d
i
,
k be the distance between the cities i and k. The subtour is expanded by inserting the selected city k in the subtour τ such that (5)
c
o
s
t
τ
,
k
=
min
⁡
∀
i
,
i
′
∈
τ
d
i
,
k
+
d
i
′
,
k
-
d
i
,
i
′
.This step is applicable to each of CIH, LIH, FIH, and NIH. From this point onwards, we refer to the edge i
,
i
′ related to c
o
s
t
τ
,
k as theexpansion cost edge. It should be noted that the “largest-cost insertion” heuristic is not published yet, however, an unpublished paper about it is present on the internet [10]. We include it in our experiments, noting that it is the logical counterpoint to CIH, in the same way that FIH is related to NIH. It therefore completes a set of four heuristics of which two are based on minimum and maximum distance ((3)-(4)) while two are based on minimum and maximum expansion cost ((1)-(2)). We later find that LIH outperforms both CIH and NIH, though apparently missing from the literature.


## 3. The Max Difference Insertion Heuristic (MDIH)

The idea behind the MDIH was introduced in a Master’s thesis [12] a quarter of a century ago and no research paper about this could be found in literature. The “max difference” concept was presented by Tunnel and Heath as a way to engineer new variants of existing heuristics (they applied it to two versions of CIH and also to Stewart’s Algorithm [14]). However, since (as we will see) the concept relates directly to how the city selection step is done, from which the names of tour construction heuristics seem invariably to be derived, we would argue that it merits reinvention as a fully fledged tour construction heuristic. Its performance in the form of MDIH, as detailed in the next section, certainly supports this view. Meanwhile we speculate that Tunnel and Heath may not have put it forward as a standalone new heuristic, based on the belief that it was the “insertion” (subtour expansion) rather than the “max difference” (city selection) that was salient in such categorization; in turn, this seems to have led to its being unnoticed, despite its comparatively strong performance among similar heuristics.We now explain the key “city selection” step for MDIH. First, we need some helper definitions. The first of these is the function “nth minimum,” denoted as m
i
n
n
∀
v
∈
U
v. The meaning of “nth minimum” is that if all the values v in set U are sorted from minimum to maximum then this function represents the nth value in that list. Now, the “nth expansion cost” of a subtour by the insertion of any city not in that subtour is equal to the function m
i
n
n
∀
v
∈
U
v, if the set U is the set of all the expansion costs of that subtour on all of its edges caused by the insertion of that city. Now let k
∈
τ
′ and i
,
i
′
∈
τ, such that i and i
′ are a pair of consecutive cities in τ. Let d
i
,
k be the distance between the cities i and k. Let c
o
s
t
n
τ
,
k represent nth expansion cost of the tour τ by the insertion of city k and then by the definition(6)
c
o
s
t
n
τ
,
k
=
min
n
⁡
∀
i
,
i
′
∈
τ
d
i
,
k
+
d
i
′
,
k
-
d
i
,
i
′
.It should be noted that, apart from here, the exclusive use of above function is made in Sections 5.2 and 5.3. From this point onwards the edge i
,
i
′ related to c
o
s
t
n
τ
,
k is referred to as the nth expansion cost edge. In the city selection rule of MDIH the city k is selected such that the cost difference D
k between its expansion cost and 2nd expansion cost is maximum among all the cities not in the tour; that is,(7)
D
k
=
max
⁡
∀
k
∈
τ
′
c
o
s
t
2
τ
,
k
-
c
o
s
t
τ
,
k
.It should be noted that there is no difference between c
o
s
t
1
τ
,
k and c
o
s
t
τ
,
k. The 3rd step (subtour expansion) follows the same rule as represented by (5).Finally to present MDIH as complete tour construction heuristic in itself, we also explore five variants of the subtour establishment rule (step(
1
)). Unlike the other insertion heuristics considered in this paper, the city selection step of MDIH requires an initial subtour containing at least three cities. We therefore test five subtours establishment rules: (i) a subtour of three randomly chosen cities; (ii) a subtour first formed by two randomly chosen cities and then the third city is chosen based on cheapest expansion; (iii) a subtour first formed by two randomly chosen cities and then the third city is chosen based on largest-cost expansion; (iv) a subtour initially formed by one randomly chosen city and the next two are chosen iteratively based on cheapest expansion; (v) a subtour first formed by one randomly chosen city and then the next two are iteratively chosen on the basis of largest-cost expansion. Associated experiments and results are discussed later in Section 6.


## 4. Design and Complexity Aspects of Tour Construction Heuristics

Design of any heuristic consists of the design of data structures and algorithms for its efficient implementation. Our implementation centres around two key data structures: a doubly circular linked list representing the set of cities not in the subtour and a singly circular linked list representing the subtour. For set of cities not in the subtour, the doubly circular linked list allows for a very simple and fast city deletion operation. For the set of cities representing the subtoura, single circular linked list is sufficient since only an insertion operation is needed here. Initially, a doubly circular linked list is prepared representing the set of cities not in the subtour. From this list, cities are deleted one by one and correspondingly inserted in the single circular linked list representing the subtour of cities at each step. The procedure continues until the doubly circular linked list becomes empty.The design of step(
2
) (city selection) of DBIH, that is, the nearest and farthest insertion heuristics ((3)-(4)), consists of finding the nearest neighbour city present in the subtour for each of the cities not in the subtour. To reduce computation costs, the nearest neighbour city in the subtour for each city not in the subtour is recorded in each iteration, and in the next iteration the distance of only the recently added city is compared with the distance of the nearest neighbour from the previous iteration, thus updating the nearest neighbour information for the current iteration. Therefore, FIH and NIH can be implemented within time complexity of O
(
n
2
).In the case of CBIH, that is, the cheapest and largest insertion heuristics, the design of the city selection step ((1) and (2)) consists of finding the expansion cost for insertion into the subtour of each city not in the subtour. This implies that the expansion cost needs to be computed for each city not in the subtour; in turn, computation of the expansion requires visits to each and every edge of the subtour. To make this efficient, information should be preserved between iterations, and in each new iteration the expansion cost of only newly added edges is computed and compared with the expansion costs of the previous iteration to update the expansion cost information. However this shortcut may not be possible for all the cities not in the subtour. This is because some of the cities may have expansion costs in the previous iteration at an edge which is broken in the current iteration. This means the information about the expansion cost of those cities is no longer valid since the relevant edge for the expansion does not exist. For such cities, we need to compute the expansion costs for newly formed edges and if this expansion cost is less than or equal to their expansion cost in previous iterations, then it means their new expansion cost has been found on the newly formed edges. However, if not, we are forced to recompute the expansion cost of these cities on all edges of the current subtour to find out their new expansion cost. Therefore worst case scenario complexity of CIH and LIH is O
n
3. The average complexity of CIH is reported as of the order O
n
2
log
⁡
n [14].To design the city selection step for MDIH, for each city not in the subtour both the expansion cost and the 2nd expansion cost need to be computed (7). However, both of these quantities can be computed simultaneously in a single scan of the subtour. To implement the step efficiently, these quantities should be preserved between iterations for each city not in the subtour, and in the new iteration only the expansion cost and 2nd expansion cost of the recently added edges are computed and compared with those of the previous iteration to update them. However, just as was the case for CIH and LIH, this shortcut is not always possible; for some cities the expansion costs at all edges of the subtour need to be computed. Therefore the worst case scenario complexity of MDIH is same as that of cheapest and largest insertion heuristics, that is, O
(
n
3).


## 5. Complexity Curtailing Techniques for Cost Based Insertion Heuristics

In this section, complexity curtailing techniques are introduced to create fast and approximate variants of CIH, LIH, and MDIH.


### 5.1. Design of Fast Cheapest Insertion Heuristic (FCIH)

We can devise a new but faster heuristic based on CIH on the basis of simple geometrical principle. Consider the subtour “a
b
c
d
e
f
a” in Figure 1.Figure 1
Subtour “a
b
c
d
e
f
a” showing principle of fast CIH.In Figure1 it can be seen that g
,
h
,
i are the cities yet to be inserted. For each of these cities, the cheapest insertion edge is a
b. The final shape of the tour depends on the order in which these three edges are inserted. If city i is inserted first, then edge a
b will be deleted and the edges i
a and i
b will be added. In the new subtour a
i
b
c
d
e
f
a it is now a genuine possibility that the cheapest insertion for city h becomes edge a
f, since edgeab is no longer present. In this case, we will need to traverse the entire current subtour a
i
b
c
d
e
f
a to determine the new cheapest insertion for h. However, if city g had been inserted first instead of city i then edge a
b is deleted and new edges g
a and g
b are added. In this case most likely situation becomes that h is inserted in the newly added edge g
a, requiring only inspection of the newly added edges g
a and g
b.In interim summary, if we encounter the scenario in Figure1 during the construction of a tour using CIH, then, for the sake of computational efficiency, we would hope that city i is not chosen as the first of the three to be inserted. However, some reflection will reveal that the position of city i in this scenario is unlikely in the first place. It is well known that CIH grows tours “outwardly.” This means that the cities not in the subtour lie outside the periphery of the subtour, rather than inside it, such as we see with city i in Figure 1. By exploiting this property, we can propose a variant of CIH that only inspects the recently added edges in each iteration, even for the cities whose earlier cheapest edge is broken. Though no longer guaranteeing the “cheapest” insertion, intuition suggests that this would lead to a favourable tradeoff, with at most minor loss of quality set against significant benefit in speed. In this “fast CIH” heuristic, the total number of computations of expansion costs (now independent of details of the dataset) is given below:(8)
N
c
=
2
×
n
-
1
+
n
-
2
+
n
-
3
+
⋯
+
3
+
2
+
1
=
n
n
-
1
.Meanwhile, since one expansion cost involves traversal of 3 edges, the total number of edges traversed for computation of expansion costs is given by(9)
N
e
=
3
n
n
-
1
.The time complexity of “fast CIH” is therefore O
(
n
2
), which is below the average complexity of CIH. Note that fast CIH runs in the order O
(
n
2
) on any dataset (with best case, worst case, and average case scenarios all equivalent). A full procedural summary of this new “fast cheapest insertion” heuristic (FCIH) is given in Procedure 1.Procedure 1:Fast cheapest insertion heuristic (FCIH).
Procedure FCIH starts
Form circular linked list of citiesτ
′ not in the subtour
Form empty Linked listτ
Choose an arbitrary cityp
∈
τ
′
Deletep from the list τ
′
Insertp in the empty list τ
Initialize expansion costs of subtourτ by insertion w.r.t. all h in τ
′ to very high value
while
τ
′ is not empty do begin
do begin (Visit all h in τ
′)
L
e
t
δ
1 = Cost of insertion of city h on 1st newly formed edge
δ
[
2
] = Cost of insertion of city h on 2nd newly formed edge
δ
[
3
] = c
o
s
t
τ
,
h
If   expansion cost edge is broken in last iteration
then  c
o
s
t
τ
,
h
=
min
⁡
∀
r
∈
1,2
δ
[
r
]
else    c
o
s
t
τ
,
h
=
min
⁡
∀
r
∈
1,2
,
3
δ
[
r
]
end if
while all h in τ
′ not visited
Choose cityq in τ
′ such that c
o
s
t
τ
,
q
=
min
⁡
∀
h
∈
T
c
o
s
t
τ
,
h
Deleteq from the list τ
′
Insertq in τ on the edge connected to c
o
s
t
τ
,
q
end while
Procedure FCIH endsThe first five lines of “Procedure1” establish the initial tour. Expansion of this initial tour is then implemented in the remainder of the procedure. The inner loop in the remainder is used to compute the expansion cost c
o
s
t
τ
,
h for each city h (the definition of this cost is given in (5)). However, a short cut is used to compute this cost, by computing the expansion cost on only two newly formed edges. There are two potential scenarios associated with this shortcut: in the first scenario, the edge related to the expansion cost of this city in the previous iteration is broken, and in the second scenario it has survived. In the first scenario, the new expansion cost of the city h in the current iteration is assumed to be the minimum of the two expansion costs of city h computed on the two newly formed edges; in the second scenario, the difference is that wealso consider the expansion costs of city h computed in the previous iteration. The condition “w
h
i
l
e all h in τ
′ not visited” ensures that the cost of all uninserted cities is computed. The outer loop chooses the city for insertion that has the lowest expansion cost.


### 5.2. Design of Fast Largest Insertion Heuristic (FLIH)

In contrast to CIH, tours constructed by LIH do not grow “outwardly,” and the situation in Figure1, where one of the currently unvisited cities lies inside the periphery of the current subtour, is a common occurrence. We cannot therefore design a faster version of LIH on the same basis used for FCIH. However, in the case of LIH a different approximate assumption can be made which may help avoid computing expansion costs on all edges of the current subtour. Referring again to Figure 1: if city i is inserted in the subtour first, the new subtour a
i
b
c
d
e
f
a is formed, breaking the edge a
b as a result. Now in this case, as discussed earlier, city h might not make its cheapest insertion with newly formed edges a
i and i
b. However, there is a genuine possibility that city h makes its 2nd cheapest insertion with a
i or i
b. This leads us to the idea of a fast version of LIH in which we approximate, rather than guarantee, the cheapest insertion, while scanning at most four edges in each iteration of the construction process. In detail, in each iteration we only need to keep a record of the 2nd expansion cost in addition to the (1st) expansion cost for each city not in the subtour. In turn, we find the 2nd expansion cost of a city by scanning at most only four edges: the two newly formed edges, along with the expansion cost edge and 2nd expansion cost edge of the previous iteration. If either of the latter two were broken in the previous iteration, then we can simply use the remaining three edges to (approximately) update the expansion cost and 2nd expansion cost in the new iteration. Again, the resulting heuristic, FLIH, has complexity O
(
n
2
), independently of details of the dataset. A procedural summary of fast largest insertion heuristic (FLIH) is given in Procedure 2.Procedure 2:Fast largest insertion heuristic (FLIH).
Procedure FLIH starts
Form circular linked list of citiesτ
′ not in the subtour
Form empty Linked listτ
Choose an arbitrary cityp
∈
τ
′
Deletep from the list τ
′
Insertp in the empty list τ
Initialize expansion costs and 2nd expansion costs w.r.t. allh in τ
′ to very high value
while
τ
′ is not empty do begin
do begin (Visit all h in τ
′)
Let
δ
[
1
] = Cost of insertion of city h on 1st newly formed edge
δ
[
2
] = Cost of insertion of city h on 2nd newly formed edge
δ
[
3
] = c
o
s
t
τ
,
h
δ
[
4
] = c
o
s
t
2
τ
,
h
If    expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
4
δ
[
r
]
else if   2nd expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3
δ
[
r
]
else      ∀
n
∈
1,2
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,4
δ
[
r
]
end if
while all h in τ
′ not visited
Choose cityq in τ
′ such that c
o
s
t
τ
,
q
=
max
⁡
∀
h
∈
T
c
o
s
t
τ
,
h
Deleteq from the list τ
′
Insertq in τ on the edge connected to c
o
s
t
τ
,
q
end while
Procedure FLIH endsIn common with Procedure1, the first five lines of “Procedure 2” establish the initial subtour, while the remainder concern its expansion. In the inner loop, the expansion cost c
o
s
t
τ
,
h and second expansion cost c
o
s
t
2
τ
,
h are calculated for each city h (see (5) and (6), resp.). The costs are calculated on the basis of two newly formed edges, and the detail of the procedure concerns three potential scenarios that may arise. In the first scenario, the edge related to the expansion cost of city h in the previous iteration is broken. In the second, the edge related to thesecond expansion cost of city h is broken; in the third scenario, none of the expansion edges is broken. In the first scenario the new expansion cost and second expansion cost of city h are taken to be the two minimum expansion costs of three quantities: the two expansion costs of city h computed on the two newly formed edges and its second expansion cost in the last iteration. In the second scenario, the three quantities are now the two expansions costs computed on the two newly formed edges (as before) and its expansion cost computed in the previous iteration. Finally, in the third scenario, the two costs are taken as the smallest two of four quantities: the two expansion costs of city h computed on the two newly formed edges and its expansion cost and second expansion cost computed in the earlier iteration. The condition “w
h
i
l
e all h in τ
′ not visited” ensures that cost of all uninserted cities is computed. The outer loop chooses the city for insertion that has largest expansion cost.


### 5.3. Design of Fast Max Difference Insertion Heuristic (FMDIH)

Faster design of MDIH is possible on a similar basis to that used in faster design of FLIH. A key difference between LIH and FLIH is that, in each iteration, LIH calculates only the expansion costs for the unvisited cities, while FLIH (approximately) computes both the expansion costs and the 2nd expansion costs. By going “one step further” in this sense, FLIH facilitates much faster update of this information, while sacrificing some exactness. To extend the same principle to fast MDIH, we will go “one step further” in the computations required for the city selection rule in MDIH. In MDIH, city selection requires both the expansion cost and the 2nd expansion cost for each city not in the subtour (7). Therefore, we can design a fast MDIH that additionally computes and records the 3rd expansion cost of each city not in the subtour. This means we need to record at most five edges per iteration: the two newly added, plus the expansion, 2nd expansion, and 3rd expansion cost edges from the previous iteration. As with FLIH, if one of the latter three was broken in the current iteration, we will simply rely on the others to provide approximations. A detailed procedural summary of the fast max difference insertion heuristic (FMDIH) is given in Procedure 3.Procedure 3:Fast max difference insertion heuristic (FMDIH).
Procedure FMDIH starts
Form circular linked list of citiesτ
′ not in the subtour
Form empty Linked listτ
Setup initial subtour of three cities(
p
1
,
p
2
,
p
3
)
∈
τ
′
Delete(
p
1
,
p
2
,
p
3
) from the list τ
′
Insert(
p
1
,
p
2
,
p
3
) in the empty list τ
Initialize expansion costs, 2nd expansion costs and 3rd expansion costs w.r.t. allh in τ
′ to very high value
while
τ
′ is not empty do begin
do begin (Visit all h in τ
′)
Let
δ
[
1
] = Cost of insertion of city h on 1st newly formed edge
δ
[
2
] = Cost of insertion of city h on 2nd newly formed edge
δ
[
3
] = c
o
s
t
τ
,
h
δ
[
4
] = c
o
s
t
2
τ
,
h
δ
[
5
] = c
o
s
t
3
τ
,
h
If    expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
4,5
δ
[
r
]
else if   2nd expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,5
δ
[
r
]
else if   3rd expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,4
δ
[
r
]
else     ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,4
,
5
δ
[
r
]
end if
while all h in τ
′ not visited
Choose cityq in τ
′ such that cost difference D
(
q
)
=
max
⁡
[
∀
h
∈
T
c
o
s
t
(
τ
,
h
)
-
c
o
s
t
2
(
τ
,
h
)
]
Deleteq from the list τ
′
Insertq in τ on the edge connected to c
o
s
t
τ
,
q
end while
Procedure FMDIH endsIn “Procedure3”, again, the initial subtour is computed by the first five lines, and the remainder expands it. The inner loop of the remainder is used to compute the expansion cost c
o
s
t
τ
,
h, the second expansion cost c
o
s
t
2
τ
,
h, and the third expansion cost c
o
s
t
3
τ
,
h for each city h. The definitions of these costs are given in (5) and (6). The details of the inner loop achieve a shortcut in computing these costs, which involves four scenarios. In the first scenario, the edge related to the expansion cost of city h in the previous iteration is broken. In the second scenario, the edge related to the second expansion cost of city h is broken; in the third scenario, the edge related to the third expansion cost of city h is broken, and in the fourth scenario none of the three expansion edges is broken. In the first scenario the expansion cost, second expansion cost, and third expansion cost are assumed to be the smallest three of four quantities: the two expansion costs of city h computed on the two newly formed edges and its second and third expansion costs in the last iteration. In the second scenario they are taken as the smallest three of a slightly changed set of four quantities: the two expansion costs of city h computed on the two newly formed edges and its expansion cost and third expansion cost computed in the earlier iteration. In the third scenario, the four quantities are now the two expansion costs of city h computed on the two newly formed edges and its expansion cost and second expansion cost from the earlier iteration. In the fourth scenario, first, second, and third expansion costs are taken as minimum costs of five quantities, that is, two expansion costs on two newly formed edges and first, second, and third expansion costs of the previous iteration. The condition “w
h
i
l
e all h in τ
′ not visited” ensures that cost of all uninserted cities is computed. The outer loop chooses the city for insertion that has maximum cost difference (7).


## 5.1. Design of Fast Cheapest Insertion Heuristic (FCIH)

We can devise a new but faster heuristic based on CIH on the basis of simple geometrical principle. Consider the subtour “a
b
c
d
e
f
a” in Figure 1.Figure 1
Subtour “a
b
c
d
e
f
a” showing principle of fast CIH.In Figure1 it can be seen that g
,
h
,
i are the cities yet to be inserted. For each of these cities, the cheapest insertion edge is a
b. The final shape of the tour depends on the order in which these three edges are inserted. If city i is inserted first, then edge a
b will be deleted and the edges i
a and i
b will be added. In the new subtour a
i
b
c
d
e
f
a it is now a genuine possibility that the cheapest insertion for city h becomes edge a
f, since edgeab is no longer present. In this case, we will need to traverse the entire current subtour a
i
b
c
d
e
f
a to determine the new cheapest insertion for h. However, if city g had been inserted first instead of city i then edge a
b is deleted and new edges g
a and g
b are added. In this case most likely situation becomes that h is inserted in the newly added edge g
a, requiring only inspection of the newly added edges g
a and g
b.In interim summary, if we encounter the scenario in Figure1 during the construction of a tour using CIH, then, for the sake of computational efficiency, we would hope that city i is not chosen as the first of the three to be inserted. However, some reflection will reveal that the position of city i in this scenario is unlikely in the first place. It is well known that CIH grows tours “outwardly.” This means that the cities not in the subtour lie outside the periphery of the subtour, rather than inside it, such as we see with city i in Figure 1. By exploiting this property, we can propose a variant of CIH that only inspects the recently added edges in each iteration, even for the cities whose earlier cheapest edge is broken. Though no longer guaranteeing the “cheapest” insertion, intuition suggests that this would lead to a favourable tradeoff, with at most minor loss of quality set against significant benefit in speed. In this “fast CIH” heuristic, the total number of computations of expansion costs (now independent of details of the dataset) is given below:(8)
N
c
=
2
×
n
-
1
+
n
-
2
+
n
-
3
+
⋯
+
3
+
2
+
1
=
n
n
-
1
.Meanwhile, since one expansion cost involves traversal of 3 edges, the total number of edges traversed for computation of expansion costs is given by(9)
N
e
=
3
n
n
-
1
.The time complexity of “fast CIH” is therefore O
(
n
2
), which is below the average complexity of CIH. Note that fast CIH runs in the order O
(
n
2
) on any dataset (with best case, worst case, and average case scenarios all equivalent). A full procedural summary of this new “fast cheapest insertion” heuristic (FCIH) is given in Procedure 1.Procedure 1:Fast cheapest insertion heuristic (FCIH).
Procedure FCIH starts
Form circular linked list of citiesτ
′ not in the subtour
Form empty Linked listτ
Choose an arbitrary cityp
∈
τ
′
Deletep from the list τ
′
Insertp in the empty list τ
Initialize expansion costs of subtourτ by insertion w.r.t. all h in τ
′ to very high value
while
τ
′ is not empty do begin
do begin (Visit all h in τ
′)
L
e
t
δ
1 = Cost of insertion of city h on 1st newly formed edge
δ
[
2
] = Cost of insertion of city h on 2nd newly formed edge
δ
[
3
] = c
o
s
t
τ
,
h
If   expansion cost edge is broken in last iteration
then  c
o
s
t
τ
,
h
=
min
⁡
∀
r
∈
1,2
δ
[
r
]
else    c
o
s
t
τ
,
h
=
min
⁡
∀
r
∈
1,2
,
3
δ
[
r
]
end if
while all h in τ
′ not visited
Choose cityq in τ
′ such that c
o
s
t
τ
,
q
=
min
⁡
∀
h
∈
T
c
o
s
t
τ
,
h
Deleteq from the list τ
′
Insertq in τ on the edge connected to c
o
s
t
τ
,
q
end while
Procedure FCIH endsThe first five lines of “Procedure1” establish the initial tour. Expansion of this initial tour is then implemented in the remainder of the procedure. The inner loop in the remainder is used to compute the expansion cost c
o
s
t
τ
,
h for each city h (the definition of this cost is given in (5)). However, a short cut is used to compute this cost, by computing the expansion cost on only two newly formed edges. There are two potential scenarios associated with this shortcut: in the first scenario, the edge related to the expansion cost of this city in the previous iteration is broken, and in the second scenario it has survived. In the first scenario, the new expansion cost of the city h in the current iteration is assumed to be the minimum of the two expansion costs of city h computed on the two newly formed edges; in the second scenario, the difference is that wealso consider the expansion costs of city h computed in the previous iteration. The condition “w
h
i
l
e all h in τ
′ not visited” ensures that the cost of all uninserted cities is computed. The outer loop chooses the city for insertion that has the lowest expansion cost.


## 5.2. Design of Fast Largest Insertion Heuristic (FLIH)

In contrast to CIH, tours constructed by LIH do not grow “outwardly,” and the situation in Figure1, where one of the currently unvisited cities lies inside the periphery of the current subtour, is a common occurrence. We cannot therefore design a faster version of LIH on the same basis used for FCIH. However, in the case of LIH a different approximate assumption can be made which may help avoid computing expansion costs on all edges of the current subtour. Referring again to Figure 1: if city i is inserted in the subtour first, the new subtour a
i
b
c
d
e
f
a is formed, breaking the edge a
b as a result. Now in this case, as discussed earlier, city h might not make its cheapest insertion with newly formed edges a
i and i
b. However, there is a genuine possibility that city h makes its 2nd cheapest insertion with a
i or i
b. This leads us to the idea of a fast version of LIH in which we approximate, rather than guarantee, the cheapest insertion, while scanning at most four edges in each iteration of the construction process. In detail, in each iteration we only need to keep a record of the 2nd expansion cost in addition to the (1st) expansion cost for each city not in the subtour. In turn, we find the 2nd expansion cost of a city by scanning at most only four edges: the two newly formed edges, along with the expansion cost edge and 2nd expansion cost edge of the previous iteration. If either of the latter two were broken in the previous iteration, then we can simply use the remaining three edges to (approximately) update the expansion cost and 2nd expansion cost in the new iteration. Again, the resulting heuristic, FLIH, has complexity O
(
n
2
), independently of details of the dataset. A procedural summary of fast largest insertion heuristic (FLIH) is given in Procedure 2.Procedure 2:Fast largest insertion heuristic (FLIH).
Procedure FLIH starts
Form circular linked list of citiesτ
′ not in the subtour
Form empty Linked listτ
Choose an arbitrary cityp
∈
τ
′
Deletep from the list τ
′
Insertp in the empty list τ
Initialize expansion costs and 2nd expansion costs w.r.t. allh in τ
′ to very high value
while
τ
′ is not empty do begin
do begin (Visit all h in τ
′)
Let
δ
[
1
] = Cost of insertion of city h on 1st newly formed edge
δ
[
2
] = Cost of insertion of city h on 2nd newly formed edge
δ
[
3
] = c
o
s
t
τ
,
h
δ
[
4
] = c
o
s
t
2
τ
,
h
If    expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
4
δ
[
r
]
else if   2nd expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3
δ
[
r
]
else      ∀
n
∈
1,2
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,4
δ
[
r
]
end if
while all h in τ
′ not visited
Choose cityq in τ
′ such that c
o
s
t
τ
,
q
=
max
⁡
∀
h
∈
T
c
o
s
t
τ
,
h
Deleteq from the list τ
′
Insertq in τ on the edge connected to c
o
s
t
τ
,
q
end while
Procedure FLIH endsIn common with Procedure1, the first five lines of “Procedure 2” establish the initial subtour, while the remainder concern its expansion. In the inner loop, the expansion cost c
o
s
t
τ
,
h and second expansion cost c
o
s
t
2
τ
,
h are calculated for each city h (see (5) and (6), resp.). The costs are calculated on the basis of two newly formed edges, and the detail of the procedure concerns three potential scenarios that may arise. In the first scenario, the edge related to the expansion cost of city h in the previous iteration is broken. In the second, the edge related to thesecond expansion cost of city h is broken; in the third scenario, none of the expansion edges is broken. In the first scenario the new expansion cost and second expansion cost of city h are taken to be the two minimum expansion costs of three quantities: the two expansion costs of city h computed on the two newly formed edges and its second expansion cost in the last iteration. In the second scenario, the three quantities are now the two expansions costs computed on the two newly formed edges (as before) and its expansion cost computed in the previous iteration. Finally, in the third scenario, the two costs are taken as the smallest two of four quantities: the two expansion costs of city h computed on the two newly formed edges and its expansion cost and second expansion cost computed in the earlier iteration. The condition “w
h
i
l
e all h in τ
′ not visited” ensures that cost of all uninserted cities is computed. The outer loop chooses the city for insertion that has largest expansion cost.


## 5.3. Design of Fast Max Difference Insertion Heuristic (FMDIH)

Faster design of MDIH is possible on a similar basis to that used in faster design of FLIH. A key difference between LIH and FLIH is that, in each iteration, LIH calculates only the expansion costs for the unvisited cities, while FLIH (approximately) computes both the expansion costs and the 2nd expansion costs. By going “one step further” in this sense, FLIH facilitates much faster update of this information, while sacrificing some exactness. To extend the same principle to fast MDIH, we will go “one step further” in the computations required for the city selection rule in MDIH. In MDIH, city selection requires both the expansion cost and the 2nd expansion cost for each city not in the subtour (7). Therefore, we can design a fast MDIH that additionally computes and records the 3rd expansion cost of each city not in the subtour. This means we need to record at most five edges per iteration: the two newly added, plus the expansion, 2nd expansion, and 3rd expansion cost edges from the previous iteration. As with FLIH, if one of the latter three was broken in the current iteration, we will simply rely on the others to provide approximations. A detailed procedural summary of the fast max difference insertion heuristic (FMDIH) is given in Procedure 3.Procedure 3:Fast max difference insertion heuristic (FMDIH).
Procedure FMDIH starts
Form circular linked list of citiesτ
′ not in the subtour
Form empty Linked listτ
Setup initial subtour of three cities(
p
1
,
p
2
,
p
3
)
∈
τ
′
Delete(
p
1
,
p
2
,
p
3
) from the list τ
′
Insert(
p
1
,
p
2
,
p
3
) in the empty list τ
Initialize expansion costs, 2nd expansion costs and 3rd expansion costs w.r.t. allh in τ
′ to very high value
while
τ
′ is not empty do begin
do begin (Visit all h in τ
′)
Let
δ
[
1
] = Cost of insertion of city h on 1st newly formed edge
δ
[
2
] = Cost of insertion of city h on 2nd newly formed edge
δ
[
3
] = c
o
s
t
τ
,
h
δ
[
4
] = c
o
s
t
2
τ
,
h
δ
[
5
] = c
o
s
t
3
τ
,
h
If    expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
4,5
δ
[
r
]
else if   2nd expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,5
δ
[
r
]
else if   3rd expansion cost edge is broken in last iteration
then   ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,4
δ
[
r
]
else     ∀
n
∈
1,2
,
3
c
o
s
t
n
τ
,
h
=
min
n
⁡
∀
r
∈
1,2
,
3,4
,
5
δ
[
r
]
end if
while all h in τ
′ not visited
Choose cityq in τ
′ such that cost difference D
(
q
)
=
max
⁡
[
∀
h
∈
T
c
o
s
t
(
τ
,
h
)
-
c
o
s
t
2
(
τ
,
h
)
]
Deleteq from the list τ
′
Insertq in τ on the edge connected to c
o
s
t
τ
,
q
end while
Procedure FMDIH endsIn “Procedure3”, again, the initial subtour is computed by the first five lines, and the remainder expands it. The inner loop of the remainder is used to compute the expansion cost c
o
s
t
τ
,
h, the second expansion cost c
o
s
t
2
τ
,
h, and the third expansion cost c
o
s
t
3
τ
,
h for each city h. The definitions of these costs are given in (5) and (6). The details of the inner loop achieve a shortcut in computing these costs, which involves four scenarios. In the first scenario, the edge related to the expansion cost of city h in the previous iteration is broken. In the second scenario, the edge related to the second expansion cost of city h is broken; in the third scenario, the edge related to the third expansion cost of city h is broken, and in the fourth scenario none of the three expansion edges is broken. In the first scenario the expansion cost, second expansion cost, and third expansion cost are assumed to be the smallest three of four quantities: the two expansion costs of city h computed on the two newly formed edges and its second and third expansion costs in the last iteration. In the second scenario they are taken as the smallest three of a slightly changed set of four quantities: the two expansion costs of city h computed on the two newly formed edges and its expansion cost and third expansion cost computed in the earlier iteration. In the third scenario, the four quantities are now the two expansion costs of city h computed on the two newly formed edges and its expansion cost and second expansion cost from the earlier iteration. In the fourth scenario, first, second, and third expansion costs are taken as minimum costs of five quantities, that is, two expansion costs on two newly formed edges and first, second, and third expansion costs of the previous iteration. The condition “w
h
i
l
e all h in τ
′ not visited” ensures that cost of all uninserted cities is computed. The outer loop chooses the city for insertion that has maximum cost difference (7).


## 6. Experiments and Results

This section consists of four subsections. In Section6.1 we report experiments that evaluate each of the five types of initial subtour establishment rules described in Section 3 allowing us to “configure” and complete the new MDIH. Later in Section 6.2 performance of MDIH is compared with all baseline heuristics considered in this paper, that is, NIH, FIH, CIH, and LIH. In Section 6.3 the cost based insertion heuristics, that is, CIH, LIH, and MDIH, are compared with their faster versions FCIH, FLIH, and FMDIH. Finally in Section 6.4 the focus of our evaluation is to investigate the potential for FMDIH as a new O
(
n
2
) heuristic for fast approximate solution of TSPs, by comparing it with the current best-regarded O
(
n
2
) heuristic, that is, FIH.Experiments are conducted on 109 datasets, involving from 14 to 15112 cities from a popular test bed [14]. For each heuristic and problem instance, 30 simulations are run independently, and we record the best, worst, and average solutions, the standard deviation in solution quality, and the average execution time. For the majority of experiments we provide summary statistics in this section (volume of results data precludes otherwise); however a full description of results is provided in an appendix for the FMDIH and FIH tests. The hardware used in the experiments was an Intel® Core™ i3-2348 M CPU @ 2.30 GHz, 8.0 GB Memory, with 64 bit operating system. The heuristics were coded in Microsoft Visual Studio C/C++.


### 6.1. Experiments to Finalize Initial Tour Establishment Step of Max Difference Insertion Heuristic (MDIH)

First of all, in Table1 we can see a summary of the results for MDIH with the five different strategies for generating the initial subtour. The heuristics named MDIH-1 to MDIH-5 represent MDIH using methods (i) to (v) as described in Section 3. Each column in Table 1 refers to a certain statistical value in relation to deviation from the known optimal solution. The mathematical description of each of those values is given below, where C
1 to C
5 in (10)–(14), respectively, represent the quantities in columns 1–5 in Table 1:(10)
C
1
=
a
v
g
j
=
1
j
=
N
min
⁡
∀
i
∈
S
γ
i
j
,
(11)
C
2
=
a
v
g
j
=
1
j
=
N
max
⁡
∀
i
∈
S
γ
i
j
,
(12)
C
3
=
a
v
g
j
=
1
j
=
N
a
v
g
i
=
1
i
=
S
γ
i
j
,
(13)
C
4
=
a
v
g
j
=
1
j
=
N
a
v
g
k
=
1
k
=
S
γ
k
j
-
a
v
g
i
=
1
i
=
S
γ
i
j
,
(14)
C
5
=
a
v
g
j
=
1
j
=
N
a
v
g
i
=
1
i
=
S
t
i
j
,whereγ
i
j
=
(
v
i
j
-
v
0
j
)
/
v
0
j
×
100,
a
v
g
i
=
1
i
=
S
γ
i
j
=
(
∑
i
=
1
i
=
S
γ
i
j
)
/
S,
N means number of datasets which equals 109,
S means number of simulations which equals 30,
v
i
j means cost of solution of a simulation i on a dataset j,
v
0
j means cost of optimal solution of a dataset j.Table 1
Results of MDIH with five different initial subtour establishment rules.
Name
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0)
(1)
(2)
(3)
(4)
(5)
MDIH-1
4.56
12.12
7.37
1.78
0.45
MDIH-2
4.53
11.28
6.75
1.50
0.45
MDIH-3
4.47
9.09
6.50
1.12
0.46
MDIH-4
4.56
9.65
6.71
1.29
0.48
MDIH-5
4.64
8.59
6.34
0.99
0.46In Table1, it can be seen that MDIH-5 has the best average solution quality. Its average quality for worst solution is also among the best, while its standard deviation is also the best of the five. Only on one criterion, average of best solution, its performance is worst among all. However, the difference between the best and worst values for this statistic is only 0.17%, and we propose that it can be ignored in favour of choosing method (v) as the appropriate initial subtour establishment rule for MDIH and FMDIH.


### 6.2. Experiments to Compare Performance of All Baseline Heuristics NIH, CIH, LIH, FIH, and MDIH

Table2 summarises the results of the five tour construction heuristics NIH, CIH, LIH, FIH, and MDIH, with MDIH configured to use the fifth initial tour establishment rule. (The results for MDIH are already in Table 1 but are copied into Table 2 for convenient comparison.) From the results it can be seen that performance of MDIH is best among all heuristics on all five criteria. For example, the average deviation from the optimal solution for MDIH is 4.64%, and there is a relatively sharp decline until we come to the second best on this category, which is FIH at 7.27%. It seems that the performance of FIH is second best (to MDIH) in all criteria except standard deviation. Meanwhile, LIH seems to show the worst performance among those examined, on all criteria except the average deviation from the best solution. Closer inspection of the full results, however, shows that the relatively poor figures for LIH derive from a notable failure on only one problem instance, BRG180. On this instance its best solution is 260% (average + 22 standard deviations) away from the optimal, and its worst solution is 2032.82% (average + 59 standard deviations) away from the optimal. This dataset brings out the worst performance from each of the heuristics and is clearly a particularly unusual example with a structure that deviates from the vast majority of TSPs. In fact this problem arises from a participant-comparison metric in a cards-playing tournament, and performance of any heuristic on it is therefore not reflective of performance on cases where the matrix contents are more closely associated with physical distances. We therefore decided that omitting this dataset would lead to a more useful cross-comparison of the heuristics, and the outcome of that for the remaining 108 datasets is given in Table 3; MDIH is preserved as the best performer in all categories, while LIH is now third best.Table 2
Results of 5 different tour construction heuristics.
Name
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0)
(1)
(2)
(3)
(4)
(5)
NIH
17.91
25.74
21.17
2.55
0.62
CIH
14.27
18.90
16.64
1.27
0.48
LIH
11.18
34.48
23.69
5.93
0.42
FIH
7.27
14.96
10.16
1.99
0.63
MDIH
4.64
8.59
6.34
0.99
0.46Table 3
Results of 5 different tour construction heuristics after removing noise (dataset BRG180).
Name
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0)
(1)
(2)
(3)
(4)
(5)
NIH
17.78
22.37
20.10
1.25
0.63
CIH
14.26
18.82
16.61
1.25
0.48
LIH
8.88
15.97
12.01
1.74
0.42
FIH
6.84
12.89
9.51
1.52
0.64
MDIH
4.35
8.18
6.00
0.95
0.46In Figure2 we attempt to visualise the performance of these five heuristics as a function of the number of cities, with number of cities on the horizontal axis, the vertical axis being percent difference of average solution of 30 simulations from the optimal solution. Since there is dense accumulation of datasets up to 2000 cities, the picture is not very clear up to this point. However after this point the pattern is quite clear. It can be seen that heuristics follow two different patterns of rise and falls of graph. One pattern is followed by MDIH, FIH, and LIH, while CIH and NIH follow another pattern. The MDIH-FIH-LIH pattern is dominated by MDIH, followed by FIH. While the CIH-NIH pattern is dominated by CIH. Notably, we can see that MDIH is not bettered by any of the other heuristics as we move beyond the 2000 city mark.Figure 2
Graph showing average solution performance of heuristics.To make the picture clear for datasets up to the 2000 cities another graph in Figure3 is presented. This graph removes the results of datasets more than 2000 cities to make picture clear for smaller problems. However even in this graph picture is not clear up to 200 cities as there is a dense accumulation of datasets up to this point. However picture beyond 200 mark is quiet clear. Again seemingly there are two patterns, one followed by CIH-NIH and another followed by MDIH-FIH-LIH. Former is dominated by CIH and latter is dominated by MDIH. In overall picture mostly MDIH graph dominates all the other graphs.Figure 3
Graph showing average solution performance of heuristics up to 2000 city datasets.


### 6.3. Experiments to Compare Performance of Cost Based Insertion Heuristics with Their Faster Counterparts

We turn now to the fast approximate variants of these heuristics. Table4 shows comparative results for the standard and fast/approximate variants of CIH, LIH, and MDIH. From the table it can be seen that there are statistically only small differences between the standard and fast variants across all the four criteria. The largest difference between any standard and fast variant occurs in the case of CIH and is in favour of the faster method, with FCIH solution quality on average deviating 13.99% from optimal, compared with 14.26% for CIH. In all cases, the fast method naturally provides a significant advantage in execution time, with a reduction of 70–80% from the execution time of the standard variant.Table 4
Comparison of standard heuristics with their faster designs.
Name
Category
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0a)
(0b)
(1)
(2)
(3)
(4)
(5)
CIH
Standard
14.26
18.82
16.61
1.25
0.48
Fast
13.99
18.84
16.46
1.29
0.1
LIH
Standard
8.88
15.97
12.01
1.74
0.42
Fast
9.02
16.19
12.24
1.79
0.11
MDIH
Standard
4.35
8.18
6.00
0.95
0.46
Fast
4.3
8.27
6.02
0.99
0.14We also performed statistical tests (Student’st-test) to investigate whether or not there was any significant difference in solution quality between the standard and faster versions. While comparing results between CIH and FCIH based on a confidence level of 95%, it was found that CIH performed better than FCIH in 17 out of 108 datasets, while FCIH performed better than CIH on 10 out of 108 datasets. Similarly, while comparing results between LIH and FLIH it was found that LIH performed better than FLIH on only 2 out of 108 datasets while FLIH performed better than LIH in 18 out of 108 datasets. While comparing results between MDIH and FMDIH it was found that MDIH performed better than FMDIH in only one out of 108 datasets while FMDIH performed better than MDIH in 3 out of 108 datasets. From these results it is clear that the new heuristics detailed in this paper are competitive in solution quality with the original slower versions; moreover, when there is a statistical difference in quality, this is more often than not (with the exception of CIH versus FCIH) in favour of the faster heuristic. We would conclude that the faster heuristics are generally worth applying to save computational time, with the risk to jeopardise solution quality being balanced by a similar chance of improved solution quality.We note that a detailed performance comparison among the faster designs is not necessary, since the performance characteristics of the faster designs clearly echo those of the standard designs; therefore comparison among faster versions of heuristics reflects the same comparative analysis that was done among standard versions in Table3.


### 6.4. Experiments to Compare Performance of FMDIH and FIH

Since MDIH has turned out to be best among all heuristics in the above experiments and its faster version FMDIH has provided same solution quality equal to MDIH with reduced time complexity equal to FIH, this shows a leap forward in the achievement of solution quality with time complexity ofO
(
n
2
). To test whether or not this advantage is statistically significant we have given comparison of FMDIH with FIH in Appendix with full detail and commentary along with statistical tests. In terms of the columns in Tables 2–4, we simply note here that the FMDIH summary values are, in order of the columns, as follows: 4.30, 8.27, 6.02, 0.99, and 0.14. These are to be compared with the FIH summary values from Table 3, which are, respectively, 6.84, 12.89, 9.51, 1.52, and 0.64. Here however we visualise the relative performance of FMDIH and FIH (previously the best reported O
(
n
2
) tour construction heuristic) with Figure 4, again using the same axes as in Figures 2-3. It can be seen in Figure 4 that FMDIH is consistently better than FIH throughout the dataset spectrum, with the advantage even apparent in the dense area of problem instances smaller than 2000 cities.Figure 4
Graph showing performance comparison between FMDIH and FIH.


## 6.1. Experiments to Finalize Initial Tour Establishment Step of Max Difference Insertion Heuristic (MDIH)

First of all, in Table1 we can see a summary of the results for MDIH with the five different strategies for generating the initial subtour. The heuristics named MDIH-1 to MDIH-5 represent MDIH using methods (i) to (v) as described in Section 3. Each column in Table 1 refers to a certain statistical value in relation to deviation from the known optimal solution. The mathematical description of each of those values is given below, where C
1 to C
5 in (10)–(14), respectively, represent the quantities in columns 1–5 in Table 1:(10)
C
1
=
a
v
g
j
=
1
j
=
N
min
⁡
∀
i
∈
S
γ
i
j
,
(11)
C
2
=
a
v
g
j
=
1
j
=
N
max
⁡
∀
i
∈
S
γ
i
j
,
(12)
C
3
=
a
v
g
j
=
1
j
=
N
a
v
g
i
=
1
i
=
S
γ
i
j
,
(13)
C
4
=
a
v
g
j
=
1
j
=
N
a
v
g
k
=
1
k
=
S
γ
k
j
-
a
v
g
i
=
1
i
=
S
γ
i
j
,
(14)
C
5
=
a
v
g
j
=
1
j
=
N
a
v
g
i
=
1
i
=
S
t
i
j
,whereγ
i
j
=
(
v
i
j
-
v
0
j
)
/
v
0
j
×
100,
a
v
g
i
=
1
i
=
S
γ
i
j
=
(
∑
i
=
1
i
=
S
γ
i
j
)
/
S,
N means number of datasets which equals 109,
S means number of simulations which equals 30,
v
i
j means cost of solution of a simulation i on a dataset j,
v
0
j means cost of optimal solution of a dataset j.Table 1
Results of MDIH with five different initial subtour establishment rules.
Name
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0)
(1)
(2)
(3)
(4)
(5)
MDIH-1
4.56
12.12
7.37
1.78
0.45
MDIH-2
4.53
11.28
6.75
1.50
0.45
MDIH-3
4.47
9.09
6.50
1.12
0.46
MDIH-4
4.56
9.65
6.71
1.29
0.48
MDIH-5
4.64
8.59
6.34
0.99
0.46In Table1, it can be seen that MDIH-5 has the best average solution quality. Its average quality for worst solution is also among the best, while its standard deviation is also the best of the five. Only on one criterion, average of best solution, its performance is worst among all. However, the difference between the best and worst values for this statistic is only 0.17%, and we propose that it can be ignored in favour of choosing method (v) as the appropriate initial subtour establishment rule for MDIH and FMDIH.


## 6.2. Experiments to Compare Performance of All Baseline Heuristics NIH, CIH, LIH, FIH, and MDIH

Table2 summarises the results of the five tour construction heuristics NIH, CIH, LIH, FIH, and MDIH, with MDIH configured to use the fifth initial tour establishment rule. (The results for MDIH are already in Table 1 but are copied into Table 2 for convenient comparison.) From the results it can be seen that performance of MDIH is best among all heuristics on all five criteria. For example, the average deviation from the optimal solution for MDIH is 4.64%, and there is a relatively sharp decline until we come to the second best on this category, which is FIH at 7.27%. It seems that the performance of FIH is second best (to MDIH) in all criteria except standard deviation. Meanwhile, LIH seems to show the worst performance among those examined, on all criteria except the average deviation from the best solution. Closer inspection of the full results, however, shows that the relatively poor figures for LIH derive from a notable failure on only one problem instance, BRG180. On this instance its best solution is 260% (average + 22 standard deviations) away from the optimal, and its worst solution is 2032.82% (average + 59 standard deviations) away from the optimal. This dataset brings out the worst performance from each of the heuristics and is clearly a particularly unusual example with a structure that deviates from the vast majority of TSPs. In fact this problem arises from a participant-comparison metric in a cards-playing tournament, and performance of any heuristic on it is therefore not reflective of performance on cases where the matrix contents are more closely associated with physical distances. We therefore decided that omitting this dataset would lead to a more useful cross-comparison of the heuristics, and the outcome of that for the remaining 108 datasets is given in Table 3; MDIH is preserved as the best performer in all categories, while LIH is now third best.Table 2
Results of 5 different tour construction heuristics.
Name
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0)
(1)
(2)
(3)
(4)
(5)
NIH
17.91
25.74
21.17
2.55
0.62
CIH
14.27
18.90
16.64
1.27
0.48
LIH
11.18
34.48
23.69
5.93
0.42
FIH
7.27
14.96
10.16
1.99
0.63
MDIH
4.64
8.59
6.34
0.99
0.46Table 3
Results of 5 different tour construction heuristics after removing noise (dataset BRG180).
Name
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0)
(1)
(2)
(3)
(4)
(5)
NIH
17.78
22.37
20.10
1.25
0.63
CIH
14.26
18.82
16.61
1.25
0.48
LIH
8.88
15.97
12.01
1.74
0.42
FIH
6.84
12.89
9.51
1.52
0.64
MDIH
4.35
8.18
6.00
0.95
0.46In Figure2 we attempt to visualise the performance of these five heuristics as a function of the number of cities, with number of cities on the horizontal axis, the vertical axis being percent difference of average solution of 30 simulations from the optimal solution. Since there is dense accumulation of datasets up to 2000 cities, the picture is not very clear up to this point. However after this point the pattern is quite clear. It can be seen that heuristics follow two different patterns of rise and falls of graph. One pattern is followed by MDIH, FIH, and LIH, while CIH and NIH follow another pattern. The MDIH-FIH-LIH pattern is dominated by MDIH, followed by FIH. While the CIH-NIH pattern is dominated by CIH. Notably, we can see that MDIH is not bettered by any of the other heuristics as we move beyond the 2000 city mark.Figure 2
Graph showing average solution performance of heuristics.To make the picture clear for datasets up to the 2000 cities another graph in Figure3 is presented. This graph removes the results of datasets more than 2000 cities to make picture clear for smaller problems. However even in this graph picture is not clear up to 200 cities as there is a dense accumulation of datasets up to this point. However picture beyond 200 mark is quiet clear. Again seemingly there are two patterns, one followed by CIH-NIH and another followed by MDIH-FIH-LIH. Former is dominated by CIH and latter is dominated by MDIH. In overall picture mostly MDIH graph dominates all the other graphs.Figure 3
Graph showing average solution performance of heuristics up to 2000 city datasets.


## 6.3. Experiments to Compare Performance of Cost Based Insertion Heuristics with Their Faster Counterparts

We turn now to the fast approximate variants of these heuristics. Table4 shows comparative results for the standard and fast/approximate variants of CIH, LIH, and MDIH. From the table it can be seen that there are statistically only small differences between the standard and fast variants across all the four criteria. The largest difference between any standard and fast variant occurs in the case of CIH and is in favour of the faster method, with FCIH solution quality on average deviating 13.99% from optimal, compared with 14.26% for CIH. In all cases, the fast method naturally provides a significant advantage in execution time, with a reduction of 70–80% from the execution time of the standard variant.Table 4
Comparison of standard heuristics with their faster designs.
Name
Category
Average of best solution% age
Average of worst solution% age
Average of average solution% age
Average of standard deviation% age
Average of execution timeseconds
(0a)
(0b)
(1)
(2)
(3)
(4)
(5)
CIH
Standard
14.26
18.82
16.61
1.25
0.48
Fast
13.99
18.84
16.46
1.29
0.1
LIH
Standard
8.88
15.97
12.01
1.74
0.42
Fast
9.02
16.19
12.24
1.79
0.11
MDIH
Standard
4.35
8.18
6.00
0.95
0.46
Fast
4.3
8.27
6.02
0.99
0.14We also performed statistical tests (Student’st-test) to investigate whether or not there was any significant difference in solution quality between the standard and faster versions. While comparing results between CIH and FCIH based on a confidence level of 95%, it was found that CIH performed better than FCIH in 17 out of 108 datasets, while FCIH performed better than CIH on 10 out of 108 datasets. Similarly, while comparing results between LIH and FLIH it was found that LIH performed better than FLIH on only 2 out of 108 datasets while FLIH performed better than LIH in 18 out of 108 datasets. While comparing results between MDIH and FMDIH it was found that MDIH performed better than FMDIH in only one out of 108 datasets while FMDIH performed better than MDIH in 3 out of 108 datasets. From these results it is clear that the new heuristics detailed in this paper are competitive in solution quality with the original slower versions; moreover, when there is a statistical difference in quality, this is more often than not (with the exception of CIH versus FCIH) in favour of the faster heuristic. We would conclude that the faster heuristics are generally worth applying to save computational time, with the risk to jeopardise solution quality being balanced by a similar chance of improved solution quality.We note that a detailed performance comparison among the faster designs is not necessary, since the performance characteristics of the faster designs clearly echo those of the standard designs; therefore comparison among faster versions of heuristics reflects the same comparative analysis that was done among standard versions in Table3.


## 6.4. Experiments to Compare Performance of FMDIH and FIH

Since MDIH has turned out to be best among all heuristics in the above experiments and its faster version FMDIH has provided same solution quality equal to MDIH with reduced time complexity equal to FIH, this shows a leap forward in the achievement of solution quality with time complexity ofO
(
n
2
). To test whether or not this advantage is statistically significant we have given comparison of FMDIH with FIH in Appendix with full detail and commentary along with statistical tests. In terms of the columns in Tables 2–4, we simply note here that the FMDIH summary values are, in order of the columns, as follows: 4.30, 8.27, 6.02, 0.99, and 0.14. These are to be compared with the FIH summary values from Table 3, which are, respectively, 6.84, 12.89, 9.51, 1.52, and 0.64. Here however we visualise the relative performance of FMDIH and FIH (previously the best reported O
(
n
2
) tour construction heuristic) with Figure 4, again using the same axes as in Figures 2-3. It can be seen in Figure 4 that FMDIH is consistently better than FIH throughout the dataset spectrum, with the advantage even apparent in the dense area of problem instances smaller than 2000 cities.Figure 4
Graph showing performance comparison between FMDIH and FIH.


## 7. Conclusions and Future Work

In this paper a previously unpublished tour construction heuristic, namely, the largest insertion heuristic (LIH), is introduced. It is shown that LIH completes the set of well-known popular tour insertion heuristics (cheapest, nearest, and farthest) and seems to produce better solution quality than cheapest and nearest insertion heuristics on the great majority of datasets. Furthermore, this paper also introduces max difference insertion heuristic (MDIH). It is based on a max difference concept previously introduced in [11] as a way to engineer variants of other heuristics; however in this paper we have argued that, following its “completion” by defining an initial subtour establishment method, it merits “first-class” status as a heuristic in itself, alongside others of the same type. The resulting heuristic MDIH produced better solutions on average than all the other baseline heuristics considered in this paper. Furthermore, we have introduced complexity curtailing techniques that reduced worst case complexity of cost based insertion heuristics, that is, CIH, LIH, and MDIH, from O
(
n
3
) to O
(
n
2
), resulting in the development of their faster versions FCIH, FLIH, and FMDIH. It is shown that the faster versions do not statistically produce inferior solutions but reduce computational cost up to 80%. The development of FMDIH proved a leap forward in production of quality solutions among community of O
(
n
2
) complexity heuristics. This is because it has performed 3.5% on average better than FIH on a wide spectrum of popular datasets. We believe this is the first time that FIH has been demonstrated to be outperformed by an O
(
n
2
) heuristic on a wide spectrum of popular test bed. Our immediate future work in this direction is inspired by complexity curtailing techniques. What if these techniques are introduced in other higher order heuristics to reduce their complexity. We believe more interesting results are yet to come.



---

*Source: 4786268-2016-08-23.xml*