海洋捕食者算法(MPA) 解决单目标优化问题

Posted 这是一个很随便的名字

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了海洋捕食者算法(MPA) 解决单目标优化问题相关的知识,希望对你有一定的参考价值。

[Matlab源码]

海洋捕食者算法 (MPA) 是一种受自然启发的优化算法,它遵循自然支配最佳觅食策略的规则,并在海洋生态系统中遇到捕食者和猎物之间的速率策略。

 MPA 优化过程分为三个主要优化阶段,考虑不同的速度比,同时模拟捕食者和猎物的整个生活:(1)在高速度比或当猎物移动得比捕食者快时,(2)在单位速度比或当捕食者和猎物几乎以相同的速度移动时,以及 (3) 当捕食者比猎物移动得更快时,速度比低。对于每个定义的阶段,指定和分配特定的迭代周期。这些步骤是根据捕食者和猎物运动的性质所管理的规则定义的,同时模仿自然界中捕食者和猎物的运动。

代码:



% --------------------------------------------
% fobj = @YourCostFunction
% dim = number of your variables
% Max_iteration = maximum number of iterations
% 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
% ---------------------------------------------------------

clear all
clc
format long
SearchAgents_no=25; % Number of search agents

Function_name='F23';
   
Max_iteration=500; % Maximum number of iterations

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

[Best_score,Best_pos,Convergence_curve]=MPA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);

% function topology
figure('Position',[500 400 700 290])
subplot(1,2,1);
func_plot(Function_name);
title('Function Topology')
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])

% Convergence curve
subplot(1,2,2);
semilogy(Convergence_curve,'Color','r')
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');


display(['The best solution obtained by MPA is : ', num2str(Best_pos,10)]);
display(['The best optimal value of the objective function found by MPA is : ', num2str(Best_score,10)]);
disp(sprintf('--------------------------------------'));

运行结果:

 

 获取完整代码: https://ai.52learn.online/code/28

以上是关于海洋捕食者算法(MPA) 解决单目标优化问题的主要内容,如果未能解决你的问题,请参考以下文章

多目标海洋捕食者算法(MOMPA) 解决多目标优化问题

多目标海洋捕食者算法(MOMPA) 解决多目标优化问题

优化算法海洋捕食者算法(MPA)matlab源码

MATLAB实战系列(三十九)-matlab多目标优化之海洋捕食者算法

月径流预测基于matlab海洋捕食者算法优化BP神经网络月径流预测含Matlab源码 2002期

单目标优化求解基于matlab多子群改进的海洋捕食者算法(MSMPA)求解单目标优化问题含Matlab源码 1783期