https://blog.csdn.net/John159151/article/details/49053963 ———————————————— 在MATLAB中帶有TSP問題的示例,命令行中鍵入“travel”即可,關(guān)于本示例的介紹如下:
這個(gè)示例采用美國(guó)地圖為模版,提供了不同數(shù)量的城市供我們進(jìn)行選擇,如圖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優(yōu)化算法案例分析與應(yīng)用》中給出的程序來(lái)作為示范,在100*100的地圖中隨機(jī)產(chǎn)生30個(gè)城市的坐標(biāo)位置如圖2所示,然后由GA求解這30個(gè)城市之間的最短距離,得到的結(jié)果如下圖3和圖4所示。
圖2
圖3
圖4
參考書籍:MATLAB優(yōu)化算法案例分析與應(yīng)用,余勝威著
程序請(qǐng)回復(fù)“GATSP”或“GT”獲取