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

📄 tabu_locationmove.asv

📁 TSP问题,即旅行商问题,matlab环境下可以运行
💻 ASV
字号:
function [x1,changex,l1,tabu]=tabu_locationmove(x0,l0,tabu)
global bestx;
global bestl;
global bestSC;



               nu1=rand;
if nu1>0.5
[x1,changex,l1]=drop(x0,l0);
else 
    [x1,changex,l1]=swap_location(x0,l0);  
end
         
      while  condition(x1,changex,l1)==0 %不满足条件            
                   nu1=rand;  clear x1,l1;
  if nu1>0.5
[x1,changex,l1]=drop(x0,l0); 
else 
    [x1,changex,l1]=swap_location(x0,l0);  
end
      end
      while findintabu(x1,tabu)==1 %在tabu中
             SCx1=SC(x1,l1);
             if SCx1<=bestSC
                 '4'
                  bestx=x1
                  bestl=l1
                  bestSC=SCx1
                  break;%解禁
              else %如果不比最优解优,转回循环
                          nu1=rand;  clear x1,l1;
                    if nu1>0.5
                             [x1,changex,l1]=drop(x0,l0); 
                     else 
                           [x1,changex,l1]=swap_location(x0,l0); 
                      end
                % 满足容量需求
                      while  condition(x1,changex,l1)==0  %不满足条件
                                nu1=rand;  clear x1,l1;
                                if nu1>0.5
                                        [x1,changex,l1]=drop(x0,l0);
                                else 
                                          [x1,changex,l1]=swap_location(x0,l0);  
                               end
                        end
                      
               end
     end
     
     if findintabu(x1,tabu)==0
         tabu=updatet

⌨️ 快捷键说明

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