資源簡介
模擬退火發與粒子群算法的結合,程序可用,收斂的很快
代碼片段和文件信息
function?[xmfv]=SimuAPSO(fitnessNc1c2lamdaMD)
%待優化的目標函數:fitness
%粒子數目:N
%學習因子1:c1
%學習因子2:c2
%退火常數:lamda
%最大迭代次數:M
%問題的維數:D
%目標函數取最小值時的自變量值:xm
%目標函數的最小值:fv
format?long;
for?i=1:N
????for?j=1:D
????????x(ij)=randn;
????????v(ij)=randn;
????end
end
for?i=1:N
????p(i)=fitness(x(i:));
????y(i:)=x(i:);
end
pg=x(N:);
for?i=1:(N-1)
????if?fitness(x(i:)) ????????pg=x(i:);
????end
end
T=fitness(pg)/log(5);
for?t=1:M
????groupFit=fitness(pg);
????for?i=1:N
????????Tfit(i)=exp(-(p(i)-groupFit)/T);
????end
????SumTfit=sum(Tfit);
????Tfit=Tfit/SumTf
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1270??2010-04-01?18:40??SimuAPSO.m
-----------?---------??----------?-----??----
?????????????????1270????????????????????1
評論
共有 條評論