【蚁狮算法】基于具有自适应边界与最优引导的莱维飞行蚁狮优化算法(ABLALO)求解单目标优化问题matlab代码
1 简介
针对蚁狮算法存在探索与开发能力不平衡的缺点,提出了具有自适应边界与最优引导的莱维飞行改进算法.首先蚁狮调整边界范围,蚂蚁做莱维飞行,以此平衡探索与开发能力;其次较差蚁狮做高斯变异,并通过自适应最优引导方程,提高收敛速度和全局搜索能力.6个标准测试函数的仿真结果表明,相比其它算法,提出的改进算法提高了最优解的精度和收敛速度.
2 部分代码
%___________________________________________________________________%
% Ant Lion Optimizer (ALO) source codes demo version 1.0 %
% You can simply define your cost in a seperate file and load its handle to fobj
% The initial parameters that you need are:
%__________________________________________
% fobj = @YourCostFunction
% dim = number of your variables
% Max_iteration = maximum number of generations
% SearchAgents_no = number of search agents
% lb=[lb1,lb2,...,lbn] where lbn is the lower bound of variable n
% ub=[ub1,ub2,...,ubn] where ubn is the upper bound of variable n
% If all the variables have equal lower bound you can just
% define lb and ub as two single number numbers
% To run ALO: [Best_score,Best_pos,cg_curve]=ALO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj)
function [min_value,Elite_antlion_fitness,Elite_antlion_position,Convergence_curve]=ALO(N,Max_iter,lb,ub,dim,fobj)
% Initialize the positions of antlions and ants
antlion_position=initialization(N,dim,ub,lb);
ant_position=initialization(N,dim,ub,lb);
% Initialize variables to save the position of elite, sorted antlions,
% convergence curve, antlions fitness, and ants fitness
Sorted_antlions=zeros(N,dim);
Elite_antlion_position=zeros(1,dim);
Elite_antlion_fitness=inf;
Convergence_curve=zeros(1,Max_iter);
antlions_fitness=zeros(1,N);
ants_fitness=zeros(1,N);
% Calculate the fitness of initial antlions and sort them
for i=1:size(antlion_position,1)
antlions_fitness(1,i)=fobj(antlion_position(i,:));
end
[sorted_antlion_fitness,sorted_indexes]=sort(antlions_fitness);
for newindex=1:N
Sorted_antlions(newindex,:)=antlion_position(sorted_indexes(newindex),:);
end
Elite_antlion_position=Sorted_antlions(1,:);
Elite_antlion_fitness=sorted_antlion_fitness(1);
% Main loop start from the second iteration since the first iteration
% was dedicated to calculating the fitness of antlions
Current_iter=2;
while Current_iter<Max_iter+1
% This for loop simulate random walks
for i=1:size(ant_position,1)
% Select ant lions based on their fitness (the better anlion the higher chance of catching ant)
Rolette_index=RouletteWheelSelection(1./sorted_antlion_fitness);
if Rolette_index==-1
Rolette_index=1;
end
% RA is the random walk around the selected antlion by rolette wheel
RA=Random_walk_around_antlion(dim,Max_iter,lb,ub, Sorted_antlions(Rolette_index,:),Current_iter);
% RA is the random walk around the elite (best antlion so far)
[RE]=Random_walk_around_antlion(dim,Max_iter,lb,ub, Elite_antlion_position(1,:),Current_iter);
ant_position(i,:)= (RA(Current_iter,:)+RE(Current_iter,:))/2; % Equation (2.13) in the paper
end
for i=1:size(ant_position,1)
% Boundar checking (bring back the antlions of ants inside search
% space if they go beyoud the boundaries
Flag4ub=ant_position(i,:)>ub;
Flag4lb=ant_position(i,:)<lb;
ant_position(i,:)=(ant_position(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;
ants_fitness(1,i)=fobj(ant_position(i,:));
end
% Update antlion positions and fitnesses based of the ants (if an ant
% becomes fitter than an antlion we assume it was cought by the antlion
% and the antlion update goes to its position to build the trap)
double_population=[Sorted_antlions;ant_position];
double_fitness=[sorted_antlion_fitness ants_fitness];
[double_fitness_sorted I]=sort(double_fitness);
double_sorted_population=double_population(I,:);
antlions_fitness=double_fitness_sorted(1:N);
Sorted_antlions=double_sorted_population(1:N,:);
% Update the position of elite if any antlinons becomes fitter than it
if antlions_fitness(1)<Elite_antlion_fitness
Elite_antlion_position=Sorted_antlions(1,:);
Elite_antlion_fitness=antlions_fitness(1);
end
% Keep the elite in the population
Sorted_antlions(1,:)=Elite_antlion_position;
antlions_fitness(1)=Elite_antlion_fitness;
% Update the convergence curve
Convergence_curve(Current_iter)=Elite_antlion_fitness;
% Display the iteration and best optimum obtained so far
if mod(Current_iter,1)==0
display(['At iteration ', num2str(Current_iter), ' the elite fitness is ', num2str(Elite_antlion_fitness)]);
end
min_value(Current_iter)=Elite_antlion_fitness;
Current_iter=Current_iter+1;
end
3 仿真结果
4 参考文献
[1]王若安, 周越文, 韩博,等. 具有自适应边界与最优引导的莱维飞行蚁狮优化算法[J]. 微电子学与计算机, 2018, 35(9):7.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
【蚁狮算法】基于具有自适应边界与最优引导的莱维飞行蚁狮优化算法(ABLALO)求解单目标优化问题matlab代码相关推荐
- 具有自适应边界与最优引导的莱维飞行蚁狮优化算法-附代码
具有自适应边界与最优引导的莱维飞行蚁狮优化算法 文章目录 具有自适应边界与最优引导的莱维飞行蚁狮优化算法 1.蚁狮优化算法 2. 改进蚁狮优化算法 2.1 蚂蚁莱维飞行策略 2.2 蚂蚁自适应游走边界 ...
- 【优化求解】基于缎蓝园丁鸟优化算法 (SBO)求解单目标问题附matlab代码
1 简介 2 部分代码 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...
- 【优化求解】基于蝗虫算法求解单目标问题附matlab代码
1 简介 蝗虫算法( Grasshopper Optimization Algorithm,GOA ) 是 由 Saremi 等[1]于2017 年提出的一种元启发式仿生优化算法.具体原理如下: 2 ...
- 【樽海鞘算法】基于樽海鞘算法求解单目标问题附matlab代码(Salp Swarm Algorithm,SSA)
1 简介 2 部分代码 %_________________________________________________________________________________% Salp ...
- 【象群算法】基于象群算法求解单目标问题附matlab代码(Elephant Herding Optimization,EHO)
1 简介 象群 算 法(ElephantHerdingOptimization,EHO)是一种启发式搜索算法,源 于 对 大 象 群 体 行为的研究.该算法原理简单,易于实现,目前应用于传感器部署.土 ...
- 【智能优化算法-飞蛾火焰优化算法】基于动态惯性权值策略的飞蛾火焰优化算法求解单目标问题附matlab代码
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.
- 【单目标优化求解】基于matlab增强型黑猩猩优化器算法求解单目标优化问题【含Matlab源码 2013期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[单目标优化求解]基于matlab增强型黑猩猩优化器算法求解单目标优化问题[含Matlab源码 2013期] 点击上面蓝色字体,直接付费下 ...
- 【智能优化算法】基于矮猫鼬优化算法求解单目标优化问题附matlab代码
1 简介 基于矮猫鼬优化算法求解单目标优化问题 2 部分代码 %___________________________________________________________________ ...
- 【优化算法】基于matlab量子粒子群算法求解单目标优化问题【含Matlab源码 2203期】
⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[优化算法]基于matlab量子粒子群算法求解单目标优化问题[含Matlab源码 2203期] 点击上面蓝色字体,直接付费下载,即可. 获 ...
最新文章
- 协方差矩阵介绍及C++/OpenCV/Eigen的三种实现
- Java项目中读取properties文件,以及六种获取路径的方法
- C#项目单步调试莫名结束问题
- 2021-03-09 Local Lipschitz 可能存在 有限时间逃逸
- nginx html 替换,Nginx 服务内容替换功能(sub模块)
- C++ 自定义调试信息的输出
- Linux基础学习导图
- Java JDK 安装配置
- iPhone开发知识和项目
- cplex的下载、安装、IDE编程及相关问题解决
- 射频IC行业为何这么惨?——RFIC的尴尬的现实和迷茫的未来
- 懒癌发作,福利直接发,不抢白不抢!
- Maven实战(四)--坐标
- 软件工程概论期末复习笔记
- CloudCompare学习记录(一)主要概念
- ios mac使用mitmproxy抓包
- linux vim编辑器剪切,Linux下Vim编辑器访问系统剪切板
- 数理统计-6.1 点估计的概念与无偏性
- liunx基础及系统移植
- 计算机中所说的云是什么意思,如何理解云计算中的“云”是什么?
热门文章
- 【Java加解密系列】- SM2加解密
- 对话华云数据许广彬:做信创云基座 助力中国信创产业发展
- Ubuntu删除python3后无法启动的修复
- 星号三角形描述读入一个整数N,N是奇数,输出由星号字符组成的等边三角形,要求:第1行1个星号,第2行3个星号,第3行5个星号,依次类推,最后一行共N的星号。输入输出示例
- linux系统安装serv u,用Serv-U实现Linux与windows文件互传
- 计算机集成制造系统 杂志简介,计算机集成制造系统杂志
- Apollo 星火计划课程笔记 ---- Perception
- Authentication in Loopback Applications Against Bluemix(在针对Bluemix的Lookback应用中进行身份认证)
- vsco怎么两个滤镜叠加_vsco怎么两个滤镜叠加_10 款超美的 VSCO 调色滤镜,怎么用都好看...
- 简易智能手环制作教程