📄 tspfun.m
字号:
%% ObjVal = tspfun(Phen, Dist)% Implementation of the TSP fitness function% Phen contains the phenocode of the matrix coded in adjacency% representation% Dist is the matrix with precalculated distances between each pair of cities% ObjVal is a vector with the fitness values for each candidate tour (=each row of Phen)%function ObjVal = tspfun(Phen, Dist); ObjVal=Dist(Phen(:,1),1); for t=2:size(Phen,2) ObjVal=ObjVal+Dist(Phen(:,t),t); end% End of function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -