与数学建模》.云南:云南大学出版社,2009[3]陆维新,林皓,陈晓东,《订购与运输钢管的最优方案》.成都:四川大学,610064附录附录1Floyd算法函数在matlab下的M函数文件如下:function[D,path]=floyd(a)n=size(a,1);D=a;path=zeros(n,n);fori=1:nforj=1:nifD(i,j)~=infpath(i,j)=j;endendendfork=1:nfori=1:nforj=1:nifD(i,k)+D(k,j)<D(i,j)D(i,j)=D(i,k)+D(k,j);path(i,j)=path(i,k);endendendend附录2问题(1)附图1中求最小费用MATLAB程序:ab=[112345678910111213151617181920202223];bb=[1415151619182324101011151314161719192021222324];w=[202021200690690462703045080115011003061957205201708816070320160290];ab1=[1245678910111415161718333435];bb1=[192021222324252627282930313119243132];w1=[326001051012427010106230201043111020];a=sparse(ab,bb,w);a(24,24)=0;a=a+a';a=full(a);fori=1:24forj=1:24if(a(i,j)==0&i~=j)a(i,j)=inf;endendend[D,path]=floyd(a);a1=sparse(ab1,bb1,w1);a1(35,35)=0;a1=a1+(a1)';a1=full(a1);fori=1:35