【優(yōu)化求解】基于混沌反向?qū)W習改進灰狼算法matlab源碼
灰狼優(yōu)化算法(Grey Wolf Optimization,GWO)是新型啟元優(yōu)化算法,相比于其他群體智能優(yōu)化算法,該算法同樣存在收斂速度較慢、不穩(wěn)定、易陷入局部最優(yōu)等問題。針對上述問題,根據(jù)GWO算法的結(jié)構(gòu)特點,提出了一種自適應調(diào)整策略的混沌灰狼優(yōu)化算法(Chaotic Local Search GWO),利用自適應調(diào)整策略來提高GWO算法的收斂速度,通過混沌局部搜索策略增加種群的多樣性,使搜索過程避免陷入局部最優(yōu)。最后利用6個測試函數(shù)對算法進行仿真驗證,并結(jié)合其他4種算法進行了橫向比較。實驗結(jié)果證明,所提出的改進算法在收斂速度、精度以及穩(wěn)定性方面具有明顯的優(yōu)勢。
clear all
clc
SearchAgents_no=30; % Number of search agents
Max_iteration=500; % Maximum numbef of iterations
Function_name='F12'; % Name of the test function that can be from F1 to F23 (Table 1,2,3 in the paper)
%for func_num=18:23;
?% initial_flag=0;
? %Function_name=strcat('F',num2str(func_num));
% time=cputime;
% Load details of the selected benchmark function
[lb,ub,dim,fobj]=Get_Functions_details(Function_name);
[Best_score,Best_pos,GWO_cg_curve]=GWO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
[Best_score,Best_pos,IGWO_cg_curve]=IGWO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
PSO_cg_curve=PSO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj); % run PSO to compare to results
[Best_score,Best_pos,CGWO_cg_curve]=CGWO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
[Best_score,Best_pos,FGWO_cg_curve]=FGWO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
[Best_score,Best_pos,SCA_cg_curve]=SCA(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
figure('Position',[500 500 660 290])
%Draw search space
subplot(1,2,1);
func_plot(Function_name);
title('Parameter space')
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'( x_1 , x_2 )'])
%Draw objective space
subplot(1,2,2);
semilogy(GWO_cg_curve,'Color','r')
hold on
semilogy(PSO_cg_curve,'Color','b')
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
hold on
semilogy(IGWO_cg_curve,'Color','g')
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
hold on
semilogy(CGWO_cg_curve,'Color','c')
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
hold on
semilogy(FGWO_cg_curve,'Color','m')
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
hold on
semilogy(SCA_cg_curve,'Color','k')
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
CGWO_ave=mean2(CGWO_cg_curve);
CGWO_std=std2(CGWO_cg_curve);
GWO_ave=mean2(GWO_cg_curve);
GWO_std=std2(GWO_cg_curve);
FGWO_ave=mean2(FGWO_cg_curve);
FGWO_std=std2(FGWO_cg_curve);
IGWO_ave=mean2(IGWO_cg_curve);
IGWO_std=std2(IGWO_cg_curve);
PSO_ave=mean2(PSO_cg_curve);
PSO_std=std2(PSO_cg_curve);
SCA_ave=mean2(SCA_cg_curve);
SCA_std=std2(SCA_cg_curve);
axis tight
grid on
box on
legend('GWO','PSO','IGWO','CGWO','FGWO','SCA')
display(['The best solution obtained by CGWO is : ', num2str(Best_pos)]);
display(['The best optimal value of the objective funciton found by CGWO is : ', num2str(Best_score)]);

博主擅長優(yōu)化求解、神經(jīng)網(wǎng)絡預測、信號處理、元胞自動機、圖像處理等多種領域的Matlab仿真,QQ1575304183