✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
个人主页:Matlab科研工作室
个人信条:格物致知。
更多Matlab仿真内容点击
智能优化算法 神经网络预测 雷达通信 无线传感器 电力系统
信号处理 图像处理 路径规划 元胞自动机 无人机
针对海上风电功率预测精度差的问题,提出一种NGO-LSTM模型.选择在时间序列问题处理上具有良好性能的长短期记忆(LSTM)神经网络,通过寻优能力强、收敛速度快的北方苍鹰算法对LSTM网络隐含层神经元个数、学习率和训练次数等超参数进行优化,得到NGO-LSTM模型.采用江苏省盐城市某400 MW风电场功率数据进行算例分析,在不同条件变量下分别使用NGO-LSTM模型、LSTM模型预测,仿真结果表明,NGO-LSTM模型具有更高的预测精度、更好的预测稳定性.
%%
% NGO.
% Northern Goshawk Optimization: A New Swarm-Based Algorithm for Solving Optimization Problems
% Mohammad Dehghani1, Pavel Trojovský1, and Stepan Hubálovský2
% 1Department of Mathematics, Faculty of Science, University of Hradec Králové, 50003 Hradec Králové, Czech Republic
% 2Department of Applied Cybernetics, Faculty of Science, University of Hradec Králové, 50003 Hradec Králové, Czech Republic
% " Optimizer"
%%
function [Score,Best_pos,NGO_curve]=NGO(Search_Agents,Max_iterations,Lowerbound,Upperbound,dimensions,objective)
tic
disp('PLEASE WAIT, The program is running.')
Lowerbound=ones(1,dimensions).*(Lowerbound); % Lower limit for variables
Upperbound=ones(1,dimensions).*(Upperbound); % Upper limit for variables
X=[];
X_new=[];
fit=[];
fit_new=[];
NGO_curve=zeros(1,Max_iterations);
%%
for i=1:dimensions
X(:,i) = Lowerbound(i)+rand(Search_Agents,1).*(Upperbound(i) -Lowerbound(i)); % Initial population
end
for i =1:Search_Agents
L=X(i,:);
fit(i)=objective(L); % Fitness evaluation (Explained at the top of the page. )
end
for t=1:Max_iterations % algorithm iteration
%% update: BEST proposed solution
[best , blocation]=min(fit);
if t==1
xbest=X(blocation,:); % Optimal location
fbest=best; % The optimization objective function
elseif best fbest=best; xbest=X(blocation,:); end %% UPDATE Northern goshawks based on PHASE1 and PHASE2 for i=1:Search_Agents %% Phase 1: Exploration I=round(1+rand); k=randperm(Search_Agents,1); P=X(k,:); % Eq. (3) F_P=fit(k); if fit(i)> F_P X_new(i,:)=X(i,:)+rand(1,dimensions) .* (P-I.*X(i,:)); % Eq. (4) else X_new(i,:)=X(i,:)+rand(1,dimensions) .* (X(i,:)-P); % Eq. (4) end X_new(i,:) = max(X_new(i,:),Lowerbound);X_new(i,:) = min(X_new(i,:),Upperbound); % update position based on Eq (5) L=X_new(i,:); fit_new(i)=objective(L); if(fit_new(i) X(i,:) = X_new(i,:); fit(i) = fit_new(i); end %% END PHASE 1 %% PHASE 2 Exploitation R=0.02*(1-t/Max_iterations);% Eq.(6) X_new(i,:)= X(i,:)+ (-R+2*R*rand(1,dimensions)).*X(i,:);% Eq.(7) X_new(i,:) = max(X_new(i,:),Lowerbound);X_new(i,:) = min(X_new(i,:),Upperbound); % update position based on Eq (8) L=X_new(i,:); fit_new(i)=objective(L); if(fit_new(i) X(i,:) = X_new(i,:); fit(i) = fit_new(i); end %% END PHASE 2 end% end for i=1:N %% %% SAVE BEST SCORE best_so_far(t)=fbest; % save best solution so far average(t) = mean (fit); Score=fbest; Best_pos=xbest; NGO_curve(t)=Score; end %% d [1]李森文, 张伟, 李纯宇,等. 基于SSA-LSTM的海上风电功率预测[J]. 机械与电子, 2022(040-006). [1]杨耘, 王彬泽, 刘艳,等. 基于时空优化LSTM深度学习网络的气温预测[J]. 徐州工程学院学报:自然科学版, 2020, 35(2):6. ❤️部分理论引用网络文献,若有侵权联系博主删除 ❤️ 关注我领取海量matlab电子书和数学建模资料 ⛄ 运行结果
⛄ 参考文献
⛳️ 完整代码