资源简介
蚁群-微分进化算法解TSP的matlab实现,有详尽的报告
代码片段和文件信息
function [bestRouteminLength] = AcoDeTsp(DistantsNumgroupNummaxIter)
%%
if mod(antsNumgroupNum)~=0
error(‘antsNum must be divided exactly by groupNum‘);
end
n = size(Dist1);
m = antsNum;
g = groupNum;
gs = m/g;%groupSize
pherP = 1;
expP = 5;
volR = 0.1;
pherC = 1;
muteC = 2;
crossR = 0.5;
Exp = 1./Dist;
groupPher = cell(1g);
for i=1:g
groupPher{i}=ones(nn);
end
Route = zeros(mn);
%groupBestRoute = zeros(gn);
bestRoute = zeros(maxItern);
minLength = zeros(maxIter1);
%%
citiesIdx = 1:n;
iter = 1;
while iter <= maxIter
%% ************** ACO **************
%******* ants move according to pheromone *******
for i=1:m
%ant i
curG = ceil(i/gs);
curPher = groupPher{curG};
Route(i1) = randi(n);
for j=2:n
%jth step
tabu = Route(i1:j-1);
avail = ~ismember(citiesIdxtabu);
availIdx = citiesIdx(avail);
availNum = length(availIdx);
Prob = zeros(availNum1);
lastC = Route(ij-1);
for k=1:availNum
Prob(k) = curPher(availIdx(k)lastC)^pherP * Exp(availIdx(k)lastC)^expP;
end
Prob = Prob/sum(Prob);
cumP = cumsum(Prob);
nextIdx = find(cumP >= rand);
nextCIdx = availIdx(nextIdx(1));
Route(ij) = nextCIdx;
end
end
%******* calculate route length *******
len = zeros(m1);
for i=1:m
r = Route(i:);
for j=1:n-1
len(i) = len(i) + Dist(r(j)r(j+1));
end
len(i) = len(i) + Dist(r(n)r(1));
end
%******* find overall-best route *******
[minLenminIdx] = min(len);
bestRoute(iter:) = Route(minIdx:);
minLength(iter) = minLen;
%******* update pheromone *******
for curG=1:g
deltaPher = zeros(nn);
for i=1:gs
idx = (curG-1)*gs+i;
curR = Route(idx:);
for j=1:n-1
deltaPher(curR(j)curR(j+1)) = deltaPher(curR(j)curR(j+1)) + pherC/len(idx);
end
deltaPher(curR(n)curR(1)) = deltaPher(curR(n)curR(1)) + pherC/len(idx);
end
groupPher{curG} = (1-volR)*groupPher{curG} + deltaPher;
end
%%************** DE **************
for curG=1:g
%******* mute *******
curPher = groupPher{curG};
r1 = randi(curG);
r2 = randi(curG);
r3 = randi(curG);
vPher = groupPher{r1} + muteC*(groupPher{r2}-groupPher{r3});
%******* cross *******
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1562 2013-12-02 18:34 Main.m
文件 424405 2013-12-08 23:54 蚁群-微分进化算法之TSP.docx
文件 6332 2013-12-02 18:06 AcoDeTsp.m
文件 2073 2013-12-02 16:14 AcoTsp.m
文件 328 2013-11-01 14:10 cities.mat
----------- --------- ---------- ----- ----
434700 5
相关资源
- 蚁群聚类算法matlab实现
- 蚁群算法解决背包问题matlab
- 蚁群算法图像分割
- 禁忌搜索TSP
- 带约束的蚁群算法模型解决TSP问题M
- 基于蚁群算法和Dijkstra算法的二维路径
- 蚁群算法matlab完整代码
- 蚁群算法求解最短路,详细,可用于
- 蚁群算法求解最短路径问题MATLAB代码
- TSP问题的禁忌搜索解法MATLAB程序
- 基于matlab粒子群算法解决旅行商(T
- 模拟退火的方法解TSP问题--matlab
- 机器人障碍环境下路径规划改进的回
- 改进的蚁群算法求解TSP问题
- 蚁群算法解决TSP问题MATLAB程序
- 蚁群算法求解旅行商最优路径问题
- 蚁群算法的matlab源码.rar
- Tabu search by matlab to solve TSP
- Matlab中蚁群算法求解连续函数优化的
- 基于蚁群算法和神经网络匹配算法的
- 基于蚁群算法的二、三维路径规划算
- 遗传模拟退火解决tsp问题
- 基于蚁群算法的图像边缘检测.zip
- 蚁群算法求解TSP最短路径规划
- TSP多种群蚁群算法
- 蚁群算法TSP问题工具箱
- matlab人工免疫算法求解TSP问题
- 蚁群算法的matlab源码
- 多旅行商问题代码
- 基于蚁群算法的路径规划源码
评论
共有 条评论