【优化调度】基于粒子群算法求解水电厂优化调度购电最小
问题含Matlab源码
1 简介
以洪家渡水电站为例,探讨了粒子群算法在水电站中长期优化调度的应用方法及效果。实例计算结果表明,
该算法可以求解复杂约束条件的非线性水库优化调度,精度高、收敛速度快,为解决水电站中长期优化调度
问题提供了一种有效的方法。
2 部分代码
3 仿真结果
function pop=renew(pop,PBEST,GBEST)global popsizeglobal dimsize% global QCmin%
global QCmax% global KTmin% global KTmax% global PGmin;% PGmin=[0.2 0.15 0.1 0.1
0.12];% global PGmax;% PGmax=[0.8 0.5 0.35 0.3 0.4];global PGminPGmin=[0.2 0.15
0.1 0.1 0.12];global PGmax PGmax=[1.0 0.8 0.55 0.8 0.6];global c1global c2global
wcmaxglobal wcminglobal generationglobal
maxgenerationxmin=PGmin;xmax=PGmax;speedmin=(PGmin-PGmax)*0.1;speedmax=(PGmax-
PGmin)*0.2;for t=1:popsize %%%每个粒子逐个进化 for dimIndex =1:dimsize %%每个
参数进行进化 w=wcmax-(wcmax-wcmin)*(generation/maxgeneration);
sub1=PBEST(t,dimIndex)-pop(t,dimIndex); sub2=GBEST(1,dimIndex)-pop(t,dimIndex);
tempV =w*pop(t,dimsize+dimIndex)+c1*unifrnd(0,1)*sub1 + c2*unifrnd(0, 1)*sub2; %%
速度进化 if tempV>speedmax(dimIndex)
pop(t,dimsize+dimIndex)=speedmax(dimIndex); elseif tempV<speedmin(dimIndex)
pop(t,dimsize+dimIndex)=speedmin(dimIndex); else
pop(t,dimsize+dimIndex)=tempV; end tempV; tempposition = pop(t,dimIndex) +
pop(t,dimsize+dimIndex); %%位置进化 if
tempposition>xmax(dimIndex) pop(t,dimIndex) = xmax(dimIndex); elseif
tempposition<xmin(dimIndex) pop(t,dimIndex)=xmin(dimIndex); else
pop(t,dimIndex)=tempposition; end endendpop;
评论0