1 Introduction

The Travelling Salesman Problem (TSP), a classical example of NP (non-deterministic polynomial) problem, was first investigated in more detail in the 1950s (Garey and Johnson 1979). The classic TSP aims to determine the shortest path across a set of randomly located cities. (Each city is visited once and only once, except for the starting point.) In other words, TSP is a shortest route planning, whose solution is a minimum Hamiltonian circuit. However, many practical applications exhibit a dynamic behaviour, such as transportation planning (Niendorf and Kabamba 2015; Niendorf et al. 2016), communication design (Boryczka and Strak 2012), workload distribution (Mavrovouniotis and Yang 2013), IoT analysis and optimisation (Bessis et al. 2012; Xu et al. 2013), as well as disaster management (Reina et al. 2014). Hence, such TSP models need to be adaptive, and often real-time, in order to obtain the most appropriate description.

The Dynamic Travelling Salesman Problem (DTSP) is an extension of TSP, which has the following supplementary features (Kang et al. 2004; Li et al. 2006):

  • Real-time The weights of the links between nodes may change probabilistically with time;

  • Robustness Allows for unexpected situations which require timely response (e.g. nodes may randomly join or quit the system);

  • Efficiency DSTP requires an optimal or sub-optimum solution in a finite time.

Typical algorithms for solving DTSP mainly include ant colony algorithms (ACA) (Mavrovouniotis and Yang 2013; Melo et al. 2013) and genetic algorithms (GA) (Falcon and Nayak 2010), which generally make appropriate adjustments based on changes in the environment, such as varying travelling cost between cities. However, in this case it is often computationally expensive to identify the optimal solution in a short time, due to the numerous sudden changes in parameter values.

In this article, we propose a new algorithm named GORTS, which is based on the integration of DTSP with a genetic algorithm defined by a one-by-one revision of two sides. Combining the global search ability of the GA and the fast convergence of the method of one-by-one revision of two sides, we show that this method can achieve accurate solutions in shorter time. In particular, the method of one-by-one revision of two sides is adopted to modify the multiple chromosomes initialised by the genetic algorithm, and the elitist strategy is used to select the optimal solution. Subsequently, the crossover and mutation operations identify the optimal solution.

The rest of the article is organised as follows. In Sect. 2, we discuss the current state-of-the-art approaches and methods for solving TSP and DTSP. Section 3 presents the details of the mathematical DTSP model. In Sects. 4 and 5, we introduce and discuss the GORTS algorithm, and in Sects. 6 and 7, the experimental results and the prototype logistics system for supermarket with GORTS are presented. Finally, Sect. 8 concludes the paper by summarising the main contributions of this work and commenting on future directions of investigation.

2 Related work

Significant research on the classical TSP model and versions with different constraint conditions has been carried out. This includes TSP models with time windows Li et al. (2015) and the minimum ratio TSP Cook (2011), which mainly focus on determining the minimal Hamiltonian circuit for a single travelling salesman. On the other hand, within the DTSP, the parameters related to each node may change dynamically and it can be seen as a combined series of TSPs Li (2013).

2.1 TSP algorithms

Currently, the algorithms for solving TSP can be divided into accurate and approximate algorithms. The former mainly include the dynamic programming algorithm Mahfoudh et al. (2015), the branch and bound Ghadle and Muley (2014), and integer linear programming algorithm Singh and Mehta (2014). However, these algorithms can only address small-scale TSP, as their complexity increases exponentially with the number of nodes. The latter include heuristic algorithms such as the ant colony optimisation algorithm (ACO) Alves and Lopes (2015), the particle swarm optimisation algorithm (PSO) Avin et al. (2012), the genetic algorithm(GA) Yuan et al. (2013), which have been widely accepted for their suitability at identifying better solutions in a reasonable time. However, their efficiency tends not to match up with the abrupt rates of change present in the DTSP system parameters. Therefore, a variety of fusion algorithms have been proposed.

2.2 DTSP algorithms

Following the introduction of the DTSP with a single objective in 1988 (Mavrovouniotis et al. 2016), most of the research has mainly focused on the definition of the problem, algorithm design, performance measurement, or on the test platform construction. Melo et al. Melo et al. (2013) attempted to address the DTSP via the ant colony optimisation algorithm. This type of algorithm tends to quickly converge to obtain the optimal solution based on the pheromone produced by ants, where previous pheromone trajectories can accelerate the optimisation process. However, this scheme is only suitable for DTSP with small environmental changes.

If the number of nodes varies significantly, the optimisation process needs to be recalculated. Cheng and Yang (2009) proposed a genetic algorithm based on the elite immigration strategy. The best population in the previous generation produce individuals through mutation operations, who will replace the least suitable ones in the current generation. Compared with the original GA, it has better adaptability and can optimise the quality of the solution. However, if there are large-scale nodes, the algorithm often needs to iterate several times to converge and cannot meet the real-time requirement. Gharehchopogh et al. Gharehchopogh and Farahmandian (2012) proposed to combine ACO with GA to find the optimal solution, more suitable for severe variations. Nonetheless, its computational overhead is relatively high. Blackwell (2004) proposed a new mutant PSO approach, specifically designed for dynamic environments. This algorithm extends the diversity of particle swarm in a single population and can find a better solution in the case of environmental change. However, the diversity increases the cost of the algorithm and affects the usability in contexts involving real-time processes.

3 DTSP modelling

The objective of TSP is to find the shortest path across a set of randomly located cities, or in other words, to obtain the minimum Hamiltonian circuit. Regarding their different constraints and limitations, TSP models can be extended to include specific features of practical interest, such as the TSP versions with multiple salesmen, or TSP models with multiple objectives, DTSP, etc.

Let \(G = G(V,E)\) be a graph, where \(V = \{v_{1}, \ldots , v_{n}\}\) represents the set of vertices and denote the set of edges by \(E = \{d_{i,j}: d_{i,j} > 0, d_{i,i} = 0, i,j \in N\}\). In the TSP model, \(i \in N\subset \{1, \ldots , n\}\) represents the city number, and \(d(v_{i}, v_{j})\) the distance between cities i and j. If TSP is symmetric, then we have \( d(v_{i}, v_{j}) = d(v_{j}, v_{i})\).

The optimal solution of TSP comes in the form of a path \(V = (v_{1}, v_{2}, \ldots ,v_{n})\), minimising the value of the following objective function:

$$\begin{aligned} f(V) = \sum _{i=1}^{n-1} d(v_{i}, v_{i+1}) + d(v_{n}, v_{1}). \end{aligned}$$
(1)

The decision variables are defined as

$$\begin{aligned} x_{i,j}=\left\{ \begin{array}{ll} 1 \quad \hbox {if } (i,j) \in L \\ 0 \quad \hbox {if } (i,j) \not \in L \end{array} \right. \end{aligned}$$
(2)

where L is the solution sequence. The model of TSP can be formulated as a linear programming in the form given below

$$\begin{aligned} \min {D(L)}= & {} \sum _{i \not = j} d_{i,j} x_{i,j} \end{aligned}$$
(3)
$$\begin{aligned} \sum _{i \in V, i \not = j} x_{i,j}= & {} 1 \end{aligned}$$
(4)
$$\begin{aligned} \sum _{j \in V, i \not = j} x_{i,j}= & {} 1 \end{aligned}$$
(5)
$$\begin{aligned} \sum _{i, j \in V} x_{i,j}= & {} |L|, \quad L \subset E \end{aligned}$$
(6)

The objective of Eq. 3 is to minimise the total distance. Equations 4 and 5 ensure that all the salesmen’s itineraries must begin and end at the same point. Equation 6 ensures that the Hamilton circuit does not have any sub loop.

The main feature of DTSP is the time-varying matrix of road distance, which can be defined as:

$$\begin{aligned} D(t) = \{d_{ij}(t)\}_{n(t)\times n(t)}, \end{aligned}$$
(7)

where t is the period of a dynamic change, \(d_{ij}(t)\) is the distance between cities i and j, and n(t) is number of cities at moment t.

The difficulty of solving DTSP is proportional to the changes of n(t) and D(t), and inversely proportional to the time interval \(\varDelta t\) of environmental change. The more significantly n(t) changes, the weaker the inter-connection between TSPs in each time interval is; the higher performance of algorithm we require, and the greater the difficulty of solving the problem becomes.

A natural question arises. How can we deal with the information changing continuously? This is addressed by defining a suitable sampling. Figure 1 shows a simple network with 3 nodes, as well as the cost of each directed edge. From the graph, we can easily get the initial optimal access order, i.e. \(0 - c_{1} - c_{2} - c_{3} - 0\), and the initial travel time is 38 min. If a salesman arrives at \(c_1\) and a traffic congestion occurs on the way from \(c_1\) to \(c_2\), this may increase the travelling time cost by 30 minutes, if the route is not changed. However, if the route gets real-time updates, the travelling time cost can be reduced significantly.

Fig. 1
figure 1

Simple network

Fig. 2
figure 2

a Initial H circuit b New H circuit

Suppose that: 1) the traffic information between cities can be known in advance, and 2) the scale of the city, the distance between cities, and other parameters are fixed during the sampling period. We define DTSP as a combination of different TSP in different sampling period, where

  • TSP(t) is used to represent TSP at different times;

  • \(d_{ij}(t)\) represents the distance between city i and city j;

  • n(t) is the scale of TSP at time t;

  • H(i) is the serial number of city;

  • \(\varDelta t\) is the sampling period;

  • \(\varDelta d_{ij}\) is the variation of \(d_{ij}(t)\) in \(\varDelta t\), and \(\varDelta n\) is the change of city number in \(\varDelta t\);

  • T is the time period, and

  • N is the sampling times in each \(\varDelta t\).

The objective value of DTSP is the sum of objective values of all TSP within period T. Therefore, DTSP can be defined as

$$\begin{aligned} {\text {TSP}}(t)= & {} \left\{ \begin{matrix} {\text {TSP}}_{1} &{} 0\le t\le \varDelta t \\ {\text {TSP}}_{2} &{} \varDelta t< t \le 2\varDelta t\\ \cdots &{} \\ {\text {TSP}}_{N} &{} (N -1)\varDelta t < t \le N \varDelta t \end{matrix}\right. \end{aligned}$$
(8)
$$\begin{aligned} \min d(T)= & {} \sum _{i=1}^{N}\sum _{j=1}^{n(i \varDelta t)}d_{H(j)H(j+1)}(i\varDelta t) \end{aligned}$$
(9)
$$\begin{aligned} \varDelta t= & {} \frac{T}{N} \end{aligned}$$
(10)
$$\begin{aligned} \frac{\varDelta d_{ij}}{\varDelta t}= & {} 0 \end{aligned}$$
(11)
$$\begin{aligned} \frac{\varDelta n}{\varDelta t}= & {} 0 \end{aligned}$$
(12)

4 Description of the GORTS algorithm

4.1 Basic idea

The dynamics of DTSP is defined by the scale of the problem and the time variation of the cost matrix change. This dynamical aspect affects the performance and effectiveness of the algorithm and determines how to choose the appropriate algorithm. If the system exhibits a stable behaviour, a local optimisation algorithm is used to obtain an acceptable approximate solution. Otherwise, a global optimisation algorithm is necessary. The application of a GA often requires to iterate several times to converge to get the satisfactory solution for TSP. However, in DTSP it is generally required that the algorithm can converge to reach the optimal solution with fewer iterations. The method of one-by-one revision of two sides Yuan et al. (2013) aims to continuously optimise the solution via several iterations. Its process of calculation is fast. However, the algorithm is greatly affected by the initial solution and may fall easily into a local optimum.

In this article, we combine the method of one-by-one revision of two sides with GA to introduce the new GORTS algorithm. This algorithm inherits the global search ability of GA and uses the method of one-by-one revision of two sides to correct chromosomes, which speeds up the process of convergence to meet the real-time requirements.

4.2 The method of one-by-one revision of two sides

The method of one-by-one revision of two sides is an approximate algorithm for obtaining the optimal Hamiltonian circuit, suitable for the case with a large number of vertices.

Fig. 3
figure 3

a Complete graph b Updated initial circle c Better H circuit

Suppose that \(G = (V ,E)\) is a connected undirected graph. The cycle, which joins each vertex of G exactly once, is called a Hamiltonian circuit of G. Suppose that \(W(v_{i},v_{j})\) is the weight of the link between the vertices \(v_{i}\) and \(v_{j}\), then

$$\begin{aligned} D(T)= & {} \{d_{ij}(t)\}_{n(t)\cdot n(t)} \end{aligned}$$
(13)
$$\begin{aligned} d_{ij} = d_{ji}= & {} \left\{ \begin{matrix} W(v_{i},v_{j}) &{} \qquad \quad \text {if } (v_{i},v_{j})\in E \\ 0 &{} \text {if } i = j \end{matrix}\right. \end{aligned}$$
(14)

The optimum H circuit is the cycle on G with the smallest total weight. The workflow of finding the optimum H circuit is as follows:

Step 1 Draw the initial Hamiltonian circuit randomly, as shown in Fig. 2,

$$\begin{aligned} C_{0}=v_{1},v_{2},\dots ,v_{i},\dots ,v_{j},\dots ,v_{n},v_{1}; \end{aligned}$$
(15)

Step 2 For all \(i,j,1< i + 1< j < n\), if

$$\begin{aligned} W(v_{i},v_{j})+W(v_{i+1}, v_{j+1}) < W(v_{i},v_{j+1})+W(v_{j},v_{j+1}), \end{aligned}$$
(16)

delete edges \((v_{i},v_{j+1})\) and \((v_{j},v_{j+1})\) in \(C_{0}\), and add edge \((v_{i},v_{j})\) and \(W(v_{i+1}, v_{j+1})\) to form a new Hamiltonian cycle, that is,

$$\begin{aligned} C=v_{1},v_{2},\dots ,v_{i},v_{j}, v_{j-1} \dots , v_{i+1},v_{j+1},\dots ,v_{n},v_{1}, \end{aligned}$$
(17)

as shown in Fig. 2.

Step 3 Repeat the above steps until the best H circuit is achieved.

Consider the complete graph as is shown in Fig. 2. Suppose that the weight of the initial circle \(C_{0} = v_{1},v_{2},\dots ,v_{6},v_{1}\) is 237, and \(w(1,4) + w(2,5) < w(1,2) + w(4,5)\), edges \((v_{1},v_{2})\) and \((v_{4},v_{5})\) need to be deleted to obtain a better H circuit C, that is, \(C = v_{1},v_{4},v_{3},v_{2},v_{5},v_{6},v_{1}\).

5 Genetic algorithm improvement

The genetic algorithm (GA) is known for its good global search ability, high efficiency, and good scalability in solving TSP (Fig. 3). However, GA needs many iterations to obtain the optimal solution in high-dynamic systems. The integration of the GA with the method of one-by-one revision of two sides can accelerate the speed of finding the ideal solution, based on the following workflow:

Step 1 Generate the initial population;

Step 2 Optimise each chromosome by the method of one-by-one revision of two sides, and use the optimised individual to replace the original one;

Fig. 4
figure 4

Implementation process of crossover operation

Fig. 5
figure 5

Mutation operation

Fig. 6
figure 6

The workflow of GORTS

Table 1 Parameters and set values
Table 2 Performance of GORTS and other algorithms with changes of distance between cities

Step 3 Execute operations of selection, crossover, and mutation on individuals in the population;

Step 4 Select the best individual in each generation.

Unsuitable implementations and various operations of encoding, crossover, or mutation may lead to different precision values, as well as the failure of the iterative process. Therefore, it is necessary to redesign the above operations.

5.1 Initial chromosome encoding

Suppose \(X = (x_{1},x_{2},\dots ,x_{i},\dots ,x_{n}\)), \(1 \le x_{i} \le x_{n_{i}}\) where \(n_{i}\) is the maximum of gene i. This requires genes to be encoded with different values at different bits. The length of chromosome is determined by the scale of the DTSP. The initialisation of chromosome is automatically generated with some heuristic algorithm, and the encoding method is to directly arrange nodes randomly.

5.2 Fitness function

The fitness function is used to differentiate the individuals in a group. High value of the fitness evaluation implies that an individual has a high probability of being chosen. The selection operation based on the fitness value is important to GA, which means that the fitness function determines the performance of GA. The fitness function is defined as

$$\begin{aligned} F(x) = 1 / D(x), \end{aligned}$$
(18)

where x represents an individual of a population, and D(x) is the evaluation value of x. Here, D(x) is defined as the distance travelled by individual. In this article, we use the reciprocal of D(x) as the fitness function.

5.3 Crossover operation

Two parent chromosomes, parent 1 and parent 2 are selected according to the crossover probability \(p_{c}\), which generates two intersection points. The segments \(\varDelta p_{1}\) and \(\varDelta p_{2}\) are subsequently selected according to the two intersection points. Child 1 assigns \(\varDelta p_{1}\) as the initial gene, while the same parts of parent 2’s chromosome are ignored. Finally, the remaining component is added to child 1. Likewise, child 2 is similarly generated. In this way, even if the two parents are identical, the new offspring can be generated iteratively to overcome the disadvantages of local optimisation and premature convergence.

As shown in Fig. 4, assuming there are 8 cities, the integers \(\{0,1,2,3,4,5,6,7\}\) are randomly selected to represent the two parents chromosomes. The randomly selected gene segment (e.g. 4, 6, 2, 3) of parent 1 is adopted as the initial gene of child 1, and the identical parts of parent 2’s chromosome are ignored. Finally, the remaining parts are added to child 1. Child 2 is generated in a similar manner.

Fig. 7
figure 7

Routes planned by GORTS with \(G = 5\) or \(G=10\)

5.4 Mutation operation

The mutation operation plays an important role in improving local search ability, maintaining variability of the population, and preventing the premature convergence of GA. The swapping mutation operation is based on the mutation probability. This will identify a mutated chromosome, and subsequently, two crossing points are randomly selected and swapped

As shown in Fig. 5, assuming again there are 8 cities, the sequence of integers corresponding to cities \((1,5,4,6,2,3,0,7)\) may represent a route scheme. Two selected swapping gene points are node pairs (3, 6), and (3, 5), which are exchanged to generate the offspring.

5.5 Selection strategy

A new selection strategy is adopted, and after crossover and mutation, the new individuals are put together with the original population. Subsequently, all the chromosomes are arranged from good to bad according to fitness values. The chromosomes, whose number is equal to the population size, are selected to the next iteration.

GORTS is designed as a global optimisation algorithm, suitable for dynamical environments with global changes, such as the change of distance between cities and the change of number of cities. In this article, DTSP is abstracted into a series of TSPs. This requires that GORTS has the strong convergence ability to get the better solution during the sampling period. The workflow of GORTS is shown in Fig. 6.

6 Experiments and protosystems

6.1 Performance criteria

According to Eq. 19, assume that the distance matrix of DTSP is a function of time. Therefore, a test case of the dynamical properties of DTSP can be generated by modifying the value of distance between two nodes

$$\begin{aligned} d_{ij}^{'} \leftarrow d_{ij} \times t_{ij} \end{aligned}$$
(19)

where \(t_{ij}\) represents the change on the edge between \(v_{i}\) and \(v_{j}\).

$$\begin{aligned} t_{ij} = \left\{ \begin{array}{l@{\quad }l} t_{ij}\leftarrow 1+r \in [F_{L},F_{U}], &{} \text {if } q \le m \\ t_{ij}\leftarrow 1, &{} \text {otherwise } \end{array}\right. \end{aligned}$$
(20)
Fig. 8
figure 8

Experimental results with \(G=5\) and \(G=10\)

Fig. 9
figure 9

Length of route planned with different algorithms

Fig. 10
figure 10

Iteration times

Fig. 11
figure 11

The geographical sites of ten stores at the Gulou District

where r is a random variable uniformly distributed in \([F_{L},F_{U}]\), q is a random variable uniformly distributed in [0,1], and m for \(0 < m \le 1\) defines the magnitude of the change. For every arc, a different r value is generated to embed real-world characteristics in the constructed DTSP. The offline performance Yang et al. (2009) is generally used as an important criteria in solving dynamic optimisation problems

$$\begin{aligned} {\overline{P}}_{\mathrm{OFF}}=\frac{1}{I}\sum _{i=1}^{I}\left( \frac{1}{E}\sum _{j=1}^{E}P_{ij}^{*}\right) \end{aligned}$$
(21)

where I is the total number of iterations, E is the number of independent executions, and \(P_{ij}^{*}\) is the best-so-far solution.

6.2 Experiments

We selected four representative datasets from TSPLIB Gerhard (2013) with different scales of cities, ranging from 52 to 318. The value of m is defined within [0, 0.25], [0, 0.5] or [0, 1] , to create different dynamic changes of the environment. Subsequently, GORTS is compared with typical heuristic algorithms, including the MAX-MIN ant system (MMAS) Stutzle and Hoos (1997), the population based on ACO (PACO) Guntsch and Middendorf (2002), the elitism-based immigrants ACO (EIACO) Mavrovouniotis and Yang (2013), and EIGA-GAPX Tinos et al. (2014). The experimental parameter values are set as follows:

Fig. 12
figure 12

The process of route adjusting

Fig. 13
figure 13

The process of route adjusting

As shown in Table 1, In Table 2 only MMAS has slightly better performance than GORTS with changes of distance between cities.

In the rest of the section, the performance of GORTS compared with algorithms with changes in the number of cities will be discussed. We selected four representative datasets from TSPLIB, including Eil51, Eil101, St70, Eil76, and defined DTSP (t) as follows:

$$\begin{aligned} {\text {DTSP}}(t)=\left\{ \begin{matrix} {\text {Eil51}} &{} 0 \le t \le \varDelta t \\ {\text {Eil101}} &{} \varDelta t< t \le 2\varDelta t \\ {\text {St70}} &{} 2 \varDelta t< t \le 3 \varDelta t \\ {\text {Eil76}} &{} 3 \varDelta t < t \le 4 \varDelta t \end{matrix}\right. \end{aligned}$$
(22)

We tested GORTS in different sample periods. Specific parameters are set as the following two groups:

  1. 1.

    If \(\varDelta t = 1s, G=5, P_{\text {size}}=10, p_{c}=0.80,\) and \(p_{m}=0.05\).

  2. 2.

    If \(\varDelta t = 2s, G=10, P_{\text {size}}=10, p_{c}=0.80,\) and \(p_{m}=0.05\).

As shown in Fig. 7, there is no cross in any routes, which indicates that the solution quality of GORTS is good. With the increase in the number of iterations, we can find that the quality of the solution is improved, as shown in Fig. 8. However, with respect to DTSP, it is necessary to find the optimal solution in a short time, which means reducing the number of iterations.

Furthermore, we compared the length of route planned with GORTS, the adaptive ACO algorithm (AACO) Liu et al. (2012), and the nearest neighbour method (NN) Wang (2014). As shown in Fig. 9, the length of route planned with GORTS is shorter than the length of route planned with NN but slightly longer than the length of route planned with AACO.

The dynamic properties of DTSP require the algorithm to quickly obtain the optimal solution. GORTS can reach this after 10 iterations in 2s, while the length of route planned by AACO with 10 iterations is much longer.

Fig. 14
figure 14

The process of route adjusting

As shown in Fig. 10, it can be seen that GORTS only needs 5 or 6 iterations to converge to satisfying results, while AACO needs to iterate 150 times to converge to satisfying results. The computation time increases with the increasing number of iterations.

7 Prototype implementation and testing

We applied GORTS to the logistics distribution planning system for large supermarket chains with distribution centre. Low efficiency in the logistics distribution planning system is likely to cause a waste of transport capacity and the high distribution costs. We implemented the logistics distribution planning system with the Baidu Map SDK based on the Android 4.2 platform. We selected ten supermarket stores at the Gulou District. The detailed locations of these ten stores are shown in Fig. 11 and below the Table. The distribution centre of the supermarket at the Hehui road (Sm-HH) is the starting point of distribution.

No.

Name of stores

Abbreviation

Latitude and longitude

1

JinYan Store

Sm-TY

(118.768708, 32.110693)

2

Gulou Community Store

Sm-CS

(118.733738, 32.023282)

3

Chunjiang Store

Sm-CJ

(118.763309, 31.968957)

4

Yongle Store

Sm-YL

(118.804406, 32.004606)

5

Hongyun Store

Sm-HY

(118.835017, 31.970562)

6

Xinfen Store

Sm-XF

(118.840049, 32.092209)

7

Guanhua Store

Sm-GH

(118.861029, 32.023088)

8

Maqun Store

Sm-MQ

(118.901653, 32.056732)

9

Xueheng Store

Sm-XH

(118.921983, 32.100508)

10

Xuzhuang Store

Sm-XZ

(118.889726, 32.088439)

Note that 0 represents the distribution centre. The initial logistics distribution route is: \(0\rightarrow 2\rightarrow 3\rightarrow 4\rightarrow 5\rightarrow 7\rightarrow 8\rightarrow 9\rightarrow 10\rightarrow 6\rightarrow 1\rightarrow 0\), as shown in Fig. 12a. The delivery of the goods depends on specific initial arrangement and the delivery route will be adjusted according to the real-time traffic. As shown in Fig. 12c, there is a traffic congestion along the route to Sm-YL (Fig. 13). Therefore, the rest route is recalculated, which is \(3\rightarrow 5\rightarrow 4\rightarrow 7\rightarrow 8\rightarrow 9\rightarrow 10\rightarrow 1\). Finally, on the way to Sm-XH, the route is adjusted as: \(8\rightarrow 10\rightarrow 9\rightarrow 6\rightarrow 1\), as shown in Fig. 14a. Compared with the initial route, the route planned with GORTS can be adaptive to to condition of traffic and save the cost of time.

8 Conclusion

TSP is an NP combinatorial optimisation problem, with important theoretical value and many applications. DTSP is an adaptation with usability in a realistic dynamic environment. GA is an intelligent search algorithm for simulating biological evolution, which is widely used in solving TSP. In this article, based on the analysis of DTSP theory and mathematical model, a genetic algorithm based on the method of one-by-one revision of two sides (GORTS) is introduced.

This method integrates the better global search ability of genetic algorithm, while improving the convergence speed of the algorithm by adding the method of one-by-one revision of two sides to correct the chromosome. Finally, GORTS was compared with other algorithms and the experimental results showed it can provide accurate solutions, while the reduced computational time ensures the algorithm is suitable for use for models involving dynamic environments.