⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 routing_improve.asv

📁 TSP问题,即旅行商问题,matlab环境下可以运行
💻 ASV
字号:
function [x,l,tabu]=routing_improve(x0,l0,tabu)


global customer;
global depot;
global demand;
global bestx;
global bestl;
global bestSC;
%内循环次数

inner=6;
Ts=10;
T=70;
r=0.9;
outer=1;
while T>Ts
                [x1,move,l1,tabu]=tabu_routingmove(x0,l0,tabu);
               SCx1=SC(x1,l1);
              x0=x1;
              l0=l1;
            % % 'SCx0'
              SCx0=SCx1;
              record=1;
              count=1;
     %for inner_count=1:inner
     while count<=inner
                       tabu=updatetabu(x0,tabu);
                 %  SCx0
             [x1,move,l1,tabu]=sa_routingmove(x0,l0,tabu); 
             SCx1=SC(x1,l1);
            % 'SCx1'
          % SCx1
             delet=SCx1-SCx0;
             if delet<=0
                   if record>1
                       record=1;
                   end 
                 %  'jieshou'
                    x0=x1;l0=l1;
                    SCx0=SCx1;
                    tabu=updatetabu(x1,tabu);%将这个解放到tabu中
                   % solution(outer,count)=SCx0;
                    count=count+1;
                    %把该接受的解记录到集合SET中
                     if SCx1<=bestSC
                      %   '3'
                          bestx=x1;
                          bestl=l1;
                          bestSC=SCx1;
                      end
              elseif (-delet/T)>rand
                     if record>1
                       record=1;
                     end
                     % 'jieshou'
                      x0=x1;
                      l0=l1;
                      SCx0=SCx1;
                      tabu=updatetabu(x1,tabu);%将这个解放到tabu中
                    % solution(outer,count)=SCx0;
                     count=count+1; 
                 else 
                     record=record+1;
                     if record>10
                    % solution(outer,1:inner)=SCx0;
                     break;
                     end
                      
             end
         end
                T=T*r;  
 end
   x=x0;
   l=l0;
      

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -