?? tabu_locationmove.m
字號(hào):
function [x1,changex,l1,tabu]=tabu_locationmove(x0,l0,tabu)
global bestx;
global bestl;
global bestSC;
global best_iter;
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 %不滿(mǎn)足條件
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(best_iter)
%'4'
bestx=x1;
bestl=l1;
best_iter=best_iter+1;
bestSC(best_iter)=SCx1;
%tabu=updatetabu(x1,tabu);
break;%解禁
else %如果不比最優(yōu)解優(yōu),轉(zhuǎn)回循環(huán)
nu1=rand; clear x1,l1;
if nu1>0.5
[x1,changex,l1]=drop(x0,l0);
else
[x1,changex,l1]=swap_location(x0,l0);
end
% 滿(mǎn)足容量需求
while condition(x1,changex,l1)==0 %不滿(mǎn)足條件
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=updatetabu(x1,tabu);
end
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -