2018 International Conference on Information, Electronic and Communication Engineering (IECE 2018) ISBN: 978-1-60595-585-8
Improved Memetic Algorithm and Its Application on Traveling
Salesman Problem
Hai YANG
School of Computer Science and Technology, Shandong University, Qingdao, Shandong, China
Keywords: Memetic algorithm, Particle swarm optimization, Simulated annealing algorithm, Traveling salesman problem.
Abstract. The traveling salesman problem is a classic NP-hard combinatorial optimization problem which is important in operations research and theoretical computer science. It is not feasible to use the conventional particle swarm optimization and simulated annealing algorithm to find the optimal solution in such a large search space. In order to improve the efficiency of the memetic algorithm, an improved particle swarm optimization as the global search and an improved simulated annealing algorithm as the local search have been proposed in this paper. Finally, the simulation experiment results have shown that the improved memetic algorithm has fast convergence speed in solving TSP problem and could find the optimal solution efficiently.
Introduction
The traveling salesman problem (TSP) could be described as the following question how to travel all the cities one by one for once time under the condition the distance is minimum [1]. The TSP problem has been proved to be NP-hard problem in combinatorial optimization which is important in operations research and theoretical computer science. The TSP problem has many applications such as logistics, planning, the manufacture of microchips and DNA sequencing. Therefore how to solve the TSP problem effectively and quickly is of high practical value.
The optimal route of minimum distance could be found finally if the exhaustive search method is used. But the searching space of TSP problem will increase sharply as the number of cities grows. The number of all possible routes satisfying TSP problem is as much as (n1)!/2. For example,
there are 1.52071064 traveling solutions for TSP problem when the number of cities is fifty. So it is not feasible for existing computers to use the conventional exhaustive methods to find the optimal solution in such a large search space [2]. Naturally many kinds of optimization algorithms for approximate solutions become relatively practical and feasible solutions.
Memetic algorithm is one of heuristic algorithms which includes global search and local search. It is more appropriate for traveling salesman problem than some classical mathematical methods. In this paper an improved memetic algorithm based on improved particle swarm optimization as the global search and simulated annealing algorithm as the local search has been proposed. It overcomes the disadvantages that the particle swarm optimization is slow in convergence, low in precision, easy to fall into the local optimum and the performance of the simulated annealing algorithm is in relation to the initial values and parameter sensitivity.
Description and Mathematical Model of TSP Problem
Suppose there are N cities and all the distances between each pair of cities are known. The salesman can start from any city and travel to each city, finally returns to the starting city. The evidence of how to select the next city to travel is to make the distance of passing route is minimum. Let (i,j) denote the edge from city i to city j with a weight dij, i,jN . Let xij 1 denote that the
salesman travel from city i to city j directly, and let xij 0 denote that the salesman doesn't travel
n i n j ij ijx d 1 1min (1)
s.t. 1 1
n j ijx ,i1,2,,n
1 1
n i ijx , j1,2,,n
S j i ij S x , 1 || , 2|S|n1, s{1,2,,n}
j i n j
i
xij {0,1}, , 1,2,, ;
Where |S| denotes the element number of set S.
Improvement on PSO and SA
Improved Particle Swarm Optimization
Suppose the scale of population is N, the position of ith (i1,2,,N) particle could be described as a D-dimensions vector which is shown in formula (2) and (3):
T iD i
i
i x x x
X ( 1, 2,, ) (i1,2,,N) (2)
T iD i
i
i V V V
V ( 1, 2,, ) (i1,2,,N) (3)
Where formula (3) denotes the flying speed of the ith particle. Let Pi (Pi1,Pi2,,PiD)T denote the best position searched by ith particle, so there is at least one best particle in population which is denoted as g. Thus Pg (Pg1,Pg2,,PgD)T is the best position searched by current population that
is the global historical optimum position of population [3].
The updating iteration formula of basic particle swarm optimization is as following:
) (
)
( 2 2
1 1 1 k ij k gj j k ij k ij j k ij k
ij V c r p x c r p x
V (4)
1
1
k ij k ij k
ij X V
X (5)
Where i 1,2,,N , j denotes the jth dimension of the particle, k is the times of iteration, c1
are c2 acceleration constants whose value ranges are usually between 0 and 2. Both r1 u(0,1) and r2 u(0,1) are two random functions independent of each other. In order to reduce the possibility of particles leaving the search space during evolution. Vij is usually limited to a certain
range, that is Vij[Vmax,Vmax]. If the search space of TSP is limited to [Xmax,Xmax], we can set
max max k X
V , 0.1k 1.0.
Because of the disadvantage of PSO algorithm that is easy to fall into the local optimal solution and low convergence accuracy, the constriction factor s is introduced.
) (
)
( 2 2
1 1 1 k ij k gj j k ij k ij j k ij k
ij sV c r p x c r p x
V (6)
1
1
k ij k ij k
ij X V
Where
| 4 2
|
2
2
k , c1c2.
Improved Simulated Annealing Algorithm
According to the Metropolis criteria, the energy of the system will change when the particles are deviated randomly. So the probability that the particles will approach equilibrium at temperature T is as follows:
) /(Tk E
E (8) Where E is the internal energy at temperature T. E is the variation of its internal energy. The strategy of simulated annealing algorithm is to start searching the whole solution space from an arbitrary solution i, and then a new solution j will got by perturbing this solution i. The formula (9) is used to judge whether the new solution j is accepted according to the Metropolis criteria.
) exp( )
) ( ) ( exp(
k
k t
f t
i f j
f
(9)
So the simulated annealing algorithm will accept bad solutions at a certain probability. When tk
is large enough, the formula (10) is workable.
1 ) ) ( ) ( exp(
0
t i f j f
(10)
The parameter t is controlled by the formula (11) which mainly depends on the decay factor .
,... 1 , 0 , 1
t k
tk k (11) Where is the decay factor. The times of iterations will be increased if is much lager, while the search accuracy will be reduced if is too small.
Because of the randomness of judgment function, the final solution of simulated annealing algorithm may not be the optimal solution. In order to overcome this disadvantage, a memorizer M is introduced into SA:
) , (a* u
M (12)
Where a* is the optimal solution of objective function during annealing, and u is the objective function value which is recorded.
Improved Memetic Algorithm and Its Application on TSP
Introduction to Original Memetic Algorithm
The memetic algorithm (MA) was firstly proposed by Moscato in 1989. He considered memetic algorithm as being close to a form of population-based hybrid genetic algorithm (GA) coupled with an individual learning procedure capable of performing local refinements [4]. The metaphorical parallels, on the one hand, to Darwinian evolution and, on the other hand, between memes and domain specific which is a kind of local search, heuristics are captured within memetic algorithms thus rendering a methodology that balances well between generality and problem specificity. This two-stage nature makes them a special case of Dual-phase evolution.
The Memetic Model of TSP
The solution space S of TSP is a set of routes visiting each city exactly once, which is denoted by the set of all cyclic permutations of {1,2,,n} as follows:
) , , ,
( 1 2 n
S (13)
Where (1,2,,n) is the cyclic permutation of {1,2,,n} which means a circuit of n cities.
j
i
means the ith visited city is j. n1 1 means returning back to the first visited city finally. The initial solution could be set as {1,2,,n}.
The objective function is the minimum of all the distances during visiting all the cities only once:
n i n d i i
f
1 2
1, , , ) 1
(
min (14)
The improved memetic algorithm proposed in this paper uses 2-opt algorithm to calculation a new solution. Select arbitrary u and v(uvn) to interchange their visiting sequences. Suppose the solution before interchanging is si (c1,c2,,cu,,cv,,cn). After interchanging the
new route is s'i (c1,,cu1,cv,cv1,,cu1,cu,cv1,,cn) . Because the essence of memetic algorithm is a framework, the improved PSO is introduced as the global search strategy and the improved SA is introduced as the local search strategy using the extremum of population in each iteration.
Implementation Steps of the Improved Memetic Algorithm
The implementation steps of the improved memetic algorithm (IMA) can be described as follows:
Step 1: Denote each city as a node and then put all nodes into an array. For example if there is one route like 3-5-2-4-1, the mathematical representation is [3 5 2 4 1].
Step 2: Initialize the population. The parameters include the scale of population n, the particle position x, the particle velocity v, the particle fitness value d, initial temperature T0, number of
Iterations m, termination temperature Tf and so on.
Step 3: Calculate the fitness values of all particles according to the objective function of TSP. Record the particle extremum pbest and the population extremum gbest.
Step 4: Search globally using PSO. Update the position and velocity of each particle. Record the particle extremum pbest and the population extremum gbest in each iteration.
Step 5: According to the global optimal solution, consider the local search area where the local search will be done by using the improved SA.
Step 6: Update all the particles, then record the new particle extremum pbest and the new
population extremum gbest. If the number of iteration reaches the threshold, continue to do the next step. Otherwise go back to step 3.
Step 7: When generate the new population we introduce the self-organizing random migration strategy to keep population's diversity [5].
Step 8: If the searching result will be output if satisfying the demands of TSP. Otherwise go back to step 4.
Simulation Experiment
The simulation experiments are carried out by using the data from TSPLIB. Firstly, we use the improved memetic algorithm (IMA), PSO and SA to solve the 30-cities TSP. The initial temperature T0 4000, temperature-dropping parameter is 0.8, the length of Markov chain is 3000,
The experimental results can be consulted in table 1 which shows that the deviation ratio of IMA is superior to those of the other two algorithms. The formula of deviation ratio is as follows:
% 100
opt opt result
DR aver (15)
Where resultaver is the average of results using one of three algorithms and the parameter opt is the optimum gain from TSPLIB. When the number of cities is 30, the opt is 423.741 supplied by TSPLIB.
Table 1. Comparison of three algorithms in solving 30-cities TSP
IMA PSO SA
Optimal solution 423.7406 423.7406 423.7406
The average of solutions 423.8921 424.0655 424.1736
Deviation ratio 0.0357% 0.0766% 0.1021%
In order to verify the efficiency of IMA further, other simulation experiments taken by IMA, evolutionary algorithm (EA) and ant colony algorithm (ACA) using different numbers of cities from TSPLIB. The experimental results can be consulted in table 2.
Table 2. Comparison of IMA, EA and ACA in solving TSP
TSP Opt from
TSPLIB IMA EA ACA
Oliver30 423.741 423.741 423.741 423.741
St70 678.5975 677.2573 677.2596 690.0211
Kora100 21285.4432 21296.1205 21300.7423 21320.5762
From the two tables above, we can reach a conclusion that the IMA algorithm proposed in this paper is superior to PSO, SA, EA and ACA. So IMA algorithm has higher efficiency for solving TSP problem.
Conclusion
In this paper an improved memetic algorithm named IMA based on improved PSO and improved SA is proposed. The IMA algorithm makes use of the PSO as the global search and SA as the local search so as to improve the efficiency of MA. The results of simulation experiment have shown that IMA algorithm is superior to PSO, SA, EA and ACA for TSP problem.
References
[1] T. Stutzle, H. Hoos. The MAX-MIN ant system and local search for the traveling salesman problern[C]. IEEE Press, 1997, 308-313.
[2] G Laporte. A concise guide to the traveling salesman problem. Journal of the Operational Research Society. 2010, 61(1): 35-40.
[3] Xiao G, Li S Z, Wang XH, eta1. A solution to unit commitment problem by ACO and PSO hybrid algorithm[A]. Proceedings of the 6th World Congress on Intelligent Control and Automation[C], 2006, 223-224.
[4] Moscato, P. On Evolution, Search, Optimization, Genetic Algorithms and Martial Arts: Towards Memetic Algorithms. Caltech Concurrent Computation Program, 1989, 826.