A solution of TSP based on the ant colony algorithm improved by particle swarm optimization

TSP is a classic problem in the field of logistics, and ant colony algorithm is an important way to solve the problem. However, the ant colony algorithm has some shortcomings in practical application. In this paper, the ant colony algorithm is improved by particle swarm optimization algorithm, and the ant colony algorithm is obtained by giving the ant colony a certain ''particle property''. Finally, an example is given to demonstrate the effectiveness of the improved ant colony algorithm.

1. Introduction. The travelling salesman problem (TSP) asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?" It is an NP-hard problem in combinatorial optimization, important in operations research and theoretical computer science. Although the problem description is simple, the solution is quite difficult. Because of its strong practical significance, and effectively meet the traffic distribution, pipeline laying, logistics and transportation, network settings and other practical needs, has long attracted a large number of scholars to explore.
In recent years, with the vigorous development of bionic thinking, genetic algorithm, fish swarm algorithm, ant colony algorithm, bacterial foraging algorithm, artificial bee colony algorithm and so on a number of excellent algorithms have emerged, in which the ant colony algorithm on the TSP problem many. The ant colony algorithm originated from the natural ant foraging process, which was first proposed by the Italian scholar Dorigo and continuously improved. Compared with other traditional mathematical programming methods, the ant colony algorithm has strong stability, strong robustness, fast convergence, and has the advantages of distributed parallel computing structure, feedback information and heuristic search, and can dynamically respond and feedback The external influence in the process of path selection. Ant colony algorithm also has its inherent drawbacks. For example, when the problem is large, the convergence rate of the algorithm is slow, the operation time is long, and it is easy to fall into the local optimal solution.

MIAO YU
Santo believed that it could speed up the optimal solution convergence rate to accelerate the path transfer rules and local search of the improved equation; Ciornei provided a complementary approach to other algorithms through combining genetic algorithm with ant colony algorithm; Stützle came up with "Minimum ant colony system", and the system can be a kind of pheromone concentration control in a certain range, to avoid the algorithm convergence too fast. In this paper, some ideas based on particle swarm optimization algorithm are used to improve the ant colony algorithm, and the ant colony algorithm is used to solve the shortcomings of the predecessors' ideas.
2.1. The basic principle of ant colony algorithm. Ant colony algorithm, about the shortest path principle of ant foraging, originated from the research results of entomologists. Although the natural ants are not developed visually, they will leave a pheromone in the process of finding food that can be perceived by an ant in a range and affect their behavior. At the same time, the ant is accustomed to choosing the residual pheromone concentration of the road, when a road on the residual pheromone concentration increases, then it is the probability of ants will be increased, and then the concentration of pheromone will be more high, this process is consistent with the positive feedback mechanism, the ants of the self-catalytic behavior to form an organic enhanced learning system, through pheromone changes to find the shortest path to the current environment.
2.2. The basic model of ant colony algorithm. Take TSP as an example to discuss the basic model of ant colony algorithm.
Suppose: there are a total of n cities; e(i, j) indicates the path between the city i and the city j; τ ij (t) indicates the residual pheromone concentration of e(i, j) at t moment; there are a total of m ants; B i (t) (i = 1, 2, 3, . . . , n) indicates the number of ants in the city i at t moment, and m = m i=1 B i (t). Each time when passing a city, the ant will be recorded in the taboo list, to ensure the ant never repeat the previous path until the next cycle to start. The taboo list of the ant k is referred to as tabu k , and the city s in the taboo is referred to as tabu k (s). The action of each ant satisfies the following rules: (1) All ants will leave a certain amount of pheromone during the course of their actions, each with a path, which then leaves the pheromone of the ants.
(2) The pheromone left by all the individual ants is the same.
(3) All ants determine the moving route according to the pheromone concentration and the path length of each path, and the moving behavior obeys the probability function (Formula 1).
(4) Each city can only be accessed once before the process of traversing all cities, and the process is controlled by a taboo list.
At the time "t = 0", all path pheromone concentrations are equal and constant, expressed as τ ij (t 0 ) = C, of which C is a constant.
In the probability function (Formula 1), P k ij is the probability of the ant moving from the city i to the city j at the t moment; allowed k means the cities that ants have not been through, allowed k = {0, 1, 2, . . . , n − 1} − tabu k ; tabu k (k = 1, 2, 3, . . . , n) means the cities that ants have been through, changing with the movement of ants; η ij is the visibility between the city i and j; d ij is the distance between the city i and j; η ij = 1 dij ; α is the residual pheromone concentration of e(i, j), τ ij (t) is used to express influence on ants' transferring direction; β indicates the relative importance of visibility.
Ants in the process of transferring will release a certain amount of pheromone, thus enhancing the learning effect of the whole system to accelerate the convergence rate of the algorithm, which follows the model of Ant-Cycle (Formula 1): In Formula 1, In the above model, ∆τ k ij (t) indicates the pheromone concentration remaining on the path e(i, j) during the current cycle by the ant k at the t moment; ∆τ ij indicates the increments of pheromone concentration remaining on the path e(i, j) by the entire ant colony during this cycle; ρ is the volatilization coefficient, representing the persistence of the pheromone trajectory; Q represents the total amount of pheromone left by the ant colony, which is a constant; L k indicates the length of the path visited by the ant k during a cycle.
3.1. The basic idea of algorithm improvement. The ant colony algorithm has the advantages of positive feedback, good robustness and strong convergence, but the algorithm also has inherent shortcomings such as slow convergence, easy to get premature and easy to fall into the local optimal solution. Therefore, in this paper, the basic ant colony algorithm is improved by combining some of the PSO's ideas.
Because the basic idea of ant colony algorithm is to affect the behavior of other ants and even the whole ant colony through the pheromone left in the process of ant colony to convey information, the information is one of the key. And the disadvantage is that it may easily leads to the local optimal solution. The design concept of particle swarm algorithm (PSO) is based on what are such as information, single particle extremes and global particle extremes, as the basis of the next iteration position of particle. Therefore, the two algorithms not only have the information exchange, but also the global extremes and the individual particle extremes appearing in the particle swarm algorithm can solve the problem that the ant colony algorithm is easy to fall into the local optimal solution. In this paper, the ant is given a certain "particle", so that the ants in accordance with the particle swarm algorithm for global optimization, the final use of the local optimal solution and the global optimal solution to adjust to get the optimal solution. 3.2.1. Give the ant a certain "particle" to find the global extremes and local extremes. Particle swarm algorithm considers that the position of each particle in space is a possible solution to the problem, so that the particles in the space at a certain speed iteration multiple times, each iteration to a single particle optimal solution (local extremes) and the optimal solution of the whole particle (global extremes), and finally the optimal position can be approximated to find the optimal solution of the problem.
The location and update rules for particles (or the ants in the improved algorithm) are as follows: In the above equations, V = [v 1 , v 2 , . . . , v n ] indicates the velocity of the particle; X = [x 1 , x 2 , . . . , x n ] represents the current position of the particle; n is the dimension of the solution space; for the convergence factor γ, usually taken as 0.729, that is, the parameter ϕ = 4.1, ptbest indicating the individual extreme position, gtbest indicating the global extreme position; rand(0, 1) is the random number among (0, 1); c 1 , c 2 indicate the learning factors of particles, used to adjust the particle update step size; ω is the weighting factor.
In order to ensure that the particles pass each city only once, that is, the basic assumptions of TSP, this paper adds commutator and commutation order order to the basic particle swarm algorithm. The speed update formula after the transformation is: Where, α, β is random number; α(ptbest−X) indicates the commutator in the basic commutation order (pgbest − X) is reserved by a probability of α; β(pgbest − X) indicates the commutator in the basic commutation order (pgbest − X) is reserved by a probability of β; ⊕ indicates the merging factor of the two commutation orders.

3.2.2.
According to the local optimal solution and global optimal solution to adjust, get the optimal solution. Through the movement of each ant, the individual extremes ptbest and its location pcbest are obtained, and then the global extremes gtbest and the global extreme position gcbest are determined. The effect of each ant moving on the local optimal solution is as follows: the j ant's path e 0 (f ) crosses with gcbest to get e 0 (f ), then e 0 (f ) crosses with pcbest to get e * 0 (f ), and finally changes into e 0 (f ) by a certain Probability. The path's length is calculated according to the current position, and If the objective function becomes better, the new value is accepted; Otherwise it is refused, that is, the j ant's path is still e 0 (f ). Through the movement of ants, in turn adjust the local optimal solution, and finally get the global optimal solution. 4. The application process of improved ant colony algorithm. Step1. Preparation phase The number of initial iterations nc = 0; τ ij , ∆τ ij and other parameters are initialized,; the pheromone is left on e(i, j); m ants are randomly assigned at n initial points.

Step2. Record of initial value
From the current position of each ant, determine the length of each path, set it as individual extreme value ptbest, the ant position is set to the individual extreme position pcbest, and according to the initial data of each ant, find the global extreme value gtbest and global extreme position gcbest.

Step3. Ants move
The ant moves from the current position to the next position by a probability of p k ij .
Step4. Taboo changes The current position of the ants and the transfer to the new position according to the probability p k ij are recorded in the current taboo table.
Step5. The optimal solution during a cycle In a cycle, each ant changes to the new position according to the probability, through the path length of the change, the local optimal solution of the adjustment, and ultimately get the global optimal solution of this cycle.
Step6. Pheromone strength updates The pheromone strength remaining on the trajectory is updated according to the Ant-Cycle model (Formula 2 above).
Step7. Iterate and output the optimal solution Cycle the implementation of Step3-Step6, if the maximum number of iterations to achieve or multiple iterations multiple times without any better solution, the current output value, as the optimal solution.
The flow chart is as follows (Figure 1): 5. Case study.

Initial calculation.
In order to test the effectiveness of the improved ant colony algorithm after particle swarm optimization, this paper takes the logistics distribution process happened among 17 prefecture-level cities in Henan Province of China as an example. In order to verify the reliability of the improved ant colony algorithm, this paper simplifies the logistics network of Henan to the logistics and transportation problem among 17 prefecture-level cities in Henan province. Through GPS positioning, this paper selects one observation point in each prefecture-level city, a total of 17 test points, the relative geographical location of the points and the specific latitude and longitude as follows (Table 1): 5.2. Program simulation. The initial parameters are set as follows: The number of ants m = 30; the influence of pheromone concentration on the direction of ant transfer α = 1.5; the relative importance of visibility β = 2; the number of volatiles ρ = 0.9; and the maximum number of iterations is 50.  The simulation results of the basic ant colony algorithm are shown as follows ( Figure 2): The shortest path obtained by the basic ant colony algorithm is shown in Figure  1, and a feasible shortest path is: Restore to the corresponding city, followed by: The shortest path length is 16.7814. Using the improved ant colony algorithm to solve the simulation results as shown ( Figure 3): The shortest path obtained by the improved ant colony algorithm is shown in Figure 1, and a feasible shortest path is: 1 → 4 → 7 → 11 → 8 → 17 → 9 → 15 → 6 → 14 → 16 → 12 → 10 → 2 → 3 → 13 → 5 Restore to the corresponding city, followed by: Zhengzhou → Jiaozuo → Luoyang → Sanmenxia → Nanyang → Zhumadian → Pingdingshan → Xuchang → Luohe → Xinyang → Zhoukou → Shangqiu → Puyang → Anyang → Hebi → Xinxiang → Kaifeng The shortest path length is: 16.2823. 6. Conclusion. In this paper, the ant colony algorithm and TSP problem are analyzed and studied, and then the ant colony algorithm is improved by referring to the idea of particle swarm optimization to improve the quality of ant colony algorithm. Taking the logistics distribution process happened among 17 prefecturelevel cities in Henan Province of China as an example; the transportation scheme is solved by MATLAB software to guide the logistics transportation. The results show that the improved ant colony algorithm is effective and feasible.