clc;
close all;
clear all;
[TT,XX,YY]=textread('topology70','%s %n %n %*[^\n]','headerlines',0);
C=[XX,YY];
T=TT;
tic
m=30;Alpha=1;Beta=5;Rho=0.1;NC_max=600;Q=100;
[R_best,L_best,L_ave,Shortest_Route,Shortest_Length]=ACATSP(C,NC_max,m,Alpha,Beta,Rho,Q);
figure(1);
DrawRoute(C,T,Shortest_Route);
hold on;
toc
figure(2);
iter=1:(length(L_best));
plot(iter,L_best,'-m*',iter,L_ave,':rp','LineWidth',2)
hold on;
xlabel('迭代次数'); legend('各代最佳路线的长度','各代路线的平均长度');
grid on; toc
main.zip_aco tsp
版权申诉
25 浏览量
2022-07-15
16:56:54
上传
评论
收藏 520B ZIP 举报