tspdemo.m
来自「其中提到遺傳學的程式碼與應用提供給次淚相向的研究者參考下載」· M 代码 · 共 29 行
M
29 行
% allsims.m
% Matlab program to get the simulation results for the different TSP's
% with varying number of cities between 20 and 100 with jumps of 5
clear all
clear global
format compact
Nall = input('Number of cities: '); %[50];
no_gens = 10000;
Area = 100*100;
threshold = 1.1*0.749*sqrt(Area)*sqrt(Nall);
PopSize = input('Number of Parents: ');
for i = 1:length(Nall)
close all
clear global
clear functions
N = Nall(i)
new_threshold = threshold(i)
rand('seed',0);
randn('seed',0);
[xopt, optJ, P, S, xoptAll] = eptsp(PopSize,N,10,no_gens(i),threshold(i),10);
%[xopt, optJ, P, S] = epsatsp(PopSize,N,10,no_gens(i),threshold(i),1);
eval(sprintf('save epsa%g',N));
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?