资源描述:
《大连海事大学作业汇编-物流配送作业22》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、一、问题描述旅行商问题,即TSP问题(TravellingSalesmanProblem)是数学领域中著名问题之一。假设有一个旅行-商人要拜访n个城市,他必须选择所要走的路径,路经的限制是每个城市只能拜访一次,而且最后要回到原來出发的城市。路径的选择目标是要求得的路径路程为所有路径之中的最小值。%NAME:dantzig42%TYPE:TSP%COMMENT:42cities(Dantzig)%DIMENSION:42%EDGE_WEIGHT_TYPE:EXPLICIT%EDGE_WEIGHT_FORMAT:LOWER_D
2、IAG_ROW%DISPLAY_DATA_TYPE:TWOD_DISPLAY%opt=699[1,42]1170.085.02166.088.03133.073.04140.070.05142.055.06126.053.07125.060.08119.068.09117.074.01099.083.01173.079.01272.091.01337.094.0146.0106.0153.097.01621.082.01733.067.0184.066.0193.042.02027.033.02152.041.02257.
3、059.02358.066.02488.065.02599.067.02695.055.02789.055.02883.038.02985.025.030104.035.031112.037.032112.024.033113.013.034125.030.035135.032.036147.018.037147.536.038154.545.039157.054.040158.061.041172.082.042174.087.0maxBacktrack=20,maxTime=20,sizeRelax=20,shiftR
4、elax=4,nbLoop=#{SOURCENODE}divshiftRelax,prog=['WorkDirectory'HModelTSP.nJ,config=['WorkDirectory*,,ncl.cfg,,]/sol=「WorkDirectory1“test.sol”],iterationBuf=["iterationbuffer11:@=>(forallloopin[0,nbLoop](("Loop:Hloop"tspjloop}=[prog,config,1],?tspjloop}("optimal
5、solutionproved11:loop=0->T;"nosolutionexists",''stoppedwithoutsolution":loop>0),),).foralliinSOURCENODE(nextNode_{i}inNODESINK,TimeNode_{i}=[tlNode_{i}zt2Node_{i}],TimeNode_{i}subset[1,distanee],#{TimeNode_{i}}=dNodeNode_{i,nextNode_{i}},TimeNode_{i}precTimeN
6、odeJnextNodeJi}},DistNextNode_{i}={foralljinDelta{nextNode_{i}}dNodeNode_{i,j}},diffDistNextNode_{i}=DistNextNode_{i}[2]-DistNextNode_{i}[l],),foralli<>jinSOURCENODEnextNode_{i}eqnextNode_{j},foralliinIDXnodeldx_{i}inSOURCENODE,foralliinIDXsetminus1
7、nodeldx_{i}=nextNode_{nodeldx_{i-l}},forallivjinIDXnodeldx_{i}<>nodeldx_{j},tlNode_{source}=1,foralliinNODE->(min#{Delta{nextNode_{i}}},maxdiffDistNextNode_{i})forallkinDelta{nextNode_{i}}->(mindNodeNode_{i,k},)nextNode_{i}二k?,distance=sum_{iinSOURCEN
8、ODE}{#{TimeNode_{i}}},mindistance,['WorkDirectory'"ModelXRelaxTSP.n"],@=>(['WorkDirectory'"ModelXWriteTSP.n"],['WorkDirectory*”ModelViewTSP.n”],),'Bac