【蚁狮算法】基于柯西变异的蚁狮优化算法求解单目标优化问题matlab代码
1 简介
针对蚁狮优化算法较易陷入局部最优停滞,收敛精度低以及收敛速度较慢等问题,将自适应t分布的柯西变异融入到蚁狮优化算法中,提出了基于柯西变异的蚁狮优化算法(CALO).该算法采用轮盘赌的方法挑选出精英蚁狮个体,改善蚁狮群体的适应性,提高种群的总体寻优效率;采用具有自适应的柯西变异算子使得蚁狮个体受局部极值点约束力下降,能够快速跳出局部最优,大大提高了全局搜索能力和收敛速度;通过9个单模态,多模态标准测试函数对CALO,ALO,FPA和BA四种算法进行函数测试对比,实验仿真结果表明该改进算法是切实可行的,具有更优的收敛速度和寻优精度
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]. 微电子学与计算机, 2019, 36(6):6.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
【蚁狮算法】基于柯西变异的蚁狮优化算法求解单目标优化问题matlab代码相关推荐
- 【智能优化算法-蒲公英优化器】基于蒲公英优化器求解单目标优化问题附matlab代码
1 内容介绍 群智能优化算法作为当前优化算法中的一个主要研究热点,经过近年的发展,已经发展为较为新颖的演化计算技术,受到越来越多不同领域研究工作者的关注.群智能优化算法比传统优化方法求解各种复杂优化问 ...
- 【优化求解】基于缎蓝园丁鸟优化算法 (SBO)求解单目标问题附matlab代码
1 简介 2 部分代码 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...
- 【优化求解】基于蝗虫算法求解单目标问题附matlab代码
1 简介 蝗虫算法( Grasshopper Optimization Algorithm,GOA ) 是 由 Saremi 等[1]于2017 年提出的一种元启发式仿生优化算法.具体原理如下: 2 ...
- 【智能优化算法-灰狼算法】基于贪婪非分级灰狼优化器求解单目标优化问题附matlab代码
1 内容介绍 灰狼优化(GWO)算法是一种新兴的算法,它基于灰狼的社会等级以及它们的狩猎和合作策略. 该算法于 2014 年推出,已被大量研究人员和设计人员使用,原始论文的引用次数超过了许多其他算法. ...
- 【优化求解】基于鸟群算法(Bird Swarm Algorithm)求解单目标最优matlab代码
1 简介 鸟群算法( bird swarm alogrithm,BSA) 是由 Meng 等人于 2015 年提出的一种基于鸟群行为的群智能优化算法,其思想源于鸟群的飞行.觅食和警戒三个主要群体行为, ...
- 【樽海鞘算法】基于樽海鞘算法求解单目标问题附matlab代码(Salp Swarm Algorithm,SSA)
1 简介 2 部分代码 %_________________________________________________________________________________% Salp ...
- 【象群算法】基于象群算法求解单目标问题附matlab代码(Elephant Herding Optimization,EHO)
1 简介 象群 算 法(ElephantHerdingOptimization,EHO)是一种启发式搜索算法,源 于 对 大 象 群 体 行为的研究.该算法原理简单,易于实现,目前应用于传感器部署.土 ...
- 【智能优化算法-飞蛾火焰优化算法】基于动态惯性权值策略的飞蛾火焰优化算法求解单目标问题附matlab代码
✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信.
- 基于柯西变异的蚁狮优化算法 - 附代码
基于柯西变异的蚁狮优化算法 文章目录 基于柯西变异的蚁狮优化算法 1.蚁狮优化算法 2. 改进蚁狮优化算法 2.1 基于柯西变异算子改进 3.实验结果 4.参考文献 5.Matlab代码 6.Pyth ...
最新文章
- python代码案例详解-Python之入门基础字典案例详解,新手必学
- 设计模式--装饰者模式
- Vue.nextTick()理解
- 微软正式发布Windows 10 2020年10月更新
- 张高兴的 .NET Core IoT 入门指南:(五)PWM 信号输出
- python读取多个sheet文件_PythonPandas excel文件如何一次读取所有工作表,并再次写入多个工作表?,pythonpandasexcel,一次性,全部,sheet,重新...
- 在Ubuntu 8.04 LTS(hardy)下安装配置nginx和fastcgi方式的php
- 一年中最后一个月的最后一天说说_一年最后一天的心情说说
- Ubuntu21.04 安装 VLC视频播放器
- 简单计算器——两种方法
- 【OneNote】同时设置中英文字体显示(雅黑+Consolas)
- 通过PHP使用Google Translate API
- JS数据结构中的集合结构详解
- Sails基础之View层
- ps cs6更新服务器无响应,photoshop cs6打开无响应或者不能打开图片文件最全解决办法...
- 跳跃游戏2(求最少跳跃次数)Python解法
- YOLOV5的FPS计算问题
- Paddle 点灯人 之 Tensor
- CF中dns服务器简单配置
- LDPC码简介【定义、特点、算法、Tanner】
热门文章
- js 时间戳与日期格式之间的互转(转载)
- 《团队-排课软件-开发文档》
- [LeetCode题解]从两个有序数组的并集中寻找第k小元素
- (1)goland下载安装+示例代码运行
- java crm 系统 进销存 springmvc SSM项目项目源码
- 读书无用论标准演算公式
- 如何去掉流氓网站http://www.2345.com/?177
- 大数据智能交通信号灯 城市道路Easy Go
- 异步电机无传感器矢量控制的算法,matlab,仿真模型,采用转子磁链定向控制算法,转子磁链观测器采用电压模型+电流模型补偿算法。
- 微信h5棋牌架设多线程,多进程服务器的实现