https://blog.csdn.net/John159151/article/details/49053963 ———————————————— 在MATLAB中带有TSP问题的示例,命令行中键入“travel”即可,关于本示例的介绍如下:
这个示例采用美国地图为模版,提供了不同数量的城市供我们进行选择,如图1所示。travel —— travel Traveling salesman problem demonstration.This demo animates the solution of the so-called "Traveling Salesman" problem.The problem is to form a closed circuit of a number of cities while traveling the shortest total distance along the way.Use the "Cities" popup menu to determine the number of cities to be visited. The "Start" and "Stop" buttons control the animation.Cities are chosen completely at random.
下面利用《MATLAB优化算法案例分析与应用》中给出的程序来作为示范,在100*100的地图中随机产生30个城市的坐标位置如图2所示,然后由GA求解这30个城市之间的最短距离,得到的结果如下图3和图4所示。
图2
图3
图4
参考书籍:MATLAB优化算法案例分析与应用,余胜威著
程序请回复“GATSP”或“GT”获取