Random Travelling Salesman Problem using SA

International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 4, April 2012)
Random Travelling Salesman Problem using SA
Nitesh M. Sureja1, Bharat V. Chawda2
1
G H Patel College of Engineering & Technology, Gujarat Technological University, Ahmedabad
2
B & B Instutute of Technology, Gujarat Technological University, Ahmedabad
1
[email protected]
[email protected]
2
II. RANDOM TRAVELING SALESMAN PROBLEM
Abstract — An algorithm known as Simulated Annealing
(SA) for Random Traveling Salesman Problem (RTSP) is
presented in this paper. The computational SA model
constructed is based on the simulating process of slow cooling
of molten metal to achieve the minimum function value in a
minimization problem. Random Traveling Salesman Problem
(RTSP) is a variant of TSP. All TSP dataset used here are
constructed randomly. And then SA model is applied on all
those data sets. Experimental results are discussed based on
various characteristics like time, quality and accuracy.
Keywords — Random Travelling Salesman Problem
(RTSP), Simulated Annealing (SA), Symmetric TSP,
Asymmetric TSP.
In the Traveling Salesman Problem (TSP), a number of
cities are given with the objective of finding a minimumlength closed tour that visits each city once returning to the
starting city [2]. There are various types of TSP. A
symmetric TSP (STSP) is one where the distance between
any two cities is same from either side. In an asymmetric
TSP (ATSP) the distance is not same. Radom TSP is also
one of the variants of TSP. In this TSP, we use randomly
generated TSP instances instead of already available static
examples on TSPLIB. City coordinates are generated in the
range between 0 and 1. We have applied Simulated
Annealing (SA) Model to this problem.
I. INTRODUCTION
III. THE SIMULATED ANNEALING (SA) MODEL
Many non-traditional approaches are proposed by the
researchers for solving combinatorial optimization
problems. Simulated Annealing (SA), Genetic Algorithms
(GA), Ant Colony Optimization (ACO), Bee Colony
Optimization (BCO), Particle swarm Optimization (PSO)
are some of them. All those non-traditional approaches are
the result of observing process of some natural activity. SA
is a result of closely observing of cooling process of molten
metal, while GA, as we all know, is an observation or a
study of the natural evolution. ACO is inspired on the
foraging behavior of ants. BCO is based on the foraging
behavior of bees. PSO is also based on flocking behavior of
birds. Plenty of algorithms are developed by various
authors to solve combinatorial optimization problems [1].
This paper describes our work in applying SA model to
Random Traveling Salesman Problem (RTSP). The paper
starts with a discussion on Random TSP in section 2. A
discussion on SA model is presented in section 3.
Implementation details of SA model for Random TSP is
discussed in section 4 followed by experiments and results.
Finally the paper ends with conclusions and future works in
section 5.
This section first describes the concepts of Simulation
Annealing method. How a process of cooling a molten
metal slowly with some temperature setting is simulated in
an algorithm, which can be used to solve various
optimization problems. Next, a SA model for Random TSP
is presented.
A. Simulated Annealing (SA)
Simulated Annealing is a generic probabilistic metaalgorithm used to find an approximate solution to global
optimization problems. It is inspired by annealing in
metallurgy which is a technique of controlled cooling of
material to reduce defects [3][4][5]. The Simulated
Annealing algorithm starts with a random solution. A
random nearby solution is formed by every iteration. If this
solution is a better solution, it will replace the current
solution. If it is a worse solution, it may be chosen to
replace the current solution with a probability that depends
on the temperature parameter. As the algorithm progresses,
the temperature parameter decreases, giving worse
solutions a lesser chance of replacing the current solution.
621
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 4, April 2012)
We allow worst solutions at the beginning to avoid
solution converging to a local minimum rather than the
global minimum. We will use the simulated annealing
algorithm to solve Random Travelling Salesman Problem.
The salesman must visit each city only once and return to
the same city in which he began. The constraints that affect
the outcome of the algorithm are the initial temperature, the
rate at which the temperature decreases and the stopping
condition of the algorithm. By adjusting these values, we
run the SA and to see that how algorithm responds.
Once a cooling schedule is chosen, runs will be tried for
different numbers of times the temperature is changed,
number of Monte Carlo steps tried at each temperature and
seed for the random number generator. In cooling schedule,
a linear temperature change is used. This means that each
new temperature is determined from the old temperature by
an equation of the form
T(new) = T(old) – DT
where DT is determined so that after all changes the
temperature has dropped from very high to very low. In
Some SA models new temperature is determined from the
old temperature by an equation of the form
B. SA Model for Random TSP
This section will focus on applying Simulated Annealing
(SA) model to the Random Travelling Salesman Problem
(TSP) [5]. In this model, a random number generator is
used to determine an initial solution. Since we are dealing
with a TSP with n cities, it starts at city 1, the solution is an
ordered list of n integers. This list starts with the number 1
and contains the numbers 1 through n exactly once. For
example, in a 6-city problem, the array (1,4,3,5,6,2) means
that the route starts at city 1 and then travels to cities 4, 3,
5, 6, and 2, in that order, before returning to city 1. As
stated in the general discussion, Simulated Annealing is a
computational methodology, not a particular algorithm.
You have an algorithm, and all you need is the seed for the
random number generator to run the simulation. A Monte
Carlo step is determined by randomly choosing two
positions in the array (except the first) and switching the
cities in these positions. For the 6-city example above, if
the 3rd and 5th positions are chosen, we have
(1,4,3,5,6,2)
|
|
(1,4,6,5,3,2)
(1)
T(new) = T(old) * DT
(2)
For the procedure chosen here, a proportional reduction
of the temperature yields a better final result than a
constant reduction in every case but one. In addition, the
proportional reduction appears to converge better since
there is a smaller change in the final length when the seed
to the random number generator is changed [6].
Pseudo-code of SA model for Random TSP is given
below.
1.
2.
3.
4.
current route
Generate initial Solutions
Input and Access initial Solution
Estimate Initial Temperature
While (termination criteria is not met)
{
selected positions
Generate new solution;
new route
Assess new solution;
If the new route has a lower total length than the old, it
automatically becomes the current route. In addition, if its
length is smaller than any route found to date, it is stored as
the best route. If the new route has a longer length than the
old, the difference (increase) in the length (Dl) is used to
determine a probabilistic acceptance from the expression e
(-Dl/T)
where "T" is the effective temperature. If this
expression yields a number that is greater than a random
number between 0.0 and 1.0, this step is accepted and the
new route becomes the current one. If the expression yields
a number smaller than the random number, the step is
rejected and the current route remains.
If (accept new solution)
{
Update storage.
Adjust Temperature;
}
}
Figure 1. Pseudo-code of SA [7]
622
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 4, April 2012)
A city instance for N cities is created by randomly
generating city coordinates and storing them in NX2
matrix. The range used for city coordinates is in between 0
and 1.
The flow chart of the Simulated Annealing Model is
given below.
Our computational model is coded in MATLAB 7.0 and
executed on windows XP platform. A Pentium dual core
CPU with 1 GB RAM is used here. We have generated
TSP instances within the range of 5 to 105 cities.
Experimental results are presented in the table 1.
TABLE I
EXPERIMENTAL RESULTS
City Problem
Length of the Tour
05
15
25
35
45
55
65
75
2.9047
8.2631
10.0698
12.1417
20.2549
24.1254
30.5237
33.6674
85
39.1556
95
105
50.5301
52.6431
Graphical representation of all the results is also
generated. Some of them are displayed below.
Figure 2. Flow chart of SA Model [8]
IV. IMPLEMENTATION AND RESULTS
Figure 3. Result of 05 City Problem
Here we implement our computational simulated
annealing model to apply it to random travelling salesman
problem (RTSP).
623
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, Volume 2, Issue 4, April 2012)
V. CONCLUSION
A Computational model based on Simulated Annealing
(SA) has been introduced to solve Random TSP. The
model has been tested on a set of randomly generated TSP
instances. The model has been implemented using
MATLAB 7.0 on a Pentium Dual core machine with 1 GB
RAM. Results clearly show that, SA proves little bit good
for small problems in every criterion. But it does prove
very bad when applied to medium as well as large size
problems. SA model proves good in terms of length of the
tour but very bad in terms of quality and convergence time.
In future, we are going to apply the approaches like
Genetic Algorithms, Ant Colony Optimization, Bee Colony
Optimization etc. to solve RTSP for improving the results
in all criteria. Dynamic TSP, which changes itself over a
period of time, is our next research using above models.
Figure 4. Result of 15 City Problem
References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
Figure 5. Result of 85 City Problem
[8]
[9]
Figure 6. Result of 105 City Problem
624
Gerard Reinelt. ―The Traveling Salesman: Computational Solutions
for TSP Applications‖, Springer-Verlag, 1994
M. M. Flood, ―The Traveling Salesman Problem‖, Operations
Research, 1956
http://www.btluke.com/simann1.html
Emile Aarts, Jan Korst, and Wil Michiels. Simulated Annealing,
chapter 7. Springer, 2005. Search Methodologies: Introductory
Tutorials in Optimization and Decision Support Techniques
David Bookstaber, ―Simulated Annealing for Traveling Salesman
Problem‖, Spring, 1997
http://www.btluke.com/apsatsp.html
E. R. Ramirez, ―Using Genetic Algorithms to solve High School
Course Timetabling Problems”, A Thesis, San Diago State
University, Summer 2010
Jeff Heaton, ―Introduction to Neural Networks for Java‖, Second
Edition, Chapter 7, pages 199-212, Heaton Research, Inc., 2008
A. Sahu and R. Tapadar, ―Solving the Assignment problem using
Genetic Algorithm and Simulated Annealing‖ IEANG International
Jounal of Applied Mathametics, 36:1,IJAM 36_1_7