www.gusucode.com > Delphi货郎担算法演示 > Delphi货郎担算法演示\程序说明.txt
Delphi货郎担算法演示,最开始在毕业设计中⑾值模?罄从志??艘恍┬拚??衷诳芍苯颖嘁耄?皇褂玫谌?娇丶?嗫猓?赝即蠹铱梢韵瓤聪拢?糠执?胧鸵澹? Cities: array of TCity; //城市数组 [1..x] CitiesDistance: array of array of real; //各个城市间的距离[1..x, 1..x] CitiesToured: array of integer; //是否已经遍历过 CityNumber: integer; //城市的数目 ShortTestLength: real; //“最短”路径的长度 ShortestDistance: array of real; //最短路径 TouredLength: real; //已经走过的距离 //获取两个城市之间的距离 function GetDistance(a_ACity, a_BCity: TCity): real; //生成距离矩阵 procedure GetAllDistance; //遍历城市 procedure CreateCities; //生成城市 procedure FindShortTestPath; //寻找最短路径,获得各个城市之间的距离 //并将其添加到数组CitiesDistance[] procedure Draw; //对画布进行重画,获得两个城市之间的距离