【优化求解】基于蚁狮算法求解单目标优化问题Matlab代码

蚁狮优化算法(ALO)是一种群智能优化算法,因其参数调节简单和易实现性而受到关注。本文介绍了ALO的基本原理,并提供了MATLAB代码示例,展示了如何应用于函数优化。通过仿真运行,ALO成功应用于包括杠杆结构优化、电力系统无功优化调度和无人机航线规划等问题。最后,给出了基于ALO的优化结果及收敛曲线,证明了算法的有效性。
摘要由CSDN通过智能技术生成

1 简介

蚁狮优化算法( Ant Lion Optimizer,ALO) 是 Mirjalili 研究并提出的一种群智能优化算法.算法具有调节参数较少、易于实现等优点,成为近几年进化计算领域的重要算法和研究热点之一,已被成功应用于杠杆结构优化、电力系统的无功优化调度和无人机航线规划等许多问题的优化求解当中.

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)

%__________________________________________

clear all 

clc

SearchAgents_no=100; % Number of search agents

Function_name='F1'; % Name of the test function that can be from F1 to F23 (Table 1,2,3 in the paper)

Max_iteration=100; % Maximum numbef of iterations

% Load details of the selected benchmark function

[lb,ub,dim,fobj]=Get_Functions_details(Function_name);

[min_value,Best_score,Best_pos,cg_curve]=ALO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);

figure('Position',[500 500 660 290])

%Draw search space

subplot(1,2,1);

func_plot(Function_name);

title('Test function')

xlabel('x_1');

ylabel('x_2');

zlabel([Function_name,'( x_1 , x_2 )'])

grid off

%Draw objective space

subplot(1,2,2);

semilogy(cg_curve,'Color','r')

title('Convergence curve')

xlabel('Iteration');

ylabel('Best score obtained so far');

axis tight

grid off

box on

legend('ALO')

display(['The best solution obtained by ALO is : ', num2str(Best_pos)]);

display(['The best optimal value of the objective funciton found by ALO is : ', num2str(Best_score)]);

% figure(1)

% plot(min_value);

% xlabel('迭代次数')

% ylabel('适应度值');

img =gcf;  %获取当前画图的句柄

print(img, '-dpng', '-r600', './运行结果.png')         %即可得到对应格式和期望dpi的图像

3 仿真结果

4 参考文献

[1]陈倩雯. (2019). 基于改进蚁狮优化算法的含风电配电网多目标无功优化. (Doctoral dissertation, 西安理工大学).

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Matlab科研辅导帮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值