資源簡(jiǎn)介
細(xì)菌覓食算法與粒子群優(yōu)化算法相結(jié)合的程序,可實(shí)現(xiàn)適應(yīng)度函數(shù)的最值計(jì)算。
代碼片段和文件信息
%%?Tunning?of?PID?controller?using?Bacterial?Foraging?Orientec?by?Particle?swarm?optimization?
%
%
%My?work?has?been?accpepted?in?GECCO?2008?as?Graduat?Student?workshop.?I
%have?used?this?techique?in?PID?tunning?and?i?got?better?result?thatn?BG
%and?PSO
%
%?Author:?Wael?Mansour?(wael192@yahoo.com)
%
%?MSc?Student?Electrical?Enginering?Dept?
%?Faculty?of?Engineering?Cairo?University?Egypt
%%
%Initialization
clear?all???
clc
p=2;?????????????????????????%?dimension?of?search?space?
s=10;????????????????????????%?The?number?of?bacteria?
Nc=10;???????????????????????%?Number?of?chemotactic?steps?
Ns=4;????????????????????????%?Limits?the?length?of?a?swim?
Nre=4;???????????????????????%?The?number?of?reproduction?steps?
Ned=2;???????????????????????%?The?number?of?elimination-dispersal?events?
Sr=s/2;??????????????????????%?The?number?of?bacteria?reproductions?(splits)?per?generation?
Ped=0.25;????????????????????%?The?probabilty?that?each?bacteria?will?be?eliminated/dispersed?
c(:1)=0.5*ones(s1);???????%?the?run?length
for?i?=?1:s?
????Delta(:i)=(2*round(rand(p1))-1).*rand(p1);??
end?
for?m=1:s????????????????????%?the?initital?posistions?
????P(1:111)=?50*rand(s1)‘;
????P(2:111)=?0.2*rand(s1)‘;
???%P(3:111)=?.2*rand(s1)‘;
end??????????????????????????????????????????????????????????????????
c1?=1.2;????????????????????????????????????????%??PSO?parameter?C1?1.2
c2?=?0.5;???????????????????????????????????????%??PSO?parameter?C2?.5
R1?=?rand(ps);?????????????????????????????????%??PSO?parameter
R2?=?rand(ps);?????????????????????????????????%??PSO?parameter
Plocal_best_position=0*ones(psNc);????????????%??PSO???????????????????????
Pglobal_best_position=0*ones(psNc);???????????%??PSO
velocity?=?.3*randn(ps);???????????????????????%??PSO????????????????????????
current_position=0*ones(psNc);????????????????%??PSO
%%
%Main?loop?
????
%Elimination?and?dispersal?loop?
for?ell=1:Ned
????
%Reprodution?loop
????for?K=1:Nre????
%??swim/tumble(chemotaxis)loop???
????????for?j=1:Nc
????????????
????????????for?i=1:s????????
????????????????J(ijKell)=tracklsq(P(:ijKell));?????????
%?Tumble
????????????????????
????????????????Jlast=J(ijKell);
????????????????Jlocal(ij)=Jlast;? ?????????????
????????????????P(:ij+1Kell)=P(:ijKell)+c(iK)*Delta(:i);?%?This?adds?a?unit?vector?in?the?random?direction????????????
?
%?Swim?(for?bacteria?that?seem?to?be?headed?in?the?right?direction)?????
????????????????
????????????????J(ij+1Kell)=tracklsq(P(:ij+1Kell));??
????????????????m=0;?????????%?Initialize?counter?for?swim?length?
????????????????????while?m ??????????????????????????m=m+1;
??????????????????????????if?J(ij+1Kell) ?????????????????????????????Jlast=J(ij+1Kell);????
?????????????????????????????P(:ij+1Kell)=P(:ij+1Kell)+c(iK)*Delta(:i)?;??
?????????????????????????????J(ij+1
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????6320??2008-06-14?01:04??BG-PSO-matlab\BG_PSO-algorithm.m
?????文件?????????723??2008-06-11?20:38??BG-PSO-matlab\tracklsq1.m
?????目錄???????????0??2008-06-14?01:07??BG-PSO-matlab\
- 上一篇:光伏并網(wǎng)的逆變器功能
- 下一篇:奇異值分解降噪
評(píng)論
共有 條評(píng)論