資源簡介
花朵授粉算法的改進程序,可以運行,新人,請多多關注

代碼片段和文件信息
%?--------------------------------------------------------------------%?
%?Flower?pollenation?algorithm?(FPA)?or?flower?algorithm?????????????%
%?Programmed?by?Xin-She?Yang?@?May?2012???????????????????????????????%?
%?--------------------------------------------------------------------%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%?Notes:?This?demo?program?contains?the?very?basic?components?of??????%
%?the?flower?pollination?algorithm?(FPA)?or?flower?algorithm?(FA)???%?
%?for?single?objective?optimization.????It?usually?works?well?for?????%
%?unconstrained?functions?only.?For?functions/problems?with??中???????%?
%?limits/bounds?and?constraints?constraint-handling?techniques???????%
%?should?be?implemented?to?deal?with?constrained?problems?properly.???%
%???????????????????????????????????????????????????????????
%?Citation?details:???????????????????????????????????????????????????%?
%1)Xin-She?Yang?Flower?pollination?algorithm?for?global?optimization%
%?Unconventional?Computation?and?Natural?Computation?????????????????%
%?%?Lecture?Notes?in?Computer?Science?Vol.?7445?pp.?240-249?(2012).???%
%2)X.?S.?Yang?M.?Karamanoglu?X.?S.?He?Multi-objective?flower???????%
%?algorithm?for?optimization?Procedia?in?Computer?Science???????????%
%?vol.?18?pp.?861-868?(2013).????????????????????????????????????????%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function?[bestfminN_iter]=fpa_demo(para)
%?Default?parameters
if?nargin<1
???para=[20?0.8];
end
n=para(1);???????????%?Population?size?typically?10?to?25
p=para(2);???????????%?probabibility?switch
%?Iteration?parameters
N_iter=2000;????????????%?Total?number?of?iterations
%?Dimension?of?the?search?variables
d=3;
Lb=-2*ones(1d);
Ub=2*ones(1d);
%?Initialize?the?population/solutions
for?i=1:n
??Sol(i:)=Lb+(Ub-Lb).*rand(1d);
??Fitness(i)=Fun(Sol(i:));
end
%?Find?the?current?best
[fminI]=min(Fitness);
best=Sol(I:);
S=Sol;?
%?Start?the?iterations?--?Flower?Algorithm?
for?t=1:N_iter
????????%?Loop?over?all?bats/solutions
????????for?i=1:n
??????????%?Pollens?are?carried?by?insects?and?thus?can?move?in
??????????%?large?scale?large?distance.
??????????%?This?L?should?replace?by?Levy?flights??
??????????%?Formula:?x_i^{t+1}=x_i^t+?L?(x_i^t-gbest)
??????????if?rand>p
??????????%%?L=rand;
??????????L=Levy(d);
??????????dS=L.*(Sol(i:)-best);
??????????S(i:)=Sol(i:)+dS;
??????????
??????????%?Check?if?the?simple?limits/bounds?are?OK
??????????S(i:)=simplebounds(S(i:)LbUb);
??????????
??????????%?If?not?then?local?pollenation?of?neighbor?flowers?
??????????else
??????????????epsilon=rand;
??????????????%?Find?random?flowers?in?the?neighbourhood
??????????????JK=randperm(n);
??????????????%?As?they?are?random?the?first?two?entries?also?random
??????????????%?If?the?flower?are?the?same?or?similar?species?then
??????????????%?they?can?be?pollenated
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4808??2015-09-28?22:57??huaduoshoufen\fpa_demo.m
?????文件???????6725??2016-09-29?16:40??huaduoshoufen\fpa_demo1.m
?????文件???????6877??2016-10-13?08:49??huaduoshoufen\fpa_demo存檔一.m
?????目錄??????????0??2018-05-19?14:01??huaduoshoufen
-----------?---------??----------?-----??----
????????????????18410????????????????????4
- 上一篇:霍夫變換檢測正弦曲線
- 下一篇:matlab2012b許可證文件
評論
共有 條評論