location_improveliu.m
来自「TSP问题,即旅行商问题,matlab环境下可以运行」· M 代码 · 共 72 行
M
72 行
function [x,l,tabu]=location_improve(x0,l0,tabu)
global customer;
global depot;
global demand;
global bestx;
global bestl;
global bestSC;
%内循环次数
inner=10;
Ts=10;
T=70;
r=0.9;
outer=1;
count=1;
while count<=inner
% SCx0
[x1,move,l1,tabu]=tabu_locationmove(x0,l0,tabu);
SCx0=SC(x0,l0);
SCx1=SC(x1,l1);
%'SCx0'
record=1;
% '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(best_iter)
% '3'
bestx=x1;
bestl=l1;
best_iter=best_iter+1;
bestSC(best_iter)=SCx1;
end
else
record=record+1;
if record>20
% solution(outer,1:inner)=SCx0;
break;
end
end
end %接受解的个数达到要求
end
x=x0;
l=l0;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?