遗传算法挑出复合TSP问题的遍历子代。 for i=1:INIT for j=(i+1):INIT if crossoverrate(i,j)<XRATE X1=gen(i,:); X2=gen(j,:); cross=ceil(7*rand(1)); X1=[X1(1:cross),X2(cross+1:8)]; X2=[X2(1:cross),X1(cross+1:8)]; gen(i,:)=X1; gen(j,:)=X2; end end ...展开收缩
标准的深度优先搜索算法,可实现节点遍历、产生随机路由、检测图中是否有回路等功能,-Standard depth-first search algorithm, the node traversal can be achieved, resulting in a random routing, testing whether there is any loop diagram functions