资源简介
An example to apply tabu search to find optimal routes for TSP prblem
代码片段和文件信息
% function [best_sofarbestV_sofar]=ftabu(VtableFeatableNtabu_tenurepenal_iter)
%This is a tabu search function.
%The default objective is minimization
%The move is exchange here
%Another function fcost is needed to calculate each move value
%[val]=fcost(Vtable)
%Vtable is a table includes all available movement combinations.
%Featable is a cell table having the same dimensions as Vtable. For each cell
%it consistes of a table which including 0 or 1 to indicate the availability
%of movements between nodes. For example if node1(ij) and node2(uv)
%cannot be exchanged then Featable{ij)(uv)=0;
XY=[41 94;37 84;54 67;25 62;
7 64;2 99;68 58;71 44;54 62;
83 69;64 60;18 54;22 60;83 46;
91 38;25 38;24 42;58 69;71 71;
74 78;87 76;18 40;13 40;82 7;
62 32;58 35;45 21;41 26;44 35;
4 50];%node coordinates
% XY=[4272;1747;1325;3517;];
SZ=size(XY1);
% Vtable=[182324911719201021141582526292827161722233051213461;];
Vtable=[231891171920102114158252629282716172223305121346241;];
crnt_tour=Vtable;
short_path=Vtable;
figure (1);
plot([XY(short_path(SZ)1)XY(short_path(1)1)][XY(short_path(SZ)2)XY(short_path(1)2)]);
plot(XY(SZ1)XY(SZ2)‘bd‘‘MarkerFaceColor‘‘g‘‘MarkerSize‘10);
hold on;
for i=1:SZ-1
plot(XY(i1)XY(i2)‘bd‘‘MarkerFaceColor‘‘g‘‘MarkerSize‘10);
plot([XY(crnt_tour(i)1)XY(crnt_tour(i+1)1)][XY(crnt_tour(i)2)XY(crnt_tour(i+1)2)]);
end
hold off;
Featable=cell(size(Vtable));
% for i=1:size(Vtable1)
% for j=1:size(Vtable2)
% for u=1:size(Vtable1)
% for v=1:size(Vtable2)
% if i==u && j==v || j==1 || v==1 || Vtable(ij)==0 || Vtable(uv)==0
% Featable{ij}(uv)=0;
% else
% Featable{ij}(uv)=1;
% end
% end
% end
% end
% end
for i=1:size(Vtable2)
for ii=1:size(Vtable2)
if i~=1 && i~=length(Vtable) && ii~=1 && ii~=length(Vtable) && i~=ii
Featable{1i}(1ii)=1;
else
Featable{1i}(1ii)=0;
end
end
end
%Featable generation
N=1000;
penal_iter=60;
tabu_tenure=50;
track=size(N3);
%************************Function start here*******************************
fprintf(‘\n\n\n**************ftabu start here*****************‘);
start_time = cputime;
dim1=size(Vtable1);
dim2=size(Vtable2);
tabu_list=cell(dim1dim2);
costtable=cell(dim1dim2);
frequency = cell(dim1dim2);
for i=1:dim1
for j=1:dim2
tabu_list{ij}=zeros(dim1dim2);
costtable{ij}=zeros(dim1dim2);
frequency{ij}=zeros(dim1dim2);
end
end
for i=1:dim1
for j=1:dim2
for u=1:dim1
for v=1:dim2
if Featable{ij}(uv)==0
tabu_list{ij}(uv)=10000;
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论