斑马优化算法(Zebra Optimization Algorithm,ZOA)是中科院三区期刊“IEEE Access”上论文“Zebra Optimization Algorithm: A New Bio-Inspired Optimization Algorithm for Solving Optimization Algorithm”上的智能优化算法

01.引言
斑马优化算法(Zebra Optimization Algorithm,ZOA)的基本灵感来自于斑马在自然界中的行为。ZOA模拟了斑马的觅食行为和它们抵御捕食者攻击的防御策略。描述了ZOA步骤,然后建立了数学模型。通过单峰、高维多峰、定维多峰、CEC2015、CEC2017等68个基准函数对ZOA优化后的性能进行了评价。将ZOA算法的结果与九种常用算法的性能进行了比较。仿真结果表明,ZOA算法通过在勘探和开采之间建立适当的平衡来解决优化问题,与9种竞争算法相比,具有优越的性能。ZOA解决实际问题的能力已经在四个工程设计问题上进行了测试,即拉伸/压缩弹簧、焊接梁、减速机和压力容器。
02.代码流程

03.部分代码
%%% Designed and Developed by Eva Trojovská1, Mohammad Dehghani1, and Pavel Trojovský1* %%%
function[Best_score,Best_pos,ZOA_curve]=ZOA(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness)
lowerbound=ones(1,dimension).*(lowerbound); % Lower limit for variables
upperbound=ones(1,dimension).*(upperbound); % Upper limit for variables
%% INITIALIZATION
for i=1:dimension
X(:,i) = lowerbound(i)+rand(SearchAgents,1).*(upperbound(i) - lowerbound(i)); % Initial population
end
for i =1:SearchAgents
L=X(i,:);
fit(i)=fitness(L);
end
%%
for t=1:Max_iterations
%% update the global best (fbest)
[best , location]=min(fit);
if t==1
PZ=X(location,:); % Optimal location
fbest=best; % The optimization objective function
elseif best:);
end
%% PHASE1: Foraging Behaviour
for i=1:SearchAgents
I=round(1+rand);
X_newP1=X(i,:)+ rand(1,dimension).*(PZ-I.* X(i,:)); %Eq(3)
X_newP1= max(X_newP1,lowerbound);X_newP1 = min(X_newP1,upperbound);
% Updating X_i using (5)
f_newP1 = fitness(X_newP1);
if f_newP1 <= fit (i)
X(i,:) = X_newP1;
fit (i)=f_newP1;
end
end
%% End Phase 1: Foraging Behaviour
%% PHASE2: defense strategies against predators
Ps=rand;
k=randperm(SearchAgents,1);
AZ=X(k,:);% attacked zebra
for i=1:SearchAgents
if Ps<0.5
%% S1: the lion attacks the zebra and thus the zebra chooses an escape strategy
R=0.1;
X_newP2= X(i,:)+ R*(2*rand(1,dimension)-1)*(1-t/Max_iterations).*X(i,:);% Eq.(5) S1
X_newP2= max(X_newP2,lowerbound);X_newP2 = min(X_newP2,upperbound);
else
%% S2: other predators attack the zebra and the zebra will choose the offensive strategy
I=round(1+rand(1,1));
X_newP2=X(i,:)+ rand(1,dimension).*(AZ-I.* X(i,:)); %Eq(5) S2
X_newP2= max(X_newP2,lowerbound);X_newP2 = min(X_newP2,upperbound);
end
f_newP2 = fitness(X_newP2); %Eq (6)
if f_newP2 <= fit (i)
X(i,:) = X_newP2;
fit (i)=f_newP2;
end
end %
%%
%%
best_so_far(t)=fbest;
average(t) = mean (fit);
end %t=1:Max_iterations
Best_score=fbest;
Best_pos=PZ;
ZOA_curve=best_so_far;
end
04.代码效果图








