Be the first to rate this file! 136 downloads (last 30 days) File Size: 3.96 KB File ID: #21300

Open Multiple Traveling Salesmen Problem - Genetic Algorithm

by Joseph Kirk

 

02 Sep 2008 (Updated 02 Jun 2009)

Code covered by BSD License  

Finds a near-optimal solution to a "open" variation of the M-TSP using a GA

Download Now | Watch this File

File Information
Description

MTSPO_GA Open Multiple Traveling Salesman Problem (M-TSP) Genetic Algorithm (GA)
Finds a (near) optimal solution to a variation of the M-TSP by setting
up a GA to search for the shortest route (least distance needed for the
salesmen to travel to each city exactly once without returning to their
starting location)

Summary:
1. Each salesman travels to a unique set of cities (although none of
them close their loops by returning to their starting points)
2. Each city is visited by exactly one salesman

Input:
XY (float) is an Nx2 matrix of city locations, where N is the number of cities
DMAT (float) is an NxN matrix of city-to-city distances or costs
SALESMEN (scalar integer) is the number of salesmen to visit the cities
MIN_TOUR (scalar integer) is the minimum tour length for any of the salesmen
POP_SIZE (scalar integer) is the size of the population (should be divisible by 8)
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
OPT_BRK (integer array) is the list of route break points (these specify the indices
into the route used to obtain the individual salesman routes)
MIN_DIST (scalar float) is the total distance traveled by the salesmen

Route/Breakpoint Details:
If there are 10 cities and 3 salesmen, a possible route/break
combination might be: rte = [5 6 9 1 4 2 8 10 3 7], brks = [3 7]
Taken together, these represent the solution [5 6 9][1 4 2 8][10 3 7],
which designates the routes for the 3 salesmen as follows:
. Salesman 1 travels from city 5 to 6 to 9
. Salesman 2 travels from city 1 to 4 to 2 to 8
. Salesman 3 travels from city 10 to 3 to 7

Example:
n = 35;
xy = 10*rand(n,2);
salesmen = 5;
min_tour = 3;
pop_size = 80;
num_iter = 5e3;
a = meshgrid(1:n);
dmat = reshape(sqrt(sum((xy(a,:)-xy(a',:)).^2,2)),n,n);
[opt_rte,opt_brk,min_dist] = mtspo_ga(xy,dmat,salesmen,min_tour,pop_size,num_iter,1,1);

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Multiple Traveling Salesmen Problem - Genetic Algorithm

MATLAB release MATLAB 7.6 (R2008a)
Zip File Content  
Other Files license.txt,
mtspo_ga.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
01 Oct 2008 The Author

Update: The SINGLES parameter has been replaced with a more generalized MIN_TOUR.

Please login to add a comment or rating.
Updates
30 Sep 2008

Removed the SINGLES parameter and replaced it with a more generalized MIN_TOUR

02 Jun 2009

Added 3D capability.

Tag Activity for this File
Tag Applied By Date/Time
optimization Joseph Kirk 22 Oct 2008 10:17:07
multiple traveling salesmen problem Joseph Kirk 22 Oct 2008 10:17:07
mtsp Joseph Kirk 22 Oct 2008 10:17:07
open variation Joseph Kirk 22 Oct 2008 10:17:07
 

MATLAB Central Terms of Use

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 Terms prior to use.

Contact us at files@mathworks.com