【文件属性】:
文件名称:多旅行商matlab实验源码
文件大小:13KB
文件格式:RAR
更新时间:2015-05-26 14:45:08
多旅行商matlab实验源码实现了三种多旅行商问题
多旅行商matlab实验源码实现了三种多旅行商问题
% MTSPOF_GA Fixed Open Multiple Traveling Salesmen Problem (M-TSP) Genetic Algorithm (GA)
% Finds a (near) optimal solution to a variation of the "open" M-TSP by
% setting up a GA to search for the shortest route (least distance needed
% for each salesman to travel from the start location to unique
% individual cities and finally to the end location)
%
% Summary:
% 1. Each salesman starts at the first point, and ends at the last
% point, but travels to a unique set of cities in between (none of
% them close their loops by returning to their starting points)
% 2. Except for the first and last, each city is visited by exactly one salesman
%
% Note: The Fixed Start is taken to be the first XY point and the Fixed End
% is taken to be the last XY point
%
% 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, NOT including the start point or end point
% 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 4 2 8 3 7], brks = [3 7]
% Taken together, these represent the solution [1 5 6 9 10][1 4 2 8 10][1 3 7 10],
% which designates the routes for the 3 salesmen as follows:
% . Salesman 1 travels from city 1 to 5 to 6 to 9 to 10
% . Salesman 2 travels from city 1 to 4 to 2 to 8 to 10
% . Salesman 3 travels from city 1 to 3 to 7 to 10
%
% 2D 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] = mtspof_ga(xy,dmat,salesmen,min_tour, ...
% pop_size,num_iter,1,1);
%
% 3D Example:
% n = 35;
% xyz = 10*rand(n,3);
% salesmen = 5;
% min_tour = 3;
% pop_size = 80;
% num_iter = 5e3;
% a = meshgrid(1:n);
% dmat = reshape(sqrt(sum((xyz(a,:)-xyz(a',:)).^2,2)),n,n);
% [opt_rte,opt_brk,min_dist] = mtspof_ga(xyz,dmat,salesmen,min_tour, ...
% pop_size,num_iter,1,1);
%
% See also: mtsp_ga, mtspf_ga, mtspo_ga, mtspofs_ga, mtspv_ga, distmat
【文件预览】:
Matlab多旅行商实验
----mtspofs_ga.zip(4KB)
----mtspf_ga.zip(4KB)
----mtspof_ga.zip(4KB)
网友评论
- 挺好的, 不亏是花了3积分
- 三种算法均可以在MATLAB2013a下成功运行,但是注释全部为英文,故具体的实现方法还在研究中。非常感谢分享该资源
- 不错,应该可以使用。
- 要是给点说明就好的,说明太少了
- 很好,程序可以跑下来,要是再多点注释就好了。
- matlab 2010b可以运行,效果图直观,速度很快,对数学建模用处很大。
- 我使用的是2010b,可以运行,结果非常直观,四张图分别显示了城市坐标,城市间距,所有人行进路线以及当前最优解与时间的曲线图,唯一美中不足的就是程序里的注释略少,可读性较差
- 不错,但是只有3种类型,,并且缺少dmat文件,我来上传其他的种类吧
- 很不错啊,我使用2010b版本的,可以运行啊
- 很不错啊,我使用2010b版本的,可以运行啊,三个文件,分别适应不同的情况,很好很好啊~~!!
- 不知道为什么,程序运行不了