3 4 2 Travelling Salesman Problem 旅行推銷員問題 n City which number is n Route between 2 cities TSP是組合最佳化中的一個NP Hard問題,其問題 定義為「給定一系列城市和城市之間的距離,求解 訪問每座城市一次並回到起始城市的最短路徑」。 如果使用暴力迭代法(brute-force search),當 城市大於66個,一般的電腦就會無法解出。
3 4 2 ACO 參數設定 n City which number is n Route between 2 cities 1. Population size (N) 每一代中有多少螞蟻 2. Max Iterations 最大迭代的次數 3. Pheromone Evaporation Rate (p) 賀爾蒙消散的速率 4. Initial Artificial Pheromone (𝝉𝒊𝒏𝒊𝒕 ) 起始的費洛蒙濃度 5. Weight of Pheromone Density (𝜶) 費洛蒙濃度的影響係數 6. Weight of Route Distance\heuristic\proximity (𝜷) Heuristic的影響程度,TSP中heuristic是距離倒數 7. Weight of Total Travel Distance (Q) 各別螞蟻總路徑長,對於費洛蒙變化量的影響 a b c d
1 5 3 4 2 Probability of state transfer n City which number is n Route between 2 cities In TSP, it indicates the probability for ant K to moving from city i to city j. (在TSP中,每一代的每個螞蟻從 i 轉移到 j 的機率都是相同的,所以可以暫時忽略 k ) P𝒊𝒋 = (𝝉𝒊𝒋 )𝜶(𝜼𝒊𝒋 )𝜷 σ 𝒎∈𝒂𝒍𝒍𝒐𝒘𝒆𝒅 (𝝉𝒊𝒎 )𝜶(𝜼𝒊𝒎 )𝜷 𝝉𝒊𝒋 is the amount (density) of pheromone between city i and city j 𝜼𝒊𝒋 is the proximity between city i and city j . 𝜼𝒊𝒋 = ൗ 𝑸 𝒅𝒊𝒋 ( 常數Q / 路徑長𝒅𝒊𝒋 ) 由左圖解析,a、b、c、d分別表示各自路徑的𝝉𝜶𝜼𝜷 𝑷𝟏,𝟐 = 𝒂 𝒂 + 𝒃 + 𝒄 + 𝒅 , 𝑷𝟏,𝟑 = 𝒃 𝒂 + 𝒃 + 𝒄 + 𝒅 , 𝑷𝟏,𝟒 = 𝒄 𝒂 + 𝒃 + 𝒄 + 𝒅 , 𝑷𝟏,𝟓 = 𝒅 𝒂 + 𝒃 + 𝒄 + 𝒅 𝑷𝟏,𝟐 + 𝑷𝟏,𝟑 + 𝑷𝟏,𝟒 + 𝑷𝟏,𝟓 = 1 a b c d
5 3 4 2 ACO Algorithm 步驟 n City which number is n Route between 2 cities 1. 設定初始參數、初始費洛蒙濃度 2. 讓 N 隻螞蟻從隨機的起始點開始探訪節點,直到回到起始點 每隻螞蟻的探索步驟 - a. 根據當前節點(city)計算到其他未探訪節點(city)的狀態 轉移機率 b. 根據狀態轉移機率建立Solution Set c. 隨機取一個介於 0 ~ 1 的數值,根據此數值找尋其位在 Solution Set 的位置,並決定下一個探訪的節點(city) d. 重複a, b, c 步驟直到沒有未探索的節點 e. 回到起始的節點 3. 根據每隻螞蟻的旅程,更新每個路徑的費洛蒙濃度 4. 重複2, 3 步驟直到收斂(收斂條件自行定義) P𝟏𝟐 P𝟏𝟑 P𝟏𝟒 P𝟏𝟓