You are on page 1of 14

Nested Simulated Annealing Algorithm

to Solve Large-Scale TSP Problem

Lei Yang1(B) , Xin Hu1 , Kangshun Li1 , Weijia Ji1 , Qiongdan Hu1 , Rui Xu1 ,
and Dongya Wang2
1
College of Mathematics and Informatics, South China Agricultural University,
Guangzhou 510642, China
yanglei s@scau.edu.cn
2
University of Exeter, College of Engineering, Mathematics and Physical Sciences,
Exeter EX4 4QF, UK

Abstract. Traveling Salesman Problem is one of the most valuable com-


bination optimization NP-hard in mathematics and computer science.
Simulated Annealing Algorithm is one of the better algorithms to solve
the TSP problem. However, with the increasing scale of the TSP prob-
lem, this algorithm also shows some limitations. That is, the solution
performance is poor, and the efficiency is low. This paper proposes a new
Nested Simulated Annealing Algorithm (NSA), which divides the megac-
ity group into small and medium-sized urban groups through recursive
diffusion and setting the threshold method. In this way, the large-scale
TSP problem can be transformed into small and medium-sized TSP prob-
lem at first. And then optimize the small and medium-sized TSP prob-
lem by using the Simulated Annealing Algorithm. Finally, synthesize a
whole to achieve the final optimization effect. In this paper, we use three
large-scale TSP problems in the TSPLIB database to test the proposed
algorithm and compare it with the traditional Simulated Annealing Algo-
rithm. The results show that the Nested Simulated Annealing Algorithm
proposed in this paper has better efficiency and effect than the original
algorithm in solving large-scale TSP problems.

Keywords: Large-scale TSP Problem · Nested Simulated Annealing


Algorithm · Recursive diffusion · K-means

1 Introduction
In the era of information explosion, the amount of information may be too large
to imagine. New requirements are necessary to put forward for the processing of
massive data. However, many non-linear and uncertain factors make it difficult
to establish accurate mathematical models for many problems. And the combi-
natorial optimization is just one of them, it is still an important issue when the
computer capacity cannot be broken, and the TSP problem is one of the NPC
problems that are difficult to solve completely through computer operations. The
TSP is described as follows: Given a series of cities and their coordinates, the
traveler is required to start from a certain city, then visit all the cities one by one,
c Springer Nature Singapore Pte Ltd. 2020
K. Li et al. (Eds.): ISICA 2019, CCIS 1205, pp. 473–487, 2020.
https://doi.org/10.1007/978-981-15-5577-0_37
474 L. Yang et al.

and each city only visits once, and finally returns to the starting city. The goal
is to find the path that is as small as possible. For a TSP problem with n cities,
the number of solutions is (n − 1)!/2 [10], if n is a small number, such as 10 or
100, under the great computing power of the computer, we can exhaustively find
the optimal path. With the increase of n, the scale of the solution has exploded,
the approximate infinity of the solution can be said to be the biggest problem
of large-scale TSP problem. For the number of approximate infinite solutions, it
is also difficult for computer algorithms to obtain quickly better solutions and
evaluate the solution.
With the increasing scale of the TSP problem, the exponential growth rate of
the solution scale makes the solution extremely complicated. Branch-and-bound
algorithm, branch-and-cut algorithm, cutting plane algorithm, plane discovery
algorithm, or branch and price are known as the most effective precise algo-
rithms. As an algorithm for solving large-scale TSP problem, the branch-and-
bound algorithm requires one or more loosely structured decisions. It can be
used to process TSP branches and cutting algorithms with 40 to 60 cities. Ralph
Gomory proposed cutting plane algorithm in the 1950s, which can solve inte-
ger programming and mixed-integer programming problems. The cutting plane
algorithm based on linear programming proposed by George Dantzig discovered
the exact solution of the 15112 German towns in TSPLIB in 2001, whose com-
putation time is equivalent to 22.6 years. In the branch and price algorithm,
the model of the original problem usually contains a large number of decision
variables [1]. Many experts and scholars at home and abroad have studied the
solution of large-scale TSP problem. However, there is still no perfect solution
to this problem, and no algorithm can solve all possible examples in polyno-
mial time [9]. The approximation algorithm achieves a good solution compared
to the precise algorithm but does not guarantee that the optimal solution will
be found. Therefore, if a small deviation can be accepted, an approximation
algorithm can be used to solve the large-scale TSP problems. It is necessary to
use heuristic algorithms (or approximation) to provide the best possible, but
not necessarily the best feasible solution. The Simulated Annealing Algorithm is
derived from the principle of solid annealing, starting from a certain higher ini-
tial temperature, with the continuous decline of temperature parameters. The
algorithm combines the probability jump feature to randomly find the global
optimal solution of the objective function in the solution space, i.e., the local
optimal solution can jump out probabilistically and eventually tend to be glob-
ally optimal. This algorithm is a probability-based algorithm [14], which regards
the initially disordered state as high temperature, and gradually finds the best
path by looking for stable low-temperature ordered state. It has been proved
to be an excellent and efficient algorithm with mild and fast convergence rate
and exceptional efficiency in solving TSP problems [8,15,16]. However, with the
increase of city scale, the Simulated Annealing Algorithm has low efficiency and
weak optimization effect when solving large-scale TSP problems.
Given the characteristics of large-scale TSP problems, this paper improves the
Simulated Annealing Algorithm by incorporating recursive diffusion strategies,
Nested Simulated Annealing Algorithm to Solve Large-Scale TSP Problem 475

which makes it more adaptable to large-scale TSP problems. Also, the speed and
efficiency of finding the optimal solution are improved. Then we test the proposed
algorithm using three large-scale TSP problems in the TSPLIB database and com-
pare it with the traditional Simulated Annealing Algorithm. The experimental
results verify the usefulness and effectiveness of the new algorithm.
The remainder of this study is organized as follows. Section 2 presents a dis-
cussion of the basic Simulated Annealing Algorithm. Our new Nested Simulated
Annealing Algorithm(NSA) is presented in Sect. 3. The experimental results and
discussion are shown in Sect. 4. Finally, Sect. 5 concludes this study and gives
future research directions.

2 Background
Because of the characteristics of large-scale TSP problems, this paper improves
the Simulated Annealing Algorithm. Both Diffusion-and-Clustering Strategies
and K-means clustering algorithms are used in this paper. So this section, we
will introduce these two basic algorithms.

2.1 Simulated Annealing Algorithm

The idea of the Simulated Annealing Algorithm was first put forward by
N. Metropolis et al., and it was introduced into the field of combinatorial opti-
mization by S. Kirkpatrick. The Simulated Annealing Algorithm is a stochastic
optimization algorithm based on the Monte-Carlo iterative solution strategy,
which utilizes the similarity between the general combinatorial optimization
problem and the annealing process of solid matter in physics [4]. The Simulated
Annealing Algorithm is derived from the principle of solid annealing. The solid
is warmed to a sufficiently high temperature and then allowed to cool slowly.
When heating, the internal particles of the solid become disordered with the
increase of heat, and its internal energy also increase. While slowly cooling, the
particles become more and more orderly and reaching an equilibrium state at
each temperature, finally reaching the ground state at normal temperature, and
its internal energy is also reduced to a minimum [6].
The Simulated Annealing Algorithm can be decomposed into three parts:
solution space, objective function, and initial solution. Simulated Annealing
Algorithm has nothing to do with the initial value. The solution obtained by
the algorithm is also independent of the initial solution state (i.e., the starting
point of algorithm iteration). The Simulated Annealing Algorithm is asymptot-
ically convergent and has been theoretically proved to be a global optimization
algorithm converging to the global optimal solution with probability 1. The Sim-
ulated Annealing Algorithm has parallelism [11].
Nested Simulated Annealing Algorithm to Solve Large-Scale TSP Problem
proposed in this paper calls the Simulated Annealing Algorithm twice. It is used
to calculate the shortest loop and the shortest path of the urban agglomerations,
and also the shortest path within the urban agglomeration.
476 L. Yang et al.

2.2 K-means Algorithm

Give a set of n data points, and the K-means algorithm is to divide them into k
groups in the d-dimensional Euclidean space r (i.e., clustering) [5].
The K-means algorithm first randomly selects K objects as the initial clus-
tering center, then calculates the distance between each object and each cluster
center, and assign each object to the cluster center closest to it. The cluster
centers and objects assigned to them represent a cluster. Once all objects are
allocated, the center of each cluster will be recalculated according to existing
objects in the cluster. This process will be repeated until a stopping criterion
is met [3]. The stopping criterion may be no objects are reassigned to different
clusters. No cluster centers are re-changed, or the Square sum of errors reaches
local minimum local [2].
The computational complexity of the K-means algorithm is O(N kn), where
N is the number of iterations, n is the number of cities, k is the number of
clusters. The criterion of the K-means algorithm is that the distance between
data points in each cluster is as close as possible, and each cluster is as far as
possible.
If X = {x1 , x2 , . . . , xn }, where X1 (l = 1, 2, . . . , k) is k partitions given by
K-means and E = {e1 , e2 , . . . , ek } represent the center of the k partitions, then
the objective function of the K-means algorithm is:
k
2
F = min xi − e1 (1)
l=1 xi ∈xl

The K-means algorithm has the advantages of simple implementation and


high efficiency, so it is suitable for clustering large-scale data sets.

3 The Nested Simulated Annealing Algorithm (NSA)


This section will describe the new algorithm as a whole. The general idea of
the new algorithm is to cluster the urban coordinate points of the large-scale
TSP problem into a cluster firstly, then to optimize the cluster path to form
the inter-cluster path. And then, intra-cluster optimization is performed to find
intra-cluster paths. Finally, an overall optimal path for large-scale TSP problems
will be found. The new algorithm is introduced from step 3.1 to step 3.4. And
step 3.5 will describe the new algorithm as a whole.

3.1 Clustering to Large-Scale Urban Agglomeration

The first step of the Nested Simulated Annealing Algorithm is to cluster. After
receiving the urban coordinate data from the total algorithm, they are clus-
tered by the clustering algorithm, then the cluster grouping is labeled after each
coordinate, and the central coordinate system E is generated to record the cen-
tral coordinates of each cluster at the same time. Two clustering algorithms
Nested Simulated Annealing Algorithm to Solve Large-Scale TSP Problem 477

are designed in the Nested Simulated Annealing Algorithm (NSA) proposed in


this paper. The first one is the improved K-means algorithm. Some appropriate
improvements are made to K-means to adapt to the total algorithm better. The
second one is the Diffusion Clustering Algorithm proposed in this paper.

The Improved K-Means Algorithm. K-means algorithm has the advan-


tage of simplicity and efficiency. Still, its disadvantage is that the initial center
position is random, and the number of clusters needs to be set manually. In
view of the above shortcomings and the characteristics of large-scale TSP prob-
lems, we have made appropriate improvements to make its position no longer
random and does not need to set the parameters manually, but automatically
generated. Thus, a cluster grid map with the average grid line distribution can
be obtained. For avoiding the over-concentration of initial points, each cluster
located intersection between horizontal and vertical lines of the grid (except for
the boundary).

Diffusion Clustering Algorithm. To transform the city into an urban


agglomeration, we assume the biggest difference between them is the distance.
Specifically, it is that an obvious isolation zone should be formed around each
urban agglomeration, which is separated from other urban agglomerations.
Therefore, the urban agglomeration is more likely to be regarded as a point
to calculate the shortest circuit between urban agglomerations. So there is the
idea of diffusion clustering. The idea of diffusion clustering is as follows: given a
distance (the distance from the shortest isolation belt), choose a city arbitrarily
firstly, then find other cities to determine whether there is a city with a dis-
tance less than the isolation zone. If there is, it will be incorporated into the
urban agglomeration. Then it will be recursively diffused until every city in the
urban agglomeration confirming that there is no other city in the distance. The
algorithm will ensure that distance between any point within the urban agglom-
eration and other urban agglomerations will be greater than a fixed value d max,
while there is at least one point within it that is less than d max. Thus isolation
between the urban agglomeration and the urban agglomeration will be formed.

3.2 Determine the Order of Large-Scale Urban Agglomeration


After the clustering of megacities, several clusters are formed. Each cluster can
be regarded as a point. The central coordinates of the clusters replace the coor-
dinates of this point. The Simulated Annealing Algorithm is used to find out the
best inter-cluster loop, that is, the order of urban agglomerations, to identify
the inter-cluster path of megacities.
As clustering, the center of each urban agglomeration has been set:
E = {e1 , e2 , . . . , ek } (2)
Using this point as the coordinates of urban agglomeration, we use the Sim-
ulated Annealing Algorithm to find out the optimal Hamiltonian circuit.
478 L. Yang et al.

3.3 The Choice of Border City in Urban Agglomerations


From the loop of large-scale urban agglomerations, the location of each urban
agglomeration in the loop can be determined. Next, we should determine the
path within the urban agglomeration. Before deciding the groups’ path, We
should define the boundary city in the urban agglomeration. It can deem as
a connection point with other urban agglomerations. Generally speaking, the
urban agglomeration needs to connect two cities from top to bottom, so it needs
two boundary cities at the beginning and the end. The inner part of the urban
cluster is not a loop but a single line. As a result, it only needs to establish the
head city, while the rear city is the head city of the next urban agglomeration.

3.4 Description of the Whole Algorithm


For large-scale TSP problems, the city size is too large, the number of solutions
for TSP problems with n cities is (n − 1)!/2 [7,10]. If n > 10000, then the
number of solutions is huge. The time it takes to find the optimal path is hard
to imagine or even impossible. To find a better path in as short a time as possible,
the new algorithm use cluster firstly, then the Simulated Annealing Algorithm
[12,13] is applied to urban agglomerations formed by clustering and cities in
urban agglomeration respectively to find their optimal path. Finally, they are
connected as a whole to reduce time.
The overall description of the algorithm is as follows:
Step 1, Divide TSP problem with tens of thousands of cities into several
urban agglomerations, that is, clustering;
Step 2, Consider the urban agglomeration as a point and use the Simulated
Annealing Algorithm to find the optimal Hamiltonian circuit;
Step 3, Identify a boundary city inside each urban agglomeration, i.e., the
city connected to other urban agglomerations. Thus a complete Hamiltonian
circuit can be formed afterward;
Step 4, After determining the boundary cities, the shortest path within the
urban agglomeration is determined by taking the boundary city as the head and
tail. Because it is an improvement of the Simulated Annealing Algorithm, we
still choose the Simulated Annealing Algorithm. The core of this algorithm is
double Simulated Annealing Algorithm and Clustering Algorithm;
Finally, we determined the order of the urban agglomeration and the order
of the inner cities in the urban agglomeration, and linked them into rings, i.e.,
the path we need.
Algorithm 1 shows the whole pseudo-code of the Nested Simulated Annealing
Algorithm.

4 Experiments and Comparisons


4.1 Experimental Explanation
TSP standard database TSPLIB for experimental is used in this paper. The
Nested Simulated Annealing Algorithm is written in the C# language on the
Nested Simulated Annealing Algorithm to Solve Large-Scale TSP Problem 479

Algorithm 1. Nested Simulated Annealing Algorithm


Require: coordinates[ ][ ]
Ensure: len, bestPath[ ] // centrePoint: central coordinates of each cluster and the
coordinates possessed by the cluster // centreList: optimal path loop of clusters
// cluster: algorithms for clustering // deterBound: algorithm for determining the
boundary city // saa: Simulated Annealing Algorithm
1: cluster(coordinates)
2: then get(centrePoint[ ][ ])
3: saa(centrePoint[ ][ ])
4: then get(centrePoint[ ][ ])
5: while i <centreList do
6: T = get(centreList[i])
7: deterBound(centrePoint[T ])
8: len+=saa(centrePoint[T ][ ])
9: Write(centrePoint[T ][ ], bestPath)
10: end while
11: return A

Visual Studio software. It runs on the platform of AMD Ryzen 5 2500U in mem-
ory 8G (software allocated memory with dynamic distribution, about 100M-2G).
The original Simulated Annealing Algorithm is abbreviated as SA (Simulated
Annealing Algorithm). The Nested Simulated Annealing Algorithms has two
algorithm models; one is the K-means clustering improved algorithm, which is
abbreviated as SA-KS (Simulated annealing algorithm-K-means). And the other
is the improved algorithm using diffusion clustering, which is abbreviated as SA-
SP (Simulated annealing algorithm-Spread).
Experiments compare the advantages and disadvantages of the two algo-
rithms. The comparison method is to find out the shortest path calculated at
the same time. The experimental interval is 5, 10, 15, 20, 25, 30, 40, 50, 60, the
unit is in seconds, and termination time is determined by whether the optimal
result is obvious or not. Since the simulated annealing algorithm is calculated
by continuous iteration, it is only necessary to set the number of iterations to
be close to infinity, and then insert the time for judgment. As long as the time
arrives, the distance is output to get the shortest path at that time.
The Nested Simulated Annealing Algorithm divides the data set into several
urban agglomerations for calculation. Therefore, it is necessary to divide the total
time into time segments and then distribute them to the urban agglomeration.
A uniform strategy is adopted at the beginning of the algorithm. And the result
shows that the time to find out the shortest path of SA-SP is often several times
that of other algorithms. It is finally found that the use of recursive diffusion clus-
tering makes it easy to form a large scale urban agglomeration and some small
scale urban agglomerations. Therefore, we use the principle of proportionality
for the time fragment of SA-SP. That is, the time segment of large-scale urban
agglomeration is large, while the time segment of small-scale urban agglomer-
ation is small. Due to the improvement of the previous algorithm, SA-KS can
form an urban agglomeration with about 100 cities. The error is about plus or
480 L. Yang et al.

Table 1. Experimental results of d15112

Time/min SA SA-KS SA-SP


5 66143147.6653943 66172344.3532432 99950532.283926
10 63625653.1995809 62488074.5813857 49847499.652352
15 55867564.3039949 40427092.2009234 40481877.233455
20 48155297.5289634 27777578.3184985 36235223.2523424
25 40250735.6080993 26539623.3342345 34252344.5223444
30 38130347.4113312 25439246.6989969 32077533.035223

minus three orders of magnitude during the experimental process. To avoiding


complicated calculations, the segments are divided evenly (Table 1).
The data sets selected in this paper are d15112, pla33810, rl5934. Among
them, the number of cities in d15112 is 15112, the number of cities in pla33810
is 33810, the number of cities in rl5934 is l5934. The data comes from https://
www.proxy.iwr.uni-heidelberg.de/groups/comopt/software/TSPLIB95/TSP/.

4.2 Experimental Results and Analysis

(1) d15112
Number of cities: 15112
Number of city groups formed by SA-KS: 151
Number of city groups formed by SA-SP: 153, Distance between boundary
cities: 250
From the chart, it can be intuitively felt that the shortest path obtained by
the new algorithm is better than the original algorithm. However, the result of
the new algorithm is inferior to the original algorithm at the beginning of 5 min,
which shows that the new algorithm is not superior to the original algorithm
at the beginning of the operation. With the increase of time, the convergence
speed of the new algorithm is greatly accelerated, while the original algorithm
that is relatively stable. The convergence speed of the new algorithm has a great
potential of opening and closing, which makes it nearly complete in 20 min.
However, the original algorithm is nearly complete in 30 min. That is to say, the
new algorithm not only achieves a shorter path but also takes a shorter time. It
shows that the efficiency of the new algorithm is better. Compared with the two
new algorithms, the final result of SA-KS is better than that of SA-SP (Figs. 1,
2, 3 and 4).
(2) pla33810
Number of cities: 33810
Number of city groups formed by SA-KS: 338
Nested Simulated Annealing Algorithm to Solve Large-Scale TSP Problem 481

Fig. 1. d15112 Compare the shortest Fig. 2. d15112 The shortest path dif-
path of the three algorithms ference between the new and the origi-
nal algorithms

Fig. 3. d15112 Compare the shortest Fig. 4. d15112 The shortest path dif-
path of the three algorithms ference between the new and the origi-
nal algorithms

Number of city groups formed by SA-SP: 548, Distance between boundary


cities: 2500
With the largest data volume in TSPLIB, Pla33810 has symbolic significance.
As can be seen from the graph set clearly, the limitation for large-scale TSP
problems of the original algorithm is that the calculation time is considerable.
From Fig. 7, the shortest distance calculated at 60 min for the original algorithm
is more than SA-KS, or even three times that of SA-SP.
Although it can be seen from Fig. 8 that the original algorithm still has the
space to decrease, the shortest path of SA-KS is half of it at 60 min. And SA-SP
is even one-fifth of it. The original algorithm only optimizes about one-third of
the shortest path in 60 min. It is inconceivable to spend very little time to get
the shortest path of the original algorithm. For this data set, the new algorithm
is undoubtedly superior to the original algorithm in both efficiency and effect
(Table 2).
482 L. Yang et al.

Table 2. Experimental results of pla33810

Time/min SA SA-KS SA-SP


5 6538118097.42389 3246265731.9917 1089159002
10 5815506732.03497 2450163420.09839 843617237
15 5432568869.1673 2049669371.06635 762447365
20 5093680637.42291 1970049125.26245 735888407
25 4882292916.0636 1969127618.50726 702342344
30 4729375010.53876 1952342342.32423 686448051
40 4466574081.10608 1939423422.32423 643463234
50 4252562812.41895 1934814233.78528 609214147
60 4082714139.03558 1933134134.23422 609135146

Fig. 5. pla33810 Compare the shortest Fig. 6. pla33810 The shortest path dif-
path of the three algorithms ference between the new and the origi-
nal algorithms

Compared with the two new algorithms, SA-SP is undoubtedly better.


Figure 5 shows that the shortest path of SA-SP tends to be stable five minutes
ahead of SA-KS. And the value is only half of that (Fig. 6).
(3) rl5934
Number of cities: 5934
Number of city groups formed by SA-KS: 59
Number of city groups formed by SA-SP: 352, Distance between boundary
cities: 25
The gap between the new algorithm and the old one both reaches the max-
imum in 20 min. After that, the shortest distance gap of algorithms begins to
decrease. The shortest distance of the SA-KS algorithm decreases greatly in the
first 20 min, while the original algorithm decreases uniformly in 60 min. And
finally, the original one reaches the same level as the SA-KS algorithm. That
is, the SA-KS algorithm achieves the effect of the original algorithm at 60 min
Nested Simulated Annealing Algorithm to Solve Large-Scale TSP Problem 483

Table 3. Experimental results of rl5934

Time/min SA SA-KS SA-SP


5 15932897.715384 12717264.5666647 1094287.34256053
10 15128362.9296885 3730546.88289547 1037325.64975929
15 14893925.9242811 3546742.95794344 927265.894996285
20 13831427.2653251 3022189.93628502 899818.836472754
25 12224572.3554425 2904052.15571928 871517.595030069
30 9418625.5698123 2885636.25743437 650327.521313071
40 6119607.55737066 2842333.03874254 334137.65235281
50 4483642.47985458 2897860.72196817 302343.235232734
60 3787122.49793386 2854062.5260334 283429.610421419

Fig. 7. pla33810 Compare the shortest Fig. 8. pla33810 The shortest path dif-
path of the three algorithms ference between the new and the origi-
nal algorithms

in 20 min. Although it is not like pla3810, which gets the effect with five min-
utes, it can also be regarded as a three-fold increase in efficiency. For SA-SP, its
advantages are distinct. For its efficiency, it reaches the optimal result in 5 min.
The shortest path obtained by SA-SP is also much better than the other two
algorithms (Table 3).

4.3 Analysis and Evaluation

Firstly, the difference between the NSA algorithms and the original algorithm is
compared. According to the above experimental results for the large-scale TSP
problem, the NSA algorithms are superior to the original algorithm in the efficient
and final result. The NSA algorithms obtain the optimal path within 25 min, while
the original algorithm generally takes 60 min. For most of the data, the NSA algo-
rithm can get an optimal path far beyond the original algorithm within 5 min, or
even just a fraction of it. After 20 min, the shortest path of the NSA algorithm
484 L. Yang et al.

Fig. 9. rl5934 Compare the shortest Fig. 10. rl5934 The shortest path dif-
path of the three algorithms ference between the new and the origi-
nal algorithms

Fig. 11. rl5934 Compare the shortest Fig. 12. rl5934 The shortest path dif-
path of the three algorithms ference between the new and the origi-
nal algorithms

is basically no longer updated. The original algorithm can also achieve the same
shortest path that the NSA algorithm can make on some data sets, but it takes sev-
eral times the time of the new algorithm. The original algorithm gets the shortest
path smoothly and gradually, while the NSA algorithm, especially SA-KS, gets the
shortest path more vigorously and rapidly. So the improvement of the NSA algo-
rithms is successful. Through the NSA algorithm’s basic ideas, we can know that
it first calculates the shortest path between urban agglomerations, laying a gen-
eral framework. The shortest path will not be too bad under this framework. This
is why the NSA algorithms can quickly get the shortest path. Then there is the
refinement calculation within the urban agglomeration. This process is completed
within 20 min, which is also the reason why SA-KS is difficult to make further
progress after 20 min. Because internal refinement has been achieved, it is chal-
lenging to continue to optimize. According to this principle, the original algorithm
can theoretically obtain a shorter optimal path than the NSA algorithm because
the shortest path of the new algorithm is limited to the urban group. Going to an
Nested Simulated Annealing Algorithm to Solve Large-Scale TSP Problem 485

urban group then returns to the original city. It is maybe the shortest distance.
But it takes a lot of time to get this result. From the above experimental result,
we can know it did not appear within 60 min. The original algorithm is stable at
60 min, so it is impossible to achieve the shortest path produced by the new algo-
rithm (Figs. 9, 10, 11 and 12).
Then compare the difference between the two NSA algorithms SA-KS and
SA-SP. From the experimental results, there are advantages and disadvantages.
For larger urban agglomerations, SA-KS has better results, while SA-SP is more
adaptable. The SA-SP has an excellent solution to address large-scale and small-
scale TSP problems. The reason is that they use different clustering algorithms.
SA-KS uses the improved K-means clustering algorithm to get urban agglomera-
tions. The SA-SP uses a recursive diffusion algorithm to easily form an oversized
urban cluster and several small-scale urban agglomerations. The experimental
time is proportionally distributed so that large-scale urban agglomerations can
calculate thoroughly.
During the experiment, it is easy to see the difference between the two kinds
of clustering. When obtaining the shortest path, SA-KS often has a sharp decline
in a certain period. This is because the size of urban agglomeration is similar, and
the allocation time is the same. With increases in time, the internal operation get
deepens in each urban agglomeration, and this is easy to form a superposition
effect. That is, every little reduction of each urban agglomeration is a lot of dis-
tance. SA-SP can be regarded as a combination of SA-KS and SA because of its
megacities. From the experimental chart, it can be seen that the SA-SP descent
process is relatively smooth, and the descent time is longer, too. SA-KS can
hardly be further explored after the stabilization of each urban agglomeration
(it is generally found in the experiment that this time is 20 min).
In summary, the two NSA algorithms have improved to a certain extent, and
SA-SP has better adaptability. SA-KS is better at processing some specific data
sets, especially large-scale data sets.

5 Conclusion
Although this experiment proves the feasibility of the Nested Simulated Anneal-
ing Algorithm, there is still room for further improvement. In the growth of
K-means in this paper, it automatically generates urban agglomerations with
about 100 cities, ignoring the total number of cities. For example, for 1000 cities,
only ten urban agglomerations are created, which is fatal for finding the short-
est path. This may be one of the reasons for the gap between SA-KS and the
original algorithm on small-scale TSP problems. As for SA-SP, firstly, it is a rel-
atively primitive method to input the boundary distance manually. It can try to
make a secondary improvement by determining the boundary distance through
the number of cities and the maximum value of city coordinates. Also, we can
automatically adjust the boundary distance and reclassify when the number of
city clusters is too large or too small.
486 L. Yang et al.

In the future, we will further study and improve the algorithm, then try
to investigate whether the NSA algorithm can be extended for other classical
combinatorial optimization problems.

Acknowledgments. This work was partially supported by the National Natural


Science Foundation of China (Grant Nos. 61573157 and 61703170), Science and
Technology Project of Guangdong Province of China (Grant Nos. 2018A0124 and
2017A020224004), Science and Technology Project of Tianhe District of Guangzhou
City(Grant No. 201702YG061), Science and technology innovation project for Col-
lege Students(Grant No. 201910564127). The authors also gratefully acknowledge the
reviewers for their helpful comments and suggestions that helped to improve the pre-
sentation.

References
1. Gao, J.: Hierarchical Solving Method for Large Scale TSP Problems. Master’s
thesis, Inner Mongolia University For Nationlities (2014)
2. Hu, X., Zhang, J., Qi, P., Zhang, B.: Modeling response properties of v2 neu-
rons using a hierarchical k-means model. Neurocomputing 134, 198–205 (2014).
https://doi.org/10.1016/j.neucom.2013.07.052
3. Huang, Q.: Based on Fusion on Feature-Level Image Technique Study Intelligent.
Master’s thesis, China University of Petroleum (2012)
4. Khan, N.A., Shaikh, A.: A smart amalgamation of spectral neural algorithm for
nonlinear lane-emden equations with simulated annealing. J. Artif. Intell. Soft
Comput. Res. 7(3), 215–224 (2017). https://doi.org/10.1515/jaiscr-2017-0015
5. Lam, Y.K., Tsang, P.W.: eXploratory k-means: A new simple and efficient algo-
rithm for gene clustering. Appl. Soft Comput. 12(3), 1149–1157 (2012). https://
doi.org/10.1016/j.asoc.2011.11.008
6. Li, J.: Color separation research and implementation based on printing and dyeing
CAD system. Master’s thesis, Zhejiang University (2004)
7. Liu, X.: The Application and Research of an Improved Genetic Algoruthm on the
TSP Problem. Master’s thesis, Harbin University of Science and Technology (2011)
8. Pan, J., Cheng, Z.G., Lv, J.Y.: Study on the TSP problem based on SA algorithm.
In: Applied Mechanics and Materials, vol. 687–691, pp. 1316–1319 (2014). https://
doi.org/10.4028/www.scientific.net/amm.687-691.1316
9. Shi, Z.: The single machine parallel-batching scheduling problem with family-jobs.
Master’s thesis, Zhengzhou University (2008)
10. Wang, P.: Research on Parallel Ant Colony Algorithm and Application. Master’s
thesis, Southwest Jiaotong University (2008)
11. Xiaoping, Z., Shengbowen, L.: Fetal electrocardiogram extraction based on inde-
pendent component analysis and particle swarm optimizer. Inf. Electron. Eng. 6
(2009)
12. Xie, Y.: A summary on the simulated annealing algorithm. Control Autom. 5,
66–68 (1995)
13. Yang, M., Gao, X., Li, L.: Improved bidirectional CABOSFV based on multi-
adjustment clustering and simulated annealing. Cybern. Inf. Technol. 16(6), 27–42
(2016). https://doi.org/10.1515/cait-2016-0075
14. Lu, Y.T., Lin, Y.Y., Peng, Q.Z., Wang, Y.Z.: A review of improvement and research
on parameters of simulated annealing algorithm. Coll. Math. 31(6), 96–103 (2015)

You might also like