?? readme.txt
字號(hào):
Summary: Solves the TSP by implementing a GA
Description: Finds a (near) optimal solution to the Traveling Salesman Problem (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: NUM_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 route
BEST_ROUTE is a 1xN vector representing the input city order,
SHORTEST_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 included
2. Inputs can be specified in any order, so long as the parameter pairs are specified as a 'parameter', value
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -