欢迎来到本博客❤️❤️
博主优势:博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。
⛳️座右铭:行百里者,半于九十。
本文目录如下:
目录
1 概述
2 运行结果
3 参考文献
4 Matlab代码实现
物联网 (IoT) 服务和设备带来了许多挑战,例如连接性、计算性和安全性。因此,网络应提供并保持优质服务。如今,根据最近的研究,分布式拒绝服务(DDoS)攻击是最重要的网络攻击。在各种DDoS检测方法中,机器学习(ML)算法吸引了研究人员。在 ML 中,选择最佳特征子集对于提高分类率具有重要作用。这个问题称为特征选择问题属于NP难题,精确的算法无法在可接受的时间内获得最佳结果。因此,采用元启发式算法等近似算法来解决问题。由于这些算法不会搜索所有解空间,因此它们属于局部最优并提供过早的收敛率。到目前为止,已经引入了几种方法来应对这些挑战,但研究人员试图找到提高方法性能的新策略。该文提出一种二进制改进的非洲秃鹫优化算法(Sin-Cos-bIAVOA)来选择DDoS攻击的有效特征。该方法应用了一种新的化合物传递函数(Sin-Cos)来增加探索。为了选择要素的最佳子集,该方法中采用重力固定半径最近邻 (GFRNN) 作为分类器。此外,AVOA在勘探、平衡勘探和开发以及开发阶段三个阶段进行了改进。因此,Sin-Cos-bIAVOA探索有希望的领域,以实现最佳解决方案并避免局部最优陷阱。
部分代码:
function [Best_vulture1_F,Best_vulture1_X]=sin_cos_bIAVOA(pop_size,max_iter,dim,fobj)
lower_bound=-6;upper_bound=6;
% initialize Best_vulture1, Best_vulture2
Best_vulture1_X=zeros(1,dim);
Best_vulture1_F=inf;
Best_vulture2_X=zeros(1,dim);
Best_vulture2_F=inf;
%Initialize the first random population of vultures
X=double(initialization(pop_size,dim,1,0)>0.5);
%% Controlling parameter
p1=0.6;
p2=0.4;
p3=0.6;
alpha=0.8;
betha=0.2;
gamma=2.5;
%%Main loop
current_iter=0; % Loop counter
while current_iter < max_iter
for i=1:size(X,1)
S1=cos(X(i,:))/2+0.5;
X1=rand(1,dim)
S2=sin(X(i,:))/2+0.5;
X2=rand(1,dim)
XX=[X1;X2];
fiti=[ObjVal1;ObjVal2];
[~,ind]=min(fiti(:,1));
X(i,:)=XX(ind,:);
current_vulture_X = X(i,:);
current_vulture_F=fiti(ind,:);
fit(i,:)=fiti(ind,:);
% Update the first best two vultures if needed and Calculate the fitness of the population
if current_vulture_F(1)
Best_vulture1_X=current_vulture_X;
end
if current_vulture_F(1)>Best_vulture1_F(1) && ...
current_vulture_F(1)
Best_vulture2_X=current_vulture_X;
end
end
worst=max(fit(:,1));
a=unifrnd(-2,2,1,1)*((sin((pi/2)*(current_iter/max_iter))^gamma)+cos((pi/2)*(current_iter/max_iter))-1);
P1=(2*rand+1)*(1-(current_iter/max_iter))+a;
% Update the location
for i=1:size(X,1)
current_vulture_X = X(i,:); % pick the current vulture back to the population
F=P1*(2*rand()-1);
random_vulture_X=random_select(Best_vulture1_X,Best_vulture2_X,alpha,betha);
if (current_iter<=(1/3*max_iter))
current_vulture_X = exploration(current_vulture_X, random_vulture_X, F, p1, upper_bound, lower_bound);
% Exploitation:
elseif (current_iter>(1/3*max_iter)&& (current_iter<=(2/3*max_iter)))
prob=(fit(i)-worst)/(Best_vulture1_F(1)-worst);
if (prob>0.4)
current_vulture_X= exploitation(current_vulture_X, Best_vulture1_X, Best_vulture2_X, random_vulture_X, F, p2, p3, dim, upper_bound, lower_bound);
else
current_vulture_X = exploration(current_vulture_X, random_vulture_X, F, p1, upper_bound, lower_bound);
end
else
current_vulture_X = exploration(current_vulture_X, random_vulture_X, F, p1, upper_bound, lower_bound);
end
X(i,:) = current_vulture_X; % place the current vulture back into the population
end
current_iter=current_iter+1;
X = boundaryCheck(X, lower_bound, upper_bound);
fprintf('Iteration=%d Best_Fitness(Fitness Function,Accuracy,Precision,Recall,Specificity)=%f,%f,%f,%f,%f\n', current_iter,Best_vulture1_F );
end
end
部分理论来源于网络,如有侵权请联系删除。
[1]Zakieh Sharifian, Behrang Barekatain, Alfonso Ariza Quintana, Zahra Beheshti, Faramarz Safi-Esfahani (2023), Sin-Cos-bIAVOA: A new feature selection method based on improved African vulture optimization algorithm and a novel transfer function to DDoS attack detection, Expert System with Application, https://doi.org/10.1016/j.eswa.2023.120404