优化算法海洋捕食者算法(MPA)matlab源码
Posted Matlab走起
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了优化算法海洋捕食者算法(MPA)matlab源码相关的知识,希望对你有一定的参考价值。
MPA的主要灵感是广泛的觅食策略,即海洋捕食者中的Lévy和Brownian运动,以及捕食者与猎物之间生物相互作用中的最佳遭遇率策略。MPA遵循在最佳觅食策略中自然支配的规则,并在海洋生态系统中的捕食者与猎物之间遇到速率策略。本文评估了MPA在29个测试功能,CEC-BC-2017测试套件,随机生成的景观,三个工程基准以及两个在通风和建筑节能方面的实际工程设计问题中的性能。将MPA与三类现有的优化方法进行了比较,包括(1)GA和PSO是研究最深入的元启发式算法;(2)GSA,CS和SSA是最近开发的算法;(3)CMA-ES,SHADE和LSHADE-cnEpSin是高性能优化器和IEEE CEC获奖者竞争。在所有方法中,与LSHADE-cnEpSin相比,MPA获得了第二名,并表现出非常具有竞争力的结果,LSHADE-cnEpSin是表现最好的方法,并且是CEC 2017竞赛的获胜者之一。事后统计分析表明,MPA可以被提名为高性能优化器,并且是一种比GA,PSO,GSA,CS,SSA和CMA-ES更好的算法,而统计上的性能类似于SHADE和LSHADE-cnEpSin
%_________________________________________________________________________
% Marine Predators Algorithm source code (Developed in MATLAB R2015a)
%
%_________________________________________________________________________
% --------------------------------------------
% 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');
%_________________________________________________________________________
% Marine Predators Algorithm source code (Developed in MATLAB R2015a)
%
% programming: Afshin Faramarzi & Seyedali Mirjalili
%
% paper:
% A. Faramarzi, M. Heidarinejad, S. Mirjalili, A.H. Gandomi,
% Marine Predators Algorithm: A Nature-inspired Metaheuristic
% Expert Systems with Applications
% DOI: doi.org/10.1016/j.eswa.2020.113377
%
% E-mails: afaramar@hawk.iit.edu (Afshin Faramarzi)
% muh182@iit.edu (Mohammad Heidarinejad)
% ali.mirjalili@laureate.edu.au (Seyedali Mirjalili)
% gandomi@uts.edu.au (Amir H Gandomi)
%_________________________________________________________________________
% This function containts full information and implementations of the benchmark
% functions in Table 1, Table 2, and Table 3 in the paper
% lb is the lower bound: lb=[lb_1,lb_2,...,lb_d]
% up is the uppper bound: ub=[ub_1,ub_2,...,ub_d]
% dim is the number of variables (dimension of the problem)
function [lb,ub,dim,fobj] = Get_Functions_details(F)
switch F
case 'F1'
fobj = @F1;
lb=-100;
ub=100;
dim=50;
case 'F2'
fobj = @F2;
lb=-10;
ub=10;
dim=50;
case 'F3'
fobj = @F3;
lb=-100;
ub=100;
dim=50;
case 'F4'
fobj = @F4;
lb=-100;
ub=100;
dim=50;
case 'F5'
fobj = @F5;
lb=-30;
ub=30;
dim=50;
case 'F6'
fobj = @F6;
lb=-100;
ub=100;
dim=50;
case 'F7'
fobj = @F7;
lb=-1.28;
ub=1.28;
dim=50;
case 'F8'
fobj = @F8;
lb=-500;
ub=500;
dim=50;
case 'F9'
fobj = @F9;
lb=-5.12;
ub=5.12;
dim=50;
case 'F10'
fobj = @F10;
lb=-32;
ub=32;
dim=50;
case 'F11'
fobj = @F11;
lb=-600;
ub=600;
dim=50;
case 'F12'
fobj = @F12;
lb=-50;
ub=50;
dim=50;
case 'F13'
fobj = @F13;
lb=-50;
ub=50;
dim=50;
case 'F14'
fobj = @F14;
lb=-65.536;
ub=65.536;
dim=2;
case 'F15'
fobj = @F15;
lb=-5;
ub=5;
dim=4;
case 'F16'
fobj = @F16;
lb=-5;
ub=5;
dim=2;
case 'F17'
fobj = @F17;
lb=[-5,0];
ub=[10,15];
dim=2;
case 'F18'
fobj = @F18;
lb=-2;
ub=2;
dim=2;
case 'F19'
fobj = @F19;
lb=0;
ub=1;
dim=3;
case 'F20'
fobj = @F20;
lb=0;
ub=1;
dim=6;
case 'F21'
fobj = @F21;
lb=0;
ub=10;
dim=4;
case 'F22'
fobj = @F22;
lb=0;
ub=10;
dim=4;
case 'F23'
fobj = @F23;
lb=0;
ub=10;
dim=4;
end
end
% F1
function o = F1(x)
o=sum(x.^2);
end
% F2
function o = F2(x)
o=sum(abs(x))+prod(abs(x));
end
% F3
function o = F3(x)
dim=size(x,2);
o=0;
for i=1:dim
o=o+sum(x(1:i))^2;
end
end
% F4
function o = F4(x)
o=max(abs(x));
end
三、运行结果
四、备注
完整代码或者仿真咨询添加QQ1575304183
以上是关于优化算法海洋捕食者算法(MPA)matlab源码的主要内容,如果未能解决你的问题,请参考以下文章