本文主要是介绍基于改进灰狼算法-考虑需求响应的风-光-柴-储容量优化配置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
部分代码:
clear all
clc
SearchAgents_no=30; %种群数量
Function_name='F1'; % CEC2005 测试函数F1-F21
Max_iteration=1000; % 最大迭代次数
% 获取对应测试函数的边界信息,维度等。
[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_score1,Best_pos1,GWO_cg_curve1]=CGWO(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','b','linewidth',1.5)
hold on
semilogy(GWO_cg_curve1,'Color','r','linewidth',1.5);
title('Objective space')
xlabel('Iteration');
ylabel('Best score obtained so far');
axis tight
grid on
box on
legend('GWO','CGWO');
display(['The best solution obtained by GWO is : ', num2str(Best_pos)]);
display(['The best optimal value of the objective funciton found by GWO is : ', num2str(Best_score)]);
display(['The best solution obtained by CGWO is : ', num2str(Best_pos1)]);
display(['The best optimal value of the objective funciton found by CGWO is : ', num2str(Best_score1)]);
这篇关于基于改进灰狼算法-考虑需求响应的风-光-柴-储容量优化配置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!