Vehicle Routing was first studied in 1959 and soon attracted a rang of experts did researches in the operations research, management, computer applications, combinatorics, graph theory, etc. The findings have been widely used in the transport system, logistics and distribution system, express transceiver systems. This article will start from the vehicles in general, set up a mathematical model, introduced the issue of Vehicle Routing in practical application and academic research produced a number of different extension and style changes. Focus on the extension study on business travels, and finally through the Ant algorithm, using MATLAB programming to solve practical problems to achieve the optimal route. Because Ant algorithm is of a search of the probability, the computation results are generally inclined to a convergence of values. Through multiple iterations experiment, it can obtain the Optimum Solution.
n个城市,编号为1---nfor循环的次数是蚂蚁重复城市的次数,比如5个蚂蚁放到4个城市,需要重复两遍才能放完蚂蚁,每次循环产生n个1---n的随机数,相当于随机n个城市,产生城市序列
循环结束
Tabu一句表示将m个蚂蚁随机,每个蚂蚁放到前面产生的城市序列中,每个蚂蚁一个城市,需要m个,所以提取前面1:m个序列
'表示转置,没有多大用处,可能参与后面的计算方便。
我感觉如果m,n很大的话,你这样做漏启会产生很大的浪费,计算很多的随颂孙机数,这样的话更好,一句就得:(如果变量Randpos后面没有用到的话返樱如,如果用到了,还要用你的程序)
Tabu=ceil(n*rand(1,m))'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)