# Traveling Salesman Problem 1.0

OS : Windows / Linux / Mac OS / BSD / Solaris

Script Licensing : Freeware

Created : Aug 31, 2007

Downloads : 11

Thank you for voting...

## Finds a (near) optimal solution to the Traveling ...

Finds a (near) optimal solution to the traveling Salesman Problem by Joseph Kirk (TSP) by setting up a Genetic Algorithm (GA) to search for the shortest path (least distance needed to travel to each city exactly once)

Variable inputs: cities or cities and/or several optional input parameters

NUM_CITIES is an integer representing the number of cities

CITIES is an Nx2 matrix representing XY coordinates for N user specified cities

Options include . . .

'-NOPLOT', which turns off the GA progress plot

'-RESULTS', which turns on some plots at the end of the GA

'POPSIZE', VAL, sets the GA population size to be VAL

'MRATE', VAL, sets the mutation rate to VAL

'NUMITER', VAL, sets the number of GA iterations to VAL

BEST_ROUTE is a 1xN vector representing the input city order,

distance is the distance between all of the cities along the best route

2. Inputs can be specified in any order, so long as the parameter pairs are specified as a 'parameter', value

Variable inputs: cities or cities and/or several optional input parameters

NUM_CITIES is an integer representing the number of cities

CITIES is an Nx2 matrix representing XY coordinates for N user specified cities

Options include . . .

'-NOPLOT', which turns off the GA progress plot

'-RESULTS', which turns on some plots at the end of the GA

'POPSIZE', VAL, sets the GA population size to be VAL

'MRATE', VAL, sets the mutation rate to VAL

'NUMITER', VAL, sets the number of GA iterations to VAL

**Outputs:**

SORTED_CITIES is the CITIES matrix sorted by the best routeBEST_ROUTE is a 1xN vector representing the input city order,

distance is the distance between all of the cities along the best route

**Example usage:**

>> [sorted_cities, best_route, distance] = tsp_ga(40, 'popsize', 80, 'numiter', 250, '-results'); % Solves the TSP for 40 randomly generated cities with a population size of 80 and 250 iterations, as well as plotting the results.**Notes:**

1. Input error checking included2. Inputs can be specified in any order, so long as the parameter pairs are specified as a 'parameter', value

**• MATLAB Release: R2006b**

**Demands:****Traveling Salesman Problem 1.0 scripting tags:**matlab miscellaneous, salesman problem, population, representing, traveling, traveling salesman, sets, city, traveling salesman problem, cities, distance, turns.

**What is new in Traveling Salesman Problem 1.0 software script?**- Unable to find Traveling Salesman Problem 1.0 news.

**What is improvements are expecting?**Newly-made Traveling Salesman Problem 1.1 will be downloaded from here. You may download directly. Please write the reviews of the Traveling Salesman Problem. License limitations are unspecified.