【优化算法】多目标蚁狮优化算法(MOALO)【含Matlab源码 1598期】
一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【优化算法】多目标蚁狮优化算法(MOALO)【含Matlab源码 1598期】
获取代码方式2:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
备注:
订阅紫极神光博客付费专栏,可免费获得1份代码(有效期为订阅日起,三天内有效);
二、蚁狮优化算法简介
蚁狮算法是一种模仿自然界中蚁狮的捕猎机制的智能算法。蚁狮在沙子中,利用它的下颚挖出一个圆锥形的沙坑作为捕猎陷阱。一旦有猎物落陷阱,蚁狮便会将它拖入沙子底部并吃掉。通过与一些其他流行的智能算法比较,例如PSO、GA和杜鹃算法(CS),ALO显示出更好的收敛性、准确性和鲁棒性,但依然存在着收敛准确度低、易陷入局部最优解的缺陷。
(1)蚂蚁随机游走
首先假设由n个蚂蚁组成的蚂蚁种群Xant=(XA,1,XA,n,…,XA,N)T,XdA,n是第n个蚂蚁的第d个变量。蚂蚁移动的数学表达为
式中,XA,n(t)为迭代t次时第n个蚂蚁的位置;cums m为累积和;tm a x为最大迭代次数。
为防止个体越限,对其进行标准化处理,即
式中,min C(XdA,n)、max C(XdA,n)分别为第n只蚂蚁随机游走时的最小和最大步长;ud(t)、ld(t)分别为第t次迭代时第d个变量的上界和下界。
三、部分源代码
%_________________________________________________________________________%
% Multi-Objective Ant Lion Optimizer (MALO) source codes demo %
% version 1.0 %
% %
% %
%_________________________________________________________________________%
clc;
clear;
close all;
% Change these details with respect to your problem%%%%%%%%%%%%%%
ObjectiveFunction=@ZDT1;
dim=5;
lb=0;
ub=1;
obj_no=2;
if size(ub,2)==1
ub=ones(1,dim)*ub;
lb=ones(1,dim)*lb;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Initial parameters of the MODA algorithm
max_iter=100;
N=100;
ArchiveMaxSize=100;
Archive_X=zeros(100,dim);
Archive_F=ones(100,obj_no)*inf;
Archive_member_no=0;
r=(ub-lb)/2;
V_max=(ub(1)-lb(1))/10;
Elite_fitness=inf*ones(1,obj_no);
Elite_position=zeros(dim,1);
Ant_Position=initialization(N,dim,ub,lb);
fitness=zeros(N,2);
V=initialization(N,dim,ub,lb);
iter=0;
position_history=zeros(N,max_iter,dim);
for iter=1:max_iter
for i=1:N %Calculate all the objective values first
Particles_F(i,:)=ObjectiveFunction(Ant_Position(:,i)');
if dominates(Particles_F(i,:),Elite_fitness)
Elite_fitness=Particles_F(i,:);
Elite_position=Ant_Position(:,i);
end
end
[Archive_X, Archive_F, Archive_member_no]=UpdateArchive(Archive_X, Archive_F, Ant_Position, Particles_F, Archive_member_no);
if Archive_member_no>ArchiveMaxSize
Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no);
[Archive_X, Archive_F, Archive_mem_ranks, Archive_member_no]=HandleFullArchive(Archive_X, Archive_F, Archive_member_no, Archive_mem_ranks, ArchiveMaxSize);
else
Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no);
end
Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no);
% Chose the archive member in the least population area as arrtactor
% to improve coverage
index=RouletteWheelSelection(1./Archive_mem_ranks);
if index==-1
index=1;
end
Elite_fitness=Archive_F(index,:);
Elite_position=Archive_X(index,:)';
Random_antlion_fitness=Archive_F(1,:);
Random_antlion_position=Archive_X(1,:)';
for i=1:N
index=0;
neighbours_no=0;
RA=Random_walk_around_antlion(dim,max_iter,lb,ub, Random_antlion_position',iter);
[RE]=Random_walk_around_antlion(dim,max_iter,lb,ub, Elite_position',iter);
Ant_Position(:,i)=(RE(iter,:)'+RA(iter,:)')/2;
Flag4ub=Ant_Position(:,i)>ub';
Flag4lb=Ant_Position(:,i)<lb';
Ant_Position(:,i)=(Ant_Position(:,i).*(~(Flag4ub+Flag4lb)))+ub'.*Flag4ub+lb'.*Flag4lb;
end
display(['At the iteration ', num2str(iter), ' there are ', num2str(Archive_member_no), ' non-dominated solutions in the archive']);
end
figure
Draw_ZDT1();
hold on
plot(Archive_F(:,1),Archive_F(:,2),'ko','MarkerSize',8,'markerfacecolor','k');
legend('True PF','Obtained PF');
title('MALO');
set(gcf, 'pos', [403 466 230 200])
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
四、运行结果
五、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016.
[2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.
文章来源: qq912100926.blog.csdn.net,作者:海神之光,版权归原作者所有,如需转载,请联系作者。
原文链接:qq912100926.blog.csdn.net/article/details/121894898
- 点赞
- 收藏
- 关注作者
评论(0)