Traveling Salesman Problem Background
Traveling Salesman Problem Icon

Finds a near-optimal solution to a TSP using a GA

39
Downloads
-
0 Ratings
All Versions
39
Total Downloads
0
Downloads Last Week
Current Version
39
Total Downloads
0
Downloads Last Week
Downloads Last 10 Weeks
All Versions
-
0 Ratings
5
4
3
2
1
Current Version
-
0 Ratings
5
4
3
2
1

Traveling Salesman ProblemOverview

Editor: 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);

New

Fixed some bugs.

Traveling Salesman ProblemTech Specs

Version
N/A
Date
07.06.10
License
Free to try
Language
English
File Size
3KB
Developer
Category
SubCategory
Operating Systems
Windows ,Linux,Mac OS,BSD,Solaris
System Requirements
No additional system requirements.

SelectedFor You

Simulink Simulator for a Brushless DC Motor Icon
Devendra Rai
Simulink Simulator for a Brushless DC Motor - Complete simulator for brushless d
Netlab Icon
Ian Nabney
The Netlab toolbox is designed to provide the central tools necessary.
Hopfield Neural Network Icon
Yonathan Nativ
A Hopfield neural network to identify patterns in a binary image
Color Image Histogram Icon
Jeff Mather
RGBHIST displays a histogram of the overall color balance of an image.
DICOMDIR Reader Icon
Laszlo Balkay
It can let you select a dicom series from a DICOMDIR directory.
Spectral and XYZ Color Functions Icon
Jeff Mather
abel plots with spectra. Convert wavelengths to RGB. Functions for color