700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 【TSP问题】基于改进遗传算法求解旅行商问题matlab源码

【TSP问题】基于改进遗传算法求解旅行商问题matlab源码

时间:2019-03-04 05:21:44

相关推荐

【TSP问题】基于改进遗传算法求解旅行商问题matlab源码

1 算法介绍

模型介绍见这里。

2 部分代码

nn=40; % number of citiesasz=10; % area size asx x asz​​ps=3000; % population sizeng=5000; % number of generation​pm=0.01; % probability of mutation of exchange 2 random cities in the path (per gene, per genration)pm2=0.02; % probability of mutation of exchange 2 peices of path (per gene, per genration)pmf=0.08; % probability of mutation of flip random pece of path​r=asz*rand(2,nn); % randomly distribute cities% r(1,:) -x coordinaties of cities% r(2,:) -y coordinaties of cities​% % uncomment to make circle:% % circle% al1=linspace(0,2*pi,nn+1);% al=al1(1:end-1);% r(1

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。