资源简介
设定障碍物,通过蚁群算法完成路径规划!
代码片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Ant system (AS) for TSP.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all;
close all
clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nodesLocation = LoadNodesLocations();
trackWidth = 5;
numberOfSection = length(nodesLocation)/trackWidth;
nodesFriction = ones(150);
i = [11 12 19 20 26 27 33 34 47 48 49 50];
nodesFriction(i) = 99;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numberOfAnts = 50; % To do: Set to appropriate value.
alpha = 1.0; % To do: Set to appropriate value.
beta = 5.0; % To do: Set to appropriate value.
rho = 0.5; % To do: set to appropriate value.
nearestNeighbourPathLength = GetNearestNeighbourPathLength(nodesLocation nodesFriction trackWidth);
tau0 = numberOfAnts/nearestNeighbourPathLength;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Initialization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
range = [0 20 0 20];
tspFigure = InitializeTspPlot(nodesLocation range);
connection = InitializeConnections(nodesLocation nodesLocation nodesFriction);
pheromoneLevel = InitializePheromoneLevels(length(nodesLocation) tau0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Main loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
minimumPathLength = inf;
iIteration = 0;
targetPathLength = 0;
while (minimumPathLength > targetPathLength)
iIteration = iIteration + 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%
% Generate paths:
%%%%%%%%%%%%%%%%%%%%%%%%%%
pathCollection = [];
pathLengthCollection = [];
for k = 1:numberOfAnts
[path pathLength] = GeneratePath(pheromoneLevel alpha beta trackWidth nodesLocation nodesFriction);
if (pathLength < minimumPathLength)
minimumPathLength = pathLength;
disp(sprintf(‘Iteration %d ant %d: path length = %.5f‘iIterationkminimumPathLength));
PlotPath(connectionnodesLocationpath trackWidth);
bestPath = path;
end
pathCollection = [pathCollection; path];
pathLengthCollection = [pathLengthCollection; pathLength];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%
% Update pheromone levels
%%%%%%%%%%%%%%%%%%%%%%%%%%
deltaPheromoneLevel = ComputeDeltaPheromoneLevels(pathCollectionpathLengthCollection trackWidth); % To do: write the ComputeDeltaPheromoneLevels function
pheromoneLevel = UpdatePheromoneLevels(pheromoneLeveldeltaPheromoneLevelrho); % To do: write the UpdatePheromoneLevels function
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2555 2018-02-06 20:00 AntRace-master\AntRace-master\AntSystem.m
文件 824 2018-02-06 20:00 AntRace-master\AntRace-master\ComputeDeltaPheromoneLevels.m
文件 88 2018-02-06 20:00 AntRace-master\AntRace-master\EuclidianDistance.m
文件 668 2018-02-06 20:00 AntRace-master\AntRace-master\GeneratePath.m
文件 853 2018-02-06 20:00 AntRace-master\AntRace-master\GetNearestNeighbourPathLength.m
文件 1360 2018-02-06 20:00 AntRace-master\AntRace-master\GetNode.m
文件 280 2018-02-06 20:00 AntRace-master\AntRace-master\InitializeConnections.m
文件 136 2018-02-06 20:00 AntRace-master\AntRace-master\InitializePheromoneLevels.m
文件 355 2018-02-06 20:00 AntRace-master\AntRace-master\InitializeTspPlot.m
文件 177 2018-02-06 20:00 AntRace-master\AntRace-master\LoadNodesLocations.m
文件 751 2018-02-06 20:00 AntRace-master\AntRace-master\NearestNeighbourg.m
文件 311 2018-02-06 20:00 AntRace-master\AntRace-master\PlotPath.m
文件 392 2018-02-06 20:00 AntRace-master\AntRace-master\README.md
文件 162 2018-02-06 20:00 AntRace-master\AntRace-master\UpdatePheromoneLevels.m
目录 0 2018-09-28 08:08 AntRace-master\AntRace-master
目录 0 2018-09-28 08:08 AntRace-master
----------- --------- ---------- ----- ----
8912 16
- 上一篇:基于蚁群算法的多机器人路径规划
- 下一篇:西门子PCS7仿真手册
相关资源
- 基于蚁群算法的多机器人路径规划
- 最后一公里EC配送程序源代码
- 3.24 基于蚁群算法的图像边缘检测.r
- 蚁群算法进行三维路径规划
- 蚁群算法源代码
- 蚁群算法精讲,步骤清晰轻松入门
- 信息素增量动态更新的改进蚁群算法
- 基于蚁群算法的无人机三维路径规划
- VRP问题蚁群算法
- 蚁群算法简单实现
- 改进的蚁群算法及其在TSP中的应用研
- 蚁群算法资料:蚁群算法工具箱
- \\基于TSP问题的蚁群算法优化及并行策
- 蚁群算法的轨迹优化基于蚁群算法的
- 基于蚁群算法的海洋工程群项目资源
- 机械臂避障路径规划仿真 蚁群算法
- 蚁群算法实验室
- 基于蚁群算法的图像分割方法
- 基于蚁群算法的最优路径选择问题的
- 嵌入混沌的蚁群优化算法
- ACO蚁群算法解01背包问题
- 基于改进蚁群算法的纳什均衡求解
- 蚁群算法解决vrp问题
- 蚁群算法与遗传算法解决TSP问题
- 蚁群算法解决TSP问题的C实现代码直接
- path-planning 路径规划蚁群算法
- 最短路径搜索蚁群算法
- ACS蚁群算法求解TSP问题
- 蚁群算法与神经网络的融合
- 数学建模蚁群算法ppt
评论
共有 条评论