|
|
| File Information |
| Description |
TSP_GA Traveling Salesman Problem (TSP) Genetic Algorithm (GA)
Finds a (near) optimal solution to the TSP by setting up a GA to search for the shortest route (least distance for the salesman to travel to each city exactly once and return to the starting city)
Summary:
1. A single salesman travels to each of the cities and completes the route by returning to the city he started from
2. Each city is visited by the salesman exactly once
Input:
XY (float) is an Nx2 (or Nx3) matrix of cities
DMAT (float) is an NxN matrix of point to point distances/costs
POP_SIZE (scalar integer) is the size of the population (should be divisible by 4)
NUM_ITER (scalar integer) is the number of desired iterations for the algorithm to run
SHOW_PROG (scalar logical) shows the GA progress if true
SHOW_RES (scalar logical) shows the GA results if true
Output:
OPT_RTE (integer array) is the best route found by the algorithm
MIN_DIST (scalar float) is the cost of the best route
Example:
n = 50;
xy = 10*rand(n,2);
a = meshgrid(1:n);
dmat = reshape(sqrt(sum((xy(a,:)-xy(a',:)).^2,2)),n,n);
pop_size = 60;
num_iter = 1e4;
show_prog = 1;
show_res = 1;
[opt_rte,min_dist] = tsp_ga(xy,dmat,pop_size,num_iter,show_prog,show_res); |
| Acknowledgements |
This submission has inspired the following:
Multiple Traveling Salesmen Problem - Genetic Algorithm, Traveling Salesman Problem - Nearest Neighbor, Fixed Start Open Traveling Salesman Problem - Genetic Algorithm, Fixed Endpoints Open Traveling Salesman Problem - Genetic Algorithm, Open Traveling Salesman Problem - Genetic Algorithm
|
| MATLAB release |
MATLAB 7.3 (R2006b)
|
| Zip File Content |
|
| Other Files |
license.txt, tsp_ga.m
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Comments and Ratings (29) |
| 16 Jan 2007 |
John D'Errico
|
|
|
| 17 Jan 2007 |
shahin masti
|
|
|
| 17 Jan 2007 |
John A
|
|
|
| 17 Jan 2007 |
John D'Errico
|
|
|
| 04 Apr 2007 |
rana salem
|
|
|
| 10 May 2007 |
Michael Kleder
|
|
|
| 20 May 2007 |
kazim akbulut
|
|
|
| 22 May 2007 |
Husnul Hidayat
|
|
|
| 01 Jun 2007 |
semra buyukkapu
|
|
|
| 05 Jun 2007 |
nader khadher
|
|
|
| 11 Nov 2007 |
Yongguk Kim
|
|
|
| 14 Nov 2007 |
Dimitri Shvorob
|
|
|
| 13 Dec 2007 |
faigh mohamad rahimy
|
|
|
| 23 Jan 2008 |
tom wiechet
|
|
|
| 12 Feb 2008 |
Fernando Castro
|
|
|
| 12 Feb 2008 |
Fernando Castro
|
|
|
| 01 Mar 2008 |
beh mal
|
|
|
| 11 Mar 2008 |
Antoine S
|
|
|
| 01 Apr 2008 |
me me
|
|
|
| 03 Aug 2008 |
reza ghanbari
|
|
|
| 18 Sep 2008 |
Felipe Padilla
|
|
|
| 25 Sep 2008 |
Sandip Vijay
|
|
|
| 26 Sep 2008 |
Naresh Kolla
|
|
|
| 03 Nov 2008 |
hudmem ira
|
|
|
| 14 Nov 2008 |
Mahdieh
|
|
|
| 26 Dec 2008 |
shaima A.I
|
|
|
| 04 Mar 2009 |
xu jinpeng
|
|
|
| 07 Apr 2009 |
dokuzyuzseksen yuzseksen
|
|
|
| 02 Jun 2009 |
Thierry Dalon
|
|
|
| Updates |
| 17 Jan 2007 |
Included options to turn off plots and change the parameters of the GA |
| 22 May 2007 |
Vectorized distance matrix calculation. |
| 25 Aug 2008 |
Added distance matrix as input, reworked GA operators |
| 02 Sep 2008 |
updated help notes, description |
| 02 Jun 2009 |
Added 3D capability. |
|
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Disclaimer prior to use.
Contact us at files@mathworks.com