我试图制作该代码,但它获得了行中最后一个索引的值
function heuristicCalculate(distanceBetweenCities,numOfCities)
#distanceBetweenCities is a 29*29 array
#Use this function to calculate the tour length using nearest neighbor heuristic Lnn
mindist=zeros(29,1)
for i=1:29
for j=1:29
mindist[i,1]=Base.minimum(distanceBetweenCities[i,j])
end
end
mindist
return Lnn, tau0
#Lnn tour length using nearest neighbor heuristic
#tau0 a value representing the initial phermone amount =1/(n*Lnn)
end
Run Code Online (Sandbox Code Playgroud)