1 简介

针对蚁狮优化算法较易陷入局部最优停滞、收敛精度低以及收敛速度较慢等问题,将莱维飞行机制和黄金正弦算法融合到蚁狮优化算法中,提出了融合莱维飞行与黄金正弦的蚁狮优化算法( LGSALO) 。该算法利用 Lévy 飞行的变异机制对寻优过程中位置更新方式进行变异操作,可以改善种群多样性,使得算法跳出局部最优,提高全局寻优能力,并在一定程度上避免了算法的过早收敛; 同时引入黄金正弦算法改进精英蚁狮的寻优方式,协调算法的全局探索与局部开发能力。实验仿真结果表明,该改进算法的寻优性能良好,开发能力强。蚁狮优化算法是根据蚁狮幼虫诱捕蚂蚁的捕猎机制原理而提出的一种智能算法。

蚁狮狩猎时实施的五个主要步骤为蚂蚁的随机游走、建造陷阱、诱捕蚂蚁进入陷阱、捕捉猎物以及重新建造陷阱。狩猎方式如下: 蚁狮幼虫会在沙地上挖出不同大小锥形的陷阱坑,在挖出陷阱后,藏在陷阱中心的下方等待蚂蚁被困在坑里,当猎物被抓住时马上就会被拉到土壤里吃掉; 在吃完猎物后,蚁狮会把剩下的食物扔到坑外,然后再去重新构建陷阱,寻找下一个猎物。蚁狮优化算法模仿了蚁狮捕猎蚂蚁的聪明行为。构建模型寻求最优解时,有以下七个假设条件: a) 蚂蚁以不同的随机游走步长在蚁狮的搜索空间中移动,其游走行为受陷阱范围的限制; b) 随机游走适用于蚂蚁的所有维度; c) 蚁狮可以与它们的适应度成正比( 适应性越高,锥形陷阱半径越大,越容易捕获蚂蚁) ; d) 每一个蚂蚁都可以在每一次迭代中被一个精英蚁狮捕获; e) 随机游走的范围可以自适应地减少,以模拟蚂蚁滑向坑底的行为; f) 如果蚂蚁比蚁狮的适应值更高,意味着它被蚁狮捕获; g) 蚁狮在捕猎之后会把自己重新定位到捕获的猎物的位置,并在寻找下一个猎物的过程中建立一个适应值更高的陷阱来改善它的捕猎机制。蚂蚁在寻找食物时的随机游走公式如下:

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]. 计算机应用研究, 2020, 37(8):5.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

【智能优化算法】基于融合莱维飞行与黄金正弦的蚁狮算法求解单目标优化问题matlab代码相关推荐

  1. 融合莱维飞行与黄金正弦的蚁狮优化算法-附代码

    融合莱维飞行与黄金正弦的蚁狮优化算法 文章目录 融合莱维飞行与黄金正弦的蚁狮优化算法 1.蚁狮优化算法 2. 改进蚁狮优化算法 2.1 Lévy 变异机制 2.2 黄金正弦算法 3.实验结果 4.参考 ...

  2. 【优化求解】基于鸟群算法(Bird Swarm Algorithm)求解单目标最优matlab代码

    1 简介 鸟群算法( bird swarm alogrithm,BSA) 是由 Meng 等人于 2015 年提出的一种基于鸟群行为的群智能优化算法,其思想源于鸟群的飞行.觅食和警戒三个主要群体行为, ...

  3. 【优化求解】基于蝗虫算法求解单目标问题附matlab代码

    1 简介 蝗虫算法( Grasshopper Optimization Algorithm,GOA ) 是 由 Saremi 等[1]于2017 年提出的一种元启发式仿生优化算法.具体原理如下: 2 ...

  4. 【优化求解】基于缎蓝园丁鸟优化算法 (SBO)求解单目标问题附matlab代码

    1 简介 ​ 2 部分代码 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...

  5. 【樽海鞘算法】基于樽海鞘算法求解单目标问题附matlab代码(Salp Swarm Algorithm,SSA)

    1 简介 2 部分代码 %_________________________________________________________________________________% Salp ...

  6. 【象群算法】基于象群算法求解单目标问题附matlab代码(Elephant Herding Optimization,EHO)

    1 简介 象群 算 法(ElephantHerdingOptimization,EHO)是一种启发式搜索算法,源 于 对 大 象 群 体 行为的研究.该算法原理简单,易于实现,目前应用于传感器部署.土 ...

  7. 【智能优化算法-飞蛾火焰优化算法】基于动态惯性权值策略的飞蛾火焰优化算法求解单目标问题附matlab代码

    ✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.

  8. 【智能优化算法】基于矮猫鼬优化算法求解单目标优化问题附matlab代码

    1 简介 基于矮猫鼬优化算法求解单目标优化问题​ 2 部分代码 %___________________________________________________________________ ...

  9. 【单目标优化求解】基于matlab增强型黑猩猩优化器算法求解单目标优化问题【含Matlab源码 2013期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[单目标优化求解]基于matlab增强型黑猩猩优化器算法求解单目标优化问题[含Matlab源码 2013期] 点击上面蓝色字体,直接付费下 ...

最新文章

  1. app开发外包的流程、需求、报价,需要知道的细节!
  2. 2016年软考网络工程师考试命题范围变化之网络设备配置与复习技巧
  3. 【Groovy】编译时元编程 ( 编译时处理 ASTTransformation 接口实现 | 配置 ASTTransformation )
  4. USB 3G驱动和USB HOST驱动加载
  5. mysql设计经纬度表_MySQL经纬度表设置
  6. [NOIP1999] 提高组 洛谷P1014 Cantor表
  7. .NET 应用如何优雅的做功能开关(Feature Flag)
  8. Spring Cache 配置及一些问题的解决
  9. transmac使用方法_Mac苹果电脑降级方法?
  10. android内核源码下载和编译
  11. Spring aop切面插入事物回滚
  12. 电脑计算机配置应用程序兼容性,软件和系统不兼容怎么办 电脑禁用程序兼容助手服务的操作方法...
  13. http下载大文件测试
  14. Typora的历史版本下载地址
  15. plsql误删除数据,怎么恢复?
  16. 一文讲解单片机、ARM、MCU、DSP、FPGA、嵌入式错综复杂的关系
  17. AutoLayout(自动布局)入门
  18. 基于Android平台的监控端和被监控端系统
  19. Surface Go为教育而生,微软将如何改变中国课堂?
  20. PS命令、procfs

热门文章

  1. 瓜子二手车2019秋招研发笔试卷1
  2. 日常BUG总结:另一个程序已锁定文件的一部分,进程无法访问 打不开磁盘
  3. java祝福语_[端午节java祝福语]端午节的祝福语10字
  4. Grizzly Release Notes
  5. 微软在向IPhone宣战
  6. 自然语言处理从入门到应用——词向量的评价方法
  7. #PLC_浮点数值的通讯传输
  8. 深信服EDR远程命令执行
  9. [“第五空间“智能安全大赛 2020] misc 复现
  10. mysql 同步 结构_mysqlSync