资源简介
本文档包含了MATLAB遗传算法求解MTSP问题的代码
代码中有详细的注释
注意一点,本文来源网络,侵删!!!
代码片段和文件信息
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问题代码
相关资源
- 5种MATLAB求解MTSP问题代码
- 局部加权的线性回归的matlab实现
- 梯度下降法的matlab代码,包括最小二
-
simuli
nk仿真伺服系统三环控制 - Matlab笔记本自带摄像头人脸识别 by
- 粒子群Matlab
- 已知函数及区间,求区间内极值 mat
- 人工智能八数码问题过程表示求解m
- 用matlab实现三步搜索法
- 使用matlab批量删除txt文件中的连续的
- 根据面积或者边长求最小包围盒
- kernel function_matlab
- MATLAB在数学建模中的应用上下PDF 源程
- vicsek模型仿真-matlab代码
- matlab实现从txt中读取16进制数据并转换
- 三维粒子群算法的matlab实现 源代码带
- 二进制引力搜索算法BGSAmatlab程序
- 万有引力算法GSA-matlab程序
- poblano_toolbox_1.1.zip
- MATLAB环境下的船用柴油机故障诊断的
- 机械臂阻抗控制Matlab仿真
- Jacobi迭代算法
- MATLAB图片批量归一化
- 选择性搜索的matlab源代码
- matlab各个版本安装包以及破解文件
- CW HFM LFM宽带模糊函数仿真代码.m
- 模式识别matlab:最小错误率、最小风
- 基于MATLAB实现的说话人识别程序,分
- 一个声纹识别的全代码matlab
- 直流电机双闭环调试
评论
共有 条评论