route_new.m

来自「该程序是基于Matlab编写的模拟退火工具软件包」· M 代码 · 共 20 行

M
20
字号
function W = route_new(X)
% W = route_new(X)
% Method for tsp example supplied with SA Tools.
% See http://www.frostconcepts.com/software for information on SA Tools.
%
%   W = route_new(X) ;
%
%   X = {N, D}
%       N = # of cities.
%       D = distance matrix. D(i,j) = distance from city i to j.
%   W = new route, a permutation of the indicies 1:N
%
N = X{1} ;
for i=1:N
    A(i,1) = rand ;
    A(i,2) = i ;
end
B = sortrows(A) ;
W = B(:,2) ;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?