资源简介
本文档包含了MATLAB遗传算法求解MTSP问题的代码
代码中有详细的注释
注意一点,本文来源网络,侵删!!!
![](http://www.nz998.com/pic/57182.jpg)
代码片段和文件信息
function varargout = mtspf_ga(xydmatsalesmenmin_tourpop_sizenum_itershow_progshow_res)
% MTSPF_GA Fixed Multiple Traveling Salesmen 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
% each salesman to travel from the start location to individual cities
% and back to the original starting place)
%
% Summary:
% 1. Each salesman starts at the first point and ends at the first
% point but travels to a unique set of cities in between
% 2. Except for the first each city is visited by exactly one salesman
%
% Note: The Fixed Start/End location is taken to be the first 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/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 10 3 7] brks = [3 7]
% Taken together these represent the solution [1 5 6 9 1][1 4 2 8 1][1 10 3 7 1]
% which designates the routes for the 3 salesmen as follows:
% . Salesman 1 travels from city 1 to 5 to 6 to 9 and back to 1
% . Salesman 2 travels from city 1 to 4 to 2 to 8 and back to 1
% . Salesman 3 travels from city 1 to 10 to 3 to 7 and back to 1
%
% 2D Example:
% n = 35;
% xy = 10*rand(n2);
% salesmen = 5;
% min_tour = 3;
% pop_size = 80;
% num_iter = 5e3;
% a = meshgrid(1:n);
% dmat = reshape(sqrt(sum((xy(a:)-xy(a‘:)).^22))nn);
% [opt_rteopt_brkmin_dist] = mtspf_ga(xydmatsalesmenmin_tour ...
% pop_sizenum_iter11);
%
% 3D Example:
% n = 35;
% xyz = 10*rand(n3);
% salesmen = 5;
% min_tour = 3;
% pop_size = 80;
% num_iter = 5e3;
% a = meshgrid(1:n);
% dmat = reshape(sqrt(sum((xyz(a:)-xyz(a‘:)).^22))nn);
% [opt_rteopt_brkmin_dist] = mtspf_ga(xyzdmatsalesmenmin_tour ...
% pop_size
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10254 2019-01-27 14:53 MTSP问题matlab遗传算法求解\mtspf_ga.m
文件 10254 2019-01-27 14:53 MTSP问题matlab遗传算法求解\MTSP_GA.txt
文件 24 2019-01-27 14:56 MTSP问题matlab遗传算法求解\ReadMe.txt
目录 0 2019-01-27 14:56 MTSP问题matlab遗传算法求解
----------- --------- ---------- ----- ----
20532 4
- 上一篇:图像畸变校正
- 下一篇:5种MATLAB求解MTSP问题代码
相关资源
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
- matlab识别系统
评论
共有 条评论