matlab 仿真蚁群算法出现如下问题
新建文件夹 (2).rar
(4.11 KB)
这是我的蚁群算法的程序 运行时出现如下错误
??? Attempted to access D(0,0); index must be a positive integer or logical.
Error in ==> ACATSP at 69
total_length(i)=total_length(i)+D(r(j),r(j+1));%第i只蚂蚁本次循环中从起点城市到终点城市所走过的路径长度
Error in ==> ACAmain_city at 18
[routh_best,length_best,length_average,shortest_path,shortest_length]=ACATSP(C,Nc_max,m,alpha,beta,rho,Q)
请问怎么改