資源簡介
將布谷鳥搜索算法編寫為函數
代碼片段和文件信息
%%?Replace?some?nests?by?constructing?new?solutions/nests
function?nestArray?=?biasRandomMove(nestArrayLbUbpa)
%?A?fraction?of?worse?nests?are?discovered?with?a?probability?pa
nNests=?size(nestArray2);
%newNestArray?=?nestArray;
%?Discovered?or?not?--?a?status?vector
for?iNest=1:nNests
????if?rand()?>?pa%被發現了,拋棄,并產生新的解
????????K?=?randperm(nNests);
????????stepSize=rand.*(nestArray(:K(1))-nestArray(:K(2)));
????????newNest=nestArray(:iNest)+stepSize;
????????newNest=bounds(newNestLbUb);
????????nestArray(:iNest)?=?newNest;
????end;
end;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????580??2017-12-21?10:57??biasRandomMove.m
?????文件?????????228??2016-03-01?14:43??bounds.m
?????文件????????3296??2018-01-04?20:24??CS.m
?????文件?????????362??2017-12-21?10:56??getBestNest.m
?????文件?????????638??2017-12-21?10:43??levyFlightsRandomMove.m
?????文件?????????363??2016-09-09?15:19??saveBetterNest.m
?????文件????????6656??2016-03-10?08:48??Thumbs.db
評論
共有 條評論