Traveling Salesman Problem


Category:
Scripts
Matlab
Requirements:
Seller:
Price:
-
System:
Rating:
4.2
License:

Description - Traveling Salesman Problem



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 from2. Each city is visited by the salesman exactly once Input:XY (float) is an Nx2 (or Nx3) Matrix of citiesDMAT (float) is an NxN matrix of point to point distances/costsPOP_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 runSHOW_PROG (scalar logical) shows the GA Progress if trueSHOW_RES (scalar logical) shows the GA results if true Output:OPT_RTE (integer array) is the best route found by the algorithmMIN_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);



More in Matlab-Traveling Salesman Problem

Logical Shows Traveling Salesman Traveling Salesman Problem