【哈里斯鷹算法】基于螢火蟲算法結(jié)合哈里斯鷹算法求解單目標(biāo)問題附matlab代碼(HHO-HG
?1 簡介
基于螢火蟲算法結(jié)合哈里斯鷹算法求解單目標(biāo)問題
2 部分代碼
clc;
clear all;
% % % % [Lb,Ub,dim,fobj] = Unimodal_Functions('F6');
% % % % figure;
% % % % Uni_plot('F6')
%
[Lb,Ub,dim,fobj] = Multimodal_Functions('F3');
figure;
Multi_plot('F3')
%
% % % [Lb,Ub,dim,fobj] = fixed_Functions('F10');
% % % figure;
% % % fixed_plot('F10')
? ? ? ? ?
fun=fobj;
? ? ? ? ? ? ? ? ? ? ? ? ?
var_niter=1000; ?
[xf,fval,vec_Gbest_iter]=HGSO(fun,dim,Lb,Ub,var_niter);
[Rabbit_Energy,Rabbit_Location,vec_Gbest_iter2]=HHO(42,var_niter,Lb,Ub,dim,fun);
[Top_predator_fit,Top_predator_pos,vec_Gbest_iter3]=MPA(42,var_niter,Lb,Ub,dim,fun);
[Leader_score,Leader_pos,vec_Gbest_iter4]=WOA(42,var_niter,Lb,Ub,dim,fun);
vec_Gbest_iter5 =LSA(42,Lb,Ub,dim,var_niter,fun);
[Xmin,Fmin,vec_Gbest_iter6]=WCA(fun,Lb,Ub,dim);
[xf2,fval2,vec_Gbest_iter7]= HHOHGSO(fun,dim,Lb,Ub,var_niter);
%%
disp(['Iteration : ' num2str(1000) ' Minimum value(HGSO) =' num2str(vec_Gbest_iter(end))]);
disp(['Iteration : ' num2str(1000) ' Minimum value(HHO) =' num2str(vec_Gbest_iter2(end))]);
disp(['Iteration : ' num2str(1000) ' Minimum value(MPA) =' num2str(vec_Gbest_iter3(end))]);
disp(['Iteration : ' num2str(1000) ' Minimum value(WOA) =' num2str(vec_Gbest_iter4(end))]);
disp(['Iteration : ' num2str(1000) ' Minimum value(LSA) =' num2str(vec_Gbest_iter5(end))]);
disp(['Iteration : ' num2str(1000) ' Minimum value(WCA) =' num2str(vec_Gbest_iter6(end))]);
disp(['Iteration : ' num2str(1000) ' Minimum value(HH0-HGSO) =' num2str(vec_Gbest_iter7(end))]);
%%
figure,
% if (vec_Gbest_iter(end)<0)||(vec_Gbest_iter2(end)<0)||(vec_Gbest_iter3(end)<0)||(vec_Gbest_iter4(end)<0)||(vec_Gbest_iter5(end)<0)
% ? ? plot(vec_Gbest_iter,'Marker','^','markersize',4,'Color','k','linewidth',1.5)
% ? ? hold on
% ? ? plot(vec_Gbest_iter2,'Marker','o','markersize',4,'Color','b','linewidth',1.5)
% ? ? hold on
% ? ? plot(vec_Gbest_iter3,'Marker','+','markersize',4,'Color','g','linewidth',1.5)
% ? ? hold on
% ? ? plot(vec_Gbest_iter4,'Marker','v','markersize',4,'Color','c','linewidth',1.5)
% ? ? hold on
% ? ? plot(vec_Gbest_iter5,'Marker','>','markersize',4,'Color','m','linewidth',1.5)
% ? ? hold on
% ? ? plot(vec_Gbest_iter6,'Marker','s','markersize',4,'Color',[0.3 0.5 0.9],'linewidth',1.5)
% ? ? hold on
% ? ? plot(vec_Gbest_iter7,'Marker','p','markersize',4,'Color','r','linewidth',1.5)
% else
? ?semilogy(vec_Gbest_iter,'Marker','^','markersize',4,'Color','k','linewidth',1.5)
? ?hold on
? ?semilogy(vec_Gbest_iter2,'Marker','o','markersize',4,'Color','b','linewidth',1.5)
? ?hold on
? ?semilogy(vec_Gbest_iter3,'Marker','+','markersize',4,'Color','g','linewidth',1.5)
? ?hold on
? ?semilogy(vec_Gbest_iter4,'Marker','v','markersize',4,'Color','c','linewidth',1.5)
? ?hold on
? ?semilogy(vec_Gbest_iter5,'Marker','>','markersize',4,'Color','m','linewidth',1.5)
? ?hold on
? ?semilogy(vec_Gbest_iter6,'Marker','s','markersize',4,'Color',[0.3 0.5 0.9],'linewidth',1.5)
? ?hold on
? ?semilogy(vec_Gbest_iter7,'Marker','p','markersize',4,'Color','r','linewidth',1.5)
% end
xlim([0 var_niter]);
title('Objective Space')
xlabel('Iteration')
ylabel('Best score obtianed so far')
legend('HGSO','HHO','MPA','WOA','LSA','WCA','HHO-HGSO')
set(gca,'FontName','Times New Roman','FontSize',12,'LineWidth',1.5);
set(gcf,'color','w');
box off
3 仿真結(jié)果

4 參考文獻(xiàn)
[1]尹德鑫, 張琳娜, 張達(dá)敏,等. 基于混沌透鏡成像學(xué)習(xí)的哈里斯鷹算法及其應(yīng)用[J]. 傳感技術(shù)學(xué)報(bào), 2021, 34(11):12.
博主簡介:擅長智能優(yōu)化算法、神經(jīng)網(wǎng)絡(luò)預(yù)測、信號(hào)處理、元胞自動(dòng)機(jī)、圖像處理、路徑規(guī)劃、無人機(jī)等多種領(lǐng)域的Matlab仿真,相關(guān)matlab代碼問題可私信交流。
部分理論引用網(wǎng)絡(luò)文獻(xiàn),若有侵權(quán)聯(lián)系博主刪除。