-
大小: 21KB文件類型: .zip金幣: 2下載: 0 次發(fā)布日期: 2021-05-12
- 語言: 其他
- 標(biāo)簽:
資源簡介
雙閉環(huán)PID算法,鳥群算法,和適合初學(xué)者學(xué)習(xí)使用,值得下載

代碼片段和文件信息
%?------------------------------------------------------------------------
%?Bird?Swarm?Algorithm?(BSA)?(demo)
%?Programmed?by?Xian-Bing?Meng
%?Updated?at?Jun?19?2015.????
%?Email:?x.b.meng12@gmail.com
%
%?This?is?a?simple?demo?version?only?implemented?the?basic?idea?of?BSA?for????????
%?solving?the?unconstrained?problem?namely?Sphere?function.??
%
%?The?details?about?BSA?are?illustratred?in?the?following?paper.????
%?Xian-Bing?Meng?et?al?(2015):?A?new?bio-inspXred?optimisation?algorithm:?
%?Bird?Swarm?Algorithm?Journal?of?Experimental?&?Theoretical
%?Artificial?Intelligence?DOI:?10.1080/0952813X.2015.1042530
%
%?The?parameters?in?BSA?are?presented?as?follows.
%?FitFunc????%?The?objective?function
%?M??????????%?Maxmimal?generations?(iterations)
%?pop????????%?Population?size
%?dim????????%?Dimension
%?FQ?????????%?The?frequency?of?birds‘?flight?behaviours?
%?c1?????????%?Cognitive?accelerated?coefficient
%?c2?????????%?Social?accelerated?coefficient
%?a1?a2?????%?Two?paramters?which?are?related?to?the?indirect?and?direct?
%??????????????effect?on?the?birds‘?vigilance?bahaviors.
%
%?Using?the?default?value?BSA?can?be?executed?using?the?following?code.
%?[?bestX?fMin?]?=?BSA
%?------------------------------------------------------------------------
?
%?Main?programs
function?[?bestX?fMin?]?=?BSA(?FitFunc?M?pop?dim?FQ?c1?c2?a1?a2?)
%?Display?help
help?BSA.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%?set?the?default?parameters
if?nargin?1
????FitFunc?=?@Sphere;
????M?=?1000;???
????pop?=?30;??
????dim?=?20;???
????FQ?=?10;???
????c1?=?1.5;
????c2?=?1.5;
????a1?=?1;
????a2?=?1;
end
%?set?the?parameters
lb=?-100*ones(?1dim?);???%?Lower?bounds
ub=?100*ones(?1dim?);????%?Upper?bounds
BSA_Arrary?=?zeros(1M);?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Initialization
for?i?=?1?:?pop
????x(?i?:?)?=?lb?+?(ub?-?lb)?.*?rand(?1?dim?);?
????fit(?i?)?=?FitFunc(?x(?i?:?)?);?
end
pFit?=?fit;?%?The?individual‘s?best?fitness?value
pX?=?x;?????%?The?individual‘s?best?position?corresponding?to?the?pFit
[?fMin?bestIndex?]?=?min(?fit?);??%?fMin?denotes?the?global?optimum
%?bestX?denotes?the?position?corresponding?to?fMin
bestX?=?x(?bestIndex?:?);???
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%?Start?the?iteration.
?for?iteration?=?1?:?M
?????
????prob?=?rand(?pop?1?)?.*?0.2?+?0.8;%The?probability?of?foraging?for?food
????
????if(?mod(?iteration?FQ?)?~=?0?)?????????
????????%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
????????%?Birds?forage?for?food?or?keep?vigilance
????????sumPfit?=?sum(?pFit?);
????????meanP?=?mean(?pX?);
????????for?i?=?1?:?pop
????????????if?rand?????????????????x(?i?:?)?=?x(?i?:?)?+?c1?*?rand.*(bestX?-?x(?i?:?))+?...
????????????????????c2?*?rand.*(?pX(i:)?-?x(?i?:?)?);
????????????else
????????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????8065??2018-05-03?16:54??雙閉環(huán)PID+鳥群算法\BSA.m
?????文件???????19328??2018-04-16?11:48??雙閉環(huán)PID+鳥群算法\雙環(huán)PID控制.slx
?????目錄???????????0??2018-05-08?10:01??雙閉環(huán)PID+鳥群算法\
評論
共有 條評論