File Exchange

image thumbnail

Traveling Salesman Problem (TSP) using Simulated Annealing

version 1.0 (491 KB) by

A GUI for sovling TSP's using Simulated Annealing

18 Ratings



View License

simulatedannealing() is an optimization routine for traveling salesman problem. Any dataset from the TSPLIB can be suitably modified and can be used with this routine. A detailed description about the function is included in "Simulated_Annealing_Support_Document.pdf."

A GUI is used with the core function to visualize and to vary annealing parameters.

Four sample data set from TSPLIB is provided. You can create your own data set by following a simple procedure given in the supporting document.

You can access the TSPLIB by following this link

Feel free to drop in your comments, suggestions, bugs and mistakes in the algorithm.

Note: Simulated Annealing is a memory intensive and processor intensive algorithm. A big data set may take hours depending on your computer configuration.

Comments and Ratings (23)


Arsan (view profile)

i need someone to explain about this source code....i have tried to use this source code but i stil didn't understand


Is it possible to run the algorithm by providing directly an asymmetric distance matrix ? (no coordinates)


ahmed (view profile)

plz ,iam trying to execute(run) the program but it is not working :( who can help me ?


?? (view profile)

skbnf frkj

ibrahim mady

simulated annealing

faigh mohamad rahimy

source programming mat lab tsp

Richard L. Lachance

In swapcities, the correct way to select a random city is:


and the same applies for city_2, and
numberofcitiestoswap in simulatedannealing.m

Otherwise the distribution is not uniform.
This helps the algo to give correct answers.


Long Phan Hai

I wonder in function simulatedannealing, why there is only one loop?? According the algorithm, there are 2 loops.

Long Phan Hai

Please help me in GUI programming in MATLAB.
And i don't know why there are some errors in running GUI in this program.
I'm using MATLAB7. When I run stsp.fig, there are some errors. I don'n have any document that guides me in GUI in Matlab, please help me.

A .

Saeed Soltani

alireza kashanipour

Very good dear,
but i think we must replace 10 by 1 in line 55 simulatedannealing.m
if complete_temperature_iterations >= 1
it's excellent as a tutorial,and tanx alot

Cuong Nguyen Manh

Would you like to give the file 0f 101 cities to try my algorithm.

deniz küçük

Yan Li

Good job

dileep kumar saidu

Yasir Wijaya

i need informations about this jurnal or papers that tsp.


venus redruby

for large data it can be some problems


i think you for this program

cheong th

Try to dynamic anealing to improve the search...

MATLAB Release
MATLAB 7.1.0 (R14SP3)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today