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

📄 plotpicture2.m

📁 TSP问题,即旅行商问题,matlab环境下可以运行
💻 M
字号:
global demand;
global customer;
global depot;

v=[ 3    14     5
     3    10    12
     3     7     6
     1     8    15
     1    13     3
     1     4    11
     1     1     9
     1     2     0];

l=[ 2     2     2     2     2     2     2     1];
z=zeros(depot,1);

for i=1:length(l)
    z(v(i,1))=1;
  x1(1)=demand(v(i,1)+customer,1)
  y1(1)=demand(v(i,1)+customer,2)
  k=2;
  while k<=l(i)+1
      x1(k)=demand(v(i,k),1)
       y1(k)=demand(v(i,k),2)
      k=k+1;
  end
  x1(l(i)+2)=demand(v(i,1)+customer,1)
  y1(l(i)+2)=demand(v(i,1)+customer,2)
     line(x1,y1);
      clear x1;
      clear y1;
end

z
for j=1:depot
  % if z(j)==1
       hold on
       plot(demand(j+customer,1),demand(j+customer,2),'s');
       %else 
      % hold on
      % plot(demand(j+customer,1),demand(j+customer,2),'s');
 end
 
 
 end
    for i=1:customer
        hold on
        plot(demand(i,1),demand(i,2),'*');
    end
    

⌨️ 快捷键说明

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