資源簡介
離散粒子群算法的Matlab實現(xiàn),歡迎大家下載學(xué)習(xí),一起進(jìn)行改善。

代碼片段和文件信息
function?current_Path=add_M(current_Pathadd_Edge)
%%?添加邊并調(diào)整函數(shù)
%%%%?current_Path為合法路徑,Path(city_nums1);
%%%%?add_Edge為待添加邊,edge(21);
%%%%?添加一條邊后,從左到右搜索Path獲取在Path中edge端點的位置jk且j %%%%?將Path中j到(k-1)或者j+1到k路徑點逆序
len=length(current_Path);
keyPosition=zeros(21);
j=1;
for?i=1:len
????if(current_Path(i1)==add_Edge(11)||current_Path(i1)==add_Edge(21))
????????keyPosition(j1)=i;
????????j=j+1;
????end
end
exchange_Len=keyPosition(21)-keyPosition(11);
if(exchange_Len~=1?&&?exchange_Len~=len-1)
????tempM=zeros(exchange_Len1);
????if(rand<0.5)
????????k=1;
????else
????????k=0;
????end
????for?i=1:exchange_Len
????????tempM(exchange_Len+1-i1)=current_Path(keyPosition(11)+k+i-11);
????end
????current_Path(keyPosition(11)+k:keyPosition(21)-1+k1)=tempM;
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-04-13?20:28??離散粒子群算法DPSO\
?????文件?????????261??2013-04-13?20:28??離散粒子群算法DPSO\PM2VM.m
?????文件?????????854??2013-04-13?20:28??離散粒子群算法DPSO\add_M.m
?????文件??????????66??2013-04-13?20:28??離散粒子群算法DPSO\and_M.m
?????文件?????????220??2013-04-13?20:28??離散粒子群算法DPSO\calFitness.m
?????文件?????????233??2013-04-13?20:28??離散粒子群算法DPSO\li
?????文件????????3316??2013-04-13?20:28??離散粒子群算法DPSO\main.m
?????文件?????????325??2013-04-13?20:28??離散粒子群算法DPSO\pathPlot.m
?????文件?????????129??2013-04-13?20:28??離散粒子群算法DPSO\sub_M.m
?????文件?????????357??2013-04-13?20:28??離散粒子群算法DPSO\wGenerate.m
- 上一篇:Hata傳播模型Matlab代碼
- 下一篇:直接法設(shè)計IIR低通濾波器
評論
共有 條評論