1 简介

一种基于原子搜索算法优化BP神经网络的风电功率预测方法,从风电功率预测系统的数据处理模块中获取预测参考数据;对参考数据建立BP神经网络的预测模型,并采用多种群编码对应BP神经网络的不同结构,每个种群分别对神经网络权值阈值编码,生成不同长度的个体,用遗传算法中选择,交叉,变异操作进化优化每个种群,最后判断收敛条件并选择最优个体;再对BP神经网络初始化,用学习率可变的动量BP算法进一步训练网络直至收敛,利用该网络对风电功率进行预测;最后,还反复利用预测值,在一轮预测中进行多次预测实现了跨时间间隔的多步预测.本发明预测精度提高,计算时间减少,稳定性增强.

具体模型参考底下文献。

2 部分代码

%--------------------------------------------------------------------------

% GSA code v1.0.



%--------------------------------------------------------------------------

% Atom Search Optimization.

function [X_Best,Fit_XBest,Functon_Best]=ASO(alpha,beta,Fun_Index,Atom_Num,Max_Iteration)


% Dim: Dimension of search space.

% Atom_Pop: Population (position) of atoms.

% Atom_V: Velocity of atoms.

% Acc: Acceleration of atoms.

% M: Mass of atoms.

% Atom_Num: Number of atom population.

% Fitness: Fitness of atoms.

% Max_Iteration: Maximum of iterations.

% X_Best: Best solution (position) found so far.

% Fit_XBest: Best result corresponding to X_Best.

% Functon_Best: The fitness over iterations.

% Low: The low bound of search space.

% Up: The up bound of search space.

% alpha: Depth weight.

% beta: Multiplier weight


alpha=50;

beta=0.2;



Iteration=1;

[Low,Up,Dim]=Test_Functions_Range(Fun_Index);


% Randomly initialize positions and velocities of atoms.

if size(Up,2)==1

Atom_Pop=rand(Atom_Num,Dim).*(Up-Low)+Low;

Atom_V=rand(Atom_Num,Dim).*(Up-Low)+Low;

end


if size(Up,2)>1

for i=1:Dim

Atom_Pop(:,i)=rand(Atom_Num,1).*(Up(i)-Low(i))+Low(i);

Atom_V(:,i)=rand(Atom_Num,1).*(Up(i)-Low(i))+Low(i);

end

end


% Compute function fitness of atoms.

for i=1:Atom_Num

Fitness(i)=Test_Functions(Atom_Pop(i,:),Fun_Index,Dim);

end

Functon_Best=zeros(Max_Iteration,1);

[Max_Fitness,Index]=min(Fitness);

Functon_Best(1)=Fitness(Index);

X_Best=Atom_Pop(Index,:);


% Calculate acceleration.

Atom_Acc=Acceleration(Atom_Pop,Fitness,Iteration,Max_Iteration,Dim,Atom_Num,X_Best,alpha,beta);



% Iteration

for Iteration=2:Max_Iteration

Functon_Best(Iteration)=Functon_Best(Iteration-1);

Atom_V=rand(Atom_Num,Dim).*Atom_V+Atom_Acc;

Atom_Pop=Atom_Pop+Atom_V;



for i=1:Atom_Num

% Relocate atom out of range.

TU= Atom_Pop(i,:)>Up;

TL= Atom_Pop(i,:)<Low;

Atom_Pop(i,:)=(Atom_Pop(i,:).*(~(TU+TL)))+((rand(1,Dim).*(Up-Low)+Low).*(TU+TL));

%evaluate atom.

Fitness(i)=Test_Functions(Atom_Pop(i,:),Fun_Index,Dim);

end

[Max_Fitness,Index]=min(Fitness);


if Max_Fitness<Functon_Best(Iteration)

Functon_Best(Iteration)=Max_Fitness;

X_Best=Atom_Pop(Index,:);

else

r=fix(rand*Atom_Num)+1;

Atom_Pop(r,:)=X_Best;

end


% Calculate acceleration.

Atom_Acc=Acceleration(Atom_Pop,Fitness,Iteration,Max_Iteration,Dim,Atom_Num,X_Best,alpha,beta);

end


Fit_XBest=Functon_Best(Iteration);

3 仿真结果

【预测模型】基于原子搜索算法优化BP神经网络实现数据预测matlab代码_遗传算法

【预测模型】基于原子搜索算法优化BP神经网络实现数据预测matlab代码_遗传算法_02

【预测模型】基于原子搜索算法优化BP神经网络实现数据预测matlab代码_遗传算法_03

4 参考文献

[1]苑严伟, 张小超, & 毛文华. (2009). 基于bp模型的蝗虫密度预测系统的研究. 农机化研究(5), 5.

[2]陈天恩, 陈皓勇, 张浩, 陈盼, 侯荆州, & 叶荣. 一种基于遗传算法优化bp神经网络的风电功率预测方法. CN, CN101706335 A.

【预测模型】基于原子搜索算法优化BP神经网络实现数据预测matlab代码_神经网络_04