【优化求解】基于蝠鲼觅食优化算法MRFO求解最优目标matlab源码

239 阅读2分钟

1 简介

蝠鲼觅食优化 (Manta ray foraging optimization,MRFO)是由 Zhao 等,在 2019 年提出的新型智能仿生群体算法。

img

img

img

img

img

img

2 部分代码

% __ __ __ __ __ __ __ __ __ __ __ __ _%

% 蝠鲼觅食优化算法   %

% __ __ __ __ __ __ __ __ __ __ __ __ _%

% 使用方法

% __ __ __ __ __ __ __

% 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 SSA: [Best_pos,Best_score,curve]=MRFO(pop,Max_iter,lb,ub,dim,fobj)

% __ __ __ __ __ __ __

clear all

clc

SearchAgents_no=30; % 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=200; % Maximum numbef of iterations 设定最大迭代次数

% Load details of the selected benchmark function

[lb,ub,dim,fobj]=Get_Functions_details(Function_name); %设定边界以及优化函数

[Best_pos,Best_score,MRFO_curve]=MRFO(SearchAgents_no,Max_iteration,fobj,lb,ub,dim); %开始优化

figure('Position',[269  240  660  290])

%Draw search space

subplot(1,2,1);

func_plot(Function_name);

title('Parameter space')

xlabel('x_1');

ylabel('x_2');

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

%Draw objective space

subplot(1,2,2);

plot(MRFO_curve,'Color','r','linewidth',1.5)

title('Objective space')

xlabel('Iteration');

ylabel('Best score obtained so far');

axis tight

grid on

box on

legend('MRFO')

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

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

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

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

3 仿真结果

4 参考文献

[1]凤盛强. "基于蝠鲼觅食优化算法的配电网故障区间定位." 兰州文理学院学报:自然科学版 35.1(2021):5.

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

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