Solving TSP Using Hopfield Model
Solving TSP Using Hopfield Model
Introduction
The Traveling Salesman Problem (TSP) is a
classical combinatorial optimization problem.
Hopfield networkis a special kind of recurrent
neural networksthat can be used as associative
memory.
Simulated annealing (SA)is a
genericprobablisticmetaheuristicfor theglobal
optimizationproblem of locating a good
approximation to theglobal optimum of a
givenfunctionin a largesearch space.
E = A/2 (X i j i VXiVXj)
+ B/2 (i X Y
VXiVYi)
xvxi=1
ivxi=1
Where n is the No. of cities.
Simulated Annealing
The SA algorithm allows the search to sometimes
accept worst solutions with a probability (p)
thatwould decrease with the temperature of the
system(t).
Implementation
MATLAB is the software used, as it provides the
possibility of developing a quadratic optimiser and
also a GUI in an easy way.
Hop Field Network
We have developed the matlab code for this.
The TSP bench mark problem is input as .txt file
with city index. and X-Y cordinates.
The W matrix is then found .
Number of iterations for optimisation and other
parameters are set.
The constraints for input vectors are also found.
Quadprog is used for finding v.
Implementation
Simulated Annealing
If the problem consists of n cities ci, i = 1, .., n,
any tour can be represented as a permutation of
numbers 1 to n. d(ci,cj) = d(cj,ci) is the distance
between ci and cj.
Given a permutation of the n cities, vi and vi+1
are adjacent cities in the permutation. The
permutation has to be found that minimizes:
Results
16 city problem
22 city problem
30
25
20
15
10
5
0
-5
-10
33
34
35
36
37
38
39
40
41
42
Hop field
model
107.0079
179.7079
Simulated
Annealing
ACO
157.368
73.9876 *
181.6275728
56.2237 *
att48
Converging
60087.29
41374.88+
time very
large
While using HNN , larger cities required more iterations for good
solution. So the
optimisation result for att48 was not obtained due to time
constraints.
The optimisation is not exact obviously.
As the number of iterations were increased some what better solution
was obtained.
*Cited from : Kumbharana, N. S., and Gopal M. Pandey. "A Comparative Study of ACO, GA and SA for Solving
Larger
cities
required moreJournal
iterations
for
good solution.
Travelling
Salesman
Problem."International
of Societal
Applications
of Computer Science2, no. 2
(2013): 224-228.
Alhanjouri, Mohammed, and Belal Alfarra. "Ant Colony versus Genetic Algorithm based on Travelling Salesman
Problem."International Journal of Computer Technology and Applications2, no. 3 (2011).
+
Future Work
Different energy functions can be chosen for
better results.
Ant colony optimization (ACO) belongs to the
group of metaheuristic methods and can be used
as a global search algorithm for better
optimisation along with the local search algorithm
used here.