Dynamic ant colony algorithm based on cw saving Value

As a swarm intelligence optimization algorithm, ant colony algorithm (ACO) has a good application in combinatorial optimization problems, in which traveling salesman problem (TSP) is an important application of ACO algorithm. It shows the powerful ability of ant colony algorithm to find short paths through graphics. However, there are obvious defects in the ant colony algorithm. When the scale of the ant colony is large, the convergence time of the algorithm becomes longer and the local optimal state is easy to fall into. In this paper, a dynamic pheromone ant colony optimization algorithm based on CW saving algorithm is proposed. Initially, a general path range is found by CW saving value algorithm, and the pheromone matrix can be reasonably configured, so that the ant colony algorithm can quickly get a better solution in the initial optimization. At the same time, the optimization scheme can be adjusted in real time according to the situation of path optimization. Large ant colony searches for other paths. Combined with 3-opt local search algorithm, the ant colony can find the optimal path more quickly. The experimental results show that the improved ant colony algorithm has better convergence speed and solution quality than other ant colony algorithms.


INTRODUCTION
With the rapid development of computer technology, the application field of intelligent computing methods is also more and more extensive. Heuristic optimization algorithm is an algorithm that imitates biological behaviour to solve problems inspired by the laws of nature. Inspired by nature and imitating its structure for invention and creation, this is bionics [1] .
Ant colony algorithm is an intelligent combinatorial optimization algorithm proposed by professor Dorigo in his doctoral thesis in 1992 [2] . The algorithm simulates the foraging behaviour of ants. Ants leave behind a chemical substance called pheromone during foraging. Ants follow the ant colony to find the best foraging path by sensing pheromone intensity [3] . Research shows that ant colony algorithm has the advantages of high robustness, distributed computing, positive feedback and easy integration with other algorithms [4] . However, when dealing with big data problems, the calculation time is long, and it is easy to fall into local optimal solution, even causing stagnation. In response to these problems, many scholars have put forward corresponding improvement methods [5] .
The core technology of ant colony algorithm lies in the choice of pheromone update mode and state transition probability. Among them, the construction of pheromone matrix is especially crucial. Pheromone guides artificial ants to choose their paths. The state transition of the ant colony is based on the pheromone matrix of the ant colony, so the reconstruction of the pheromone matrix can provide an improved ant colony algorithm, such as ACS algorithm [6] , MMAS algorithm [7] , adaptive algorithm [8] , dynamic pheromone update algorithm [9] , hybrid behaviour ant colony algorithm [10] , etc. All the above methods improve the distribution of pheromone matrix by improving the way of pheromone update or adding restrictions to pheromones to improve the ability of path optimization. For example, Gao R [11] adapts the fast convergence rate by candidate set strategy and adaptively adjusts pheromone strategy so that pheromone distribution is relatively uniform. Xu J M [12] proposed a polymorphic ant colony algorithm with a variety of ant colonies and information hormones, which can improve search and convergence speed through different pheromone control mechanisms. In recent years, more and more attention has been paid to the method of combining ant colony algorithm with other algorithms. For example, Jie L I [13] combines Ant Colony algorithm and genetic algorithm to solve the problem of Wireless Network location. In document [14] , Chen W proposes to combine particle swarm optimization with ant colony algorithm to achieve win-win results in search time and performance.

RELATED WORK
TSP problem belongs to NP hard problem. There are mainly two ways to solve this kind of problem at present. One is accurate algorithms such as dynamic programming method and branch and bound method. For the smallscale TSP problem, an accurate algorithm can be used to find the solution. However, when the ant colony is large in scale, it cannot be solved by accurate methods. In recent years, people have published many articles to solve the TSP problem (Fanzhen Liu, Yong Quanzhou, Mostafa Mahaia), and many improved algorithms have made great progress. The following is a brief list of some.
Fanzhen Liu [15] et al set the number of initial ant colonies and verified the relationship between the initial average optimal solution and the calculation cost through experiments. In the TSP problem, a strategy to initialize the ant population of ACO algorithm is proposed to obtain high quality optimal solution in a short period of time.
Jing gqing Jiang [16] and others adopted a hierarchical method to solve the large-scale TSP problem. The large scale traveling salesman problem is decomposed layer by layer into generalized traveling salesman problem (GTSP) by clustering analysis of cities, and each clustering is solved by ant colony algorithm. Then ant colony algorithm was used to solve each cluster. The whole solution will be obtained after each clustering result is obtained. It is verified that this algorithm can obviously improve the efficiency of solving large-scale ant colony algorithm.
Saban g ü LC ü [17] et al. proposed a parallel collaborative hybrid algorithm PACO-3 opt. Based on the master-slave model, the algorithm divides the entire ant colony into several sub-ant colonies. Each ant colony shares information through GIS strategy. Once one sub-ant colony is stuck, other communities will help it to jump out of the stuck state. Each independent sub-ant colony is operated according to the ant colony optimization algorithm and the 3-opt algorithm, and the optimal solution is shared among the periods. After verification, the algorithm can get better results. It has higher parallel operation efficiency on distributed management system.
In this paper, a dynamic pheromone ant colony optimization algorithm based on CW saving value algorithm is proposed. through real-time monitoring of ant colony search paths, the pheromone matrix can be reasonably configured, the optimization scheme can be adjusted, premature phenomenon can be prevented in advance, and the possibility of ant colony searching other paths can be increased. Combining with the 3-opt local search algorithm, the convergence speed of the algorithm is improved while the global search capability is enhanced, and the optimal solution is searched to the greatest extent. At the end of this paper, the algorithm is verified by experiments, and compared with other algorithms, the results are satisfactory.

ant colony system
This paper takes TSP problem in n cities on the plane as an example to verify the improvement of ant colony system algorithm (ACS).

state transition rules
In ant colony system, m ants construct TSP paths in parallel. At the initial moment, the ants were placed in randomly selected cities, and the path information elements were equal among the cities. Ant k in city i uses the pseudo-random proportional rule of formula (1) to determine the city j to be visited next.
Among them, refers to the collection of cities that ants k located in city i can reach directly, and J is the next city label selected by formula (2) in combination with roulette algorithm. ∈ (0,1) is a random number with uniform distribution, and ∈ 0,1 is a fixed parameter.
, 0 , In formula (2), is the transition probability of ant k in city → , is the pheromone intensity of city → , is the visibility of city → , and is generally taken as 1 ⁄ , representing the predetermined heuristic information. α and are the relative importance of pheromone and heuristic information respectively reflected in ant path selection.

local pheromone update
When each ant chooses a path, it will locally update the pheromone on that path.
is the value of the initial pheromone, and the general value is 1 * ⁄ . Among them, n represents the number of cities in the TSP problem, and represents the path length obtained by the nearest neighbor heuristic method. By updating local pheromone, the pheromone of this path is weakened, the possibility of ant colony searching for other paths is guaranteed, and local optimal solution is avoided.

global pheromone update
After all ants have traversed the city, they begin to update the global pheromone. The updating of global pheromones will only play a role in the path of the best ants. The global pheromone update formula is as follows: Where is the pheromone volatilization factor, ∆ is the pheromone increment, and the general value is 1 ⁄ . 1 ⁄ is the length of the globally optimal path found by the algorithm so far.

CW algorithm
The CW mileage saving method (Clarke-Wright) is a set of heuristic algorithms proposed by Clarke and Wright to solve NP hard problem, i.e. inexact algorithms. The basic idea of the algorithm is:

1.
Take one of the n cities as the distribution center. Connect the remaining points to the distribution center. Constitute line 1 − − 1( = 2,3, … , ), − 1 lines with only one access point. 2.
The calculations ( , ) > 0 are arranged in order from big to small. 4. Check one by one according to the above order of S( , ). If there are two such lines, one containing arcs or edges ( , 0)and the other containing arcs or edges (0, ), and the solution is feasible after merging, then introduce arcs or edges, merge the two lines, and delete ( , 0) and (0, ). Repeat this step until there are no combinable lines.

3-opt algorithm
In the TSP problem, there are also some locally improved algorithms, such as the 3-opt algorithm (3 element exchange), which is a type of K-opt algorithm. The idea of the algorithm is that after a feasible solution is obtained, the three sides on the path are randomly exchanged, and the new solution obtained is compared with the original solution. If the result of the new solution is good, it will be retained, otherwise it will be discarded, and then the loop iteration will continue until the replacement is completed. Delete 3 edges and reconnect them. there are 8 possibilities in total, as shown in figure 1.

PROPOSED METHOD(DACA-3-OPT)
Although heuristic algorithm has achieved good results in solving TSP problem, there are still many shortcomings in solving efficiency and solving quality. To overcome these shortcomings, this paper proposes a dynamic ant colony optimization algorithm based on CW saving algorithm. The algorithm mainly improves the following three aspects: a) introducing CW saving algorithm to reasonably plan the initial pheromone matrix distribution in the early stage of ant colony algorithm; b) using the improved ant colony algorithm to find the excellent path solution in the path optimization stage; c) using the 3-opt algorithm to improve the quality of the solution.
In ant colony algorithm, the initial allocation of pheromone matrix is average. Whether ACS or MMAS, the pheromone matrix is configured to have the same fixed value at the beginning of the algorithm. This makes the ant colony algorithm unable to find a better solution in the initial path optimization process, and it relies entirely on the update of late pheromone to improve the path optimization situation. Therefore, CW saving value algorithm is introduced in the early stage of the algorithm. The allocation of the pheromone matrix is improved by the path solution found by the CW saving value algorithm.
In the CW saving value algorithm, city points = 1,2,3 … , are chosen as the origin to traverse, and i feasible solutions are obtained. The optimal solution of the n feasible solutions is selected as the basis for distributing the pheromone matrix.
In ACS, the initial value of the pheromone matrix is In the improved algorithm, the increment of pheromone on each CW line is 1 ∈ (0,1) is a fixed parameter. The distribution value of the pheromone matrix is The ant colony optimization algorithm is improved as follows:

Crowding degree
As the number of iterations increases, the pheromone matrix begins to show two levels of differentiation. There are more and more pheromones on the path of the optimal solution, while the pheromones on other paths become less and less with the number of iterations. Ants are insensitive to the changes of pheromones. After a certain number of iterations, due to the difference of polarization, the ant colony can no longer jump out of the current path, and can only continue to iterate under the current solution, resulting in the iterative process into a crowded stage.
Definition 1：Suppose the number of ants passing through the current optimal solution path of k cycle is : is the crowding of the current optimal path for each cycle. When is greater than the threshold D, the optimal path is determined to be congested.
To maintain the ant colony algorithm's ability to search for new solutions, DACACW algorithm monitors the ant colony state in real time. Once the ant colony algorithm falls into a crowded state, the weight coefficient in equation (1) is adjusted as follows: nn gst L L β = As changes, so does the probability that the colony will pick the next city.

Pheromone matrix
To avoid serious two-level differentiation of the pheromone matrix, inspired by the Max-Min Ant System (MMAS), the value of the pheromone matrix is limited to a certain interval , In formula (10), is a fixed parameter. When the congestion degree is detected, the pheromone matrix is reprogrammed once it gets into congestion, and the mean values of the maximum and minimum pheromone are taken, that is The part above the average pheromone changes its size.

Search field
Since the time complexity of the 3-opt algorithm is O(n 3 ), it will take lots of time to traverse the entire path at a time. Therefore, when carrying out the local search algorithm, the scope of the search domain is prioritized, and 3-opt algorithm operations are carried out within this scope each time. In this paper, the search domain is defined as an area where the distance between two exchanged edges does not exceed a certain length. The 3-opt algorithm is operated within the allowed length range, thus reducing the operation steps and increasing the operation speed.
Traverse the entire path

EXPERIMENTAL RESULTS
In this section, the performance of DACACW algorithm is verified. The parameter settings used in the experiment are shown in table 1 below. Ants choose 67 % of the number of cities. The test problem is extracted from TSPLIB(a standard test case)and several algorithms in the previous paper are compared respectively. The test cases are eil51、 eil76、St70、eil101、ch130、KroA200 respectively.  Looking at Table 3, for the Rat99, St70, KroA200 and ch150 problems, the proposed method yields the closest result to the optimal solution with minimal standard deviation. The average results of Rat99, St70, KroA200 and ch150 were 1218.6, 677.45, 29403.9 and 6545.15, respectively. As can be seen from table 3, these results are superior to the research results in the literature. It is also observed from table 2 that for the problems of Eil51, Berlin 52, ch150, Att48, ch130, KroA150, KroB100, KroB150, pr107 and TSP225, the results are close to the optimal solution, and in some cases the optimal solution is even better than the official data. Comparing the results in the literature, we can see that the method proposed in this paper has produced ideal results.

CONCLUSIONS
As a famous NP hard problem, there is no exact method to find the exact solution of TSP problem. This paper presents an improved ant colony algorithm for traveling salesman problem (TSP). DACACW algorithm gets the initial solution by CW economizing algorithm and improved ACS algorithm, and 3-opt algorithm optimizes these solutions locally. DACACW algorithm has been in the calculation of the results and calculation efficiency has been a satisfactory result. Some of these data also get close to the optimal solution. However, there are still some problems, such as how to jump out of the local optimal solution more quickly, how to strengthen the relationship between ant colonies and how to enable ant colony to achieve the information sharing of each optimization path. How to combine the parallel computing characteristics of the computer to achieve multi-ant colony optimization. In this paper, based on CW economized value dynamic ant colony algorithm, numerical experiments are carried out on eil51, and the optimal path total distance is 428, while the optimal path total distance given in reference [17] [18] is obviously. The experimental results given in this paper are superior to those in the literature.