Top Banner
Solving TSP using Hopfield Model & Simulated Annealing EEL781 Neural Networks Instructor: Dr. Jayadeva Teaching Assistant: Udit Kumar Amanpreet Kaur 2014EET2441 Neeta Abiraami.T.N 2014EET2935
12

Solving TSP Using Hopfield Model

Dec 14, 2015

Download

Documents

NAAMI

Solving TSP using Hopfield Model & Simulated Annealing project
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Solving TSP using Hopfield Model

Solving TSP using Hopfield Model & Simulated AnnealingEEL781 Neural NetworksInstructor: Dr. JayadevaTeaching Assistant: Udit KumarAmanpreet Kaur 2014EET2441Neeta Abiraami.T.N 2014EET2935

Hello This is a presentation on our neural network term project : Solving TSP using hopfield model and Simulated annealing.1IntroductionThe 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.

The Traveling Salesman Problem (TSP) is one of the most famous combinatorial optimization problems. It can be stated as following: given a finite number of cities and their pair-wise distances, find the shortest tour which connects all cities once and only once and returns to its starting point .We have used both Hopfield neural network and Simulated annealing algorithm to solve TSP.**2Hopfield Energy FunctionThe dynamics of Hopeld networks can be described by a system of differential equations and the activation function is a hyperbolic tangent. Here v is the vector of neuron activitiesI is the vector of neuron biasesW is the connection matrixThen the energy function E of the Hopeld network is

E= -(1/2) vTWv (ib)Tv

Hopeld has shown that the network will converge to local minima of energy function if W is symmetric

The Hopfield net can be completely described by a Lyapunov function E which converges to a local minimum without oscillating between different states. This state corresponds to a local minimum of the Lyapunov function.Then the energy function of the Hopeld network for the high-gain limit expression exists as shown.Where v, I are the vectors of neuron activities and biases, and W is the connection matrix.3 Mapping the TSP onto a Hopfield netThe output of all neurons represents the current tour.

The weights wij of the Hopfield net are chosen such that a Hopfield energy function can be defined with the properties that it measures the length of a tour

The lowest energy state corresponds to the optimal tour.

The steady state should correspond to the optimal tour.

we have applied the hop field neural network to solve the tsp. An N-city problem can be represented as a recurrent neural network withN2neurons. The n* n weight matrix contains the weights or the distance between the cities I and j. The output vij is1 if city I is visited in jth position. The steady state of the network will correspond to the optimal tour.4Hopfield and Tank proposed the following energy function:

E = A/2 (X i j i VXiVXj) + B/2 (i X Y X VXiVYi) +C/2 (Xi VXi-N)2 +D/2 (X Y X i dXYVXi (VYi+1 + VYi-1)) Mapping the TSP onto a Hopfield net

This is one of the energy functions for solving tsp.It contains 4 terms.where the first 3 terms correspond to the constraints of the problem and the last term represents the main objective of the problem i.e. to minimise the total length of the tour. The parameters a,b,c,d must be chosen carefully as the solution is very sensitive to the chosen parameters.we try to minimise E without any constraints now.5Obtaining weight matrix

We can Rewrite E in the form of :

E= -(1/2) vTWv (ib)Tv

Where v, ib are in terms of parameters A, B, C, D.Thus TSP can be described as a quadratic 0-1 programming problem with linear constraints as: xvxi=1 ivxi=1

Where n is the No. of cities.

We are minimising the objective function e as shown with the following linear constraints.The first constraint means that at ith position exactly 1 city is visited. And the second constraint means that each city should be visited exactly once.6Simulated AnnealingThe SA algorithm allows the search to sometimes accept worst solutions with a probability (p) thatwould decrease with the temperature of the system(t).

At each iteration of the simulated annealing algorithm, a new point is randomly generated. The algorithm accepts all new points that lower the objective, but also, with a certain probability, points that raise the objective. By accepting points that raise the objective, the algorithm avoids being trapped in local minima in early iterations and is able to explore globally for better solutions.7ImplementationMATLAB is the software used, as it provides the possibility of developing a quadratic optimiser and also a GUI in an easy way. Hop Field NetworkWe 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.

We have written the code for the HNN optimisation problem in matlab using the quadprog tool. The TSP bench mark problem is input as .txt file with city index and city cordinates which are used to calculate the w matrix. We changed the optimisation parameters in quadprog to improve the result.8Simulated AnnealingIf 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:

xd(vi vi+1) + d(vn v1)

The size of the solution space is (n-1)!/2

Implementation

The simulated annealing problem consists of n cities whose global optimal solution is found using the code which we have written in matlab . The size of the solution space represents the no of tours possible. 9

Results

16 city problem22 city problem

The plots for the 16 city and 22 city problem have been displayed for both the hopfield net and simulated annealing algorithm approach10Results & ConclusionsTSP fileHop field modelSimulated AnnealingACOulysses16 107.0079157.36873.9876 *ulysses22179.7079181.627572856.2237 *att48Converging time very large60087.2941374.88+*Cited from : Kumbharana, N. S., and Gopal M. Pandey. "A Comparative Study of ACO, GA and SA for Solving Travelling Salesman Problem."International Journal 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).

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.Larger cities required more iterations for good solution.

These are some of the results which we obtained during our project . We observed ACO seemed to be the fastest approach in city problems we took. Also we found that while the hopfield model implementation of tsp gave somewhat shorter tour lengths than SA but took a longer time to converge to an optimum solution11Future WorkDifferent 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.

Many exact and heuristic algorithms have been devised in thefield of operations research (OR) to solve the TSP. Different energy functions could be chosen for better results.Computer simulations demonstrate that the articial antcolony is capable of generating good solutions to both symmetric and asymmetric instances of the TSP.

12