91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .m
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-29
  • 語言: Matlab
  • 標簽: 細菌??覓食??算法??

資源簡介

細菌覓食算法(matlab)

資源截圖

代碼片段和文件信息

%%?Bacterial?foraging
%?Animiation?of?bacteria?movement?to?get?the?global?minimum?solution?every?chemotactic
%
%?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=26;????????????????????????%?The?number?of?bacteria
Nc=50;???????????????????????%?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.05*ones(s1);???????%?the?run?length?
for?m=1:s????????????????????%?the?initital?posistions
????P(1:111)=?50*rand(s1)‘;
????P(2:111)=?.2*rand(s1)‘;
???%P(3:111)=?.2*rand(s1)‘;
end?????????????????????????????????????????????????????????????????
????
%%
%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)=Live_fn(P(:ijKell));????????

%?Tumble

???????????????????????
????????????????Jlast=J(ijKell);??
????????????????Delta(:i)=(2*round(rand(p1))-1).*rand(p1);?????????????????????
????????????????P(:ij+1Kell)=P(:ijKell)+c(iK)*Delta(:i)/sqrt(Delta(:i)‘*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)=Live_fn(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)/sqrt(Delta(:i)‘*Delta(:i))?;?
?????????????????????????????J(ij+1Kell)=Live_fn(P(:ij+1Kell));?
??????????????????????????else?????

評論

共有 條評論