我與遺傳算法的81個城市實施TSPTW(與時間窗口旅行商),我採用以下步驟:TSPTW用遺傳算法
mutation prob=0.03
population size=100
-Generate random population according to the value of population size intialized
-Sort the generated population
-Looping for populations and determine two parents by roulette selection, apply crossover on the parents, get child and add it to children list
-I am saving the best solution over the algorithm
-Sort the Children, replace worst tour in populations with best one of children
until no good children is existing is better than worst solution in populations
-loop (1 to population size)in all populations and Apply mutation of each worst solution with solution i , if the mutated solution is better than the worst solution of children. I insert it in populations in its place according to its fitness function and remove the worst one.
我不能找到一個好的結果,我跑它到了特定的時間,但是我發現有時候它會陷入解決方案,無法獲得更好的結果。 我改變了
參數(人口規模= 20000,1000,100,突變 概率= 0.03,0.02,..)
我也有循環交叉測試它,並下令交叉
我想知道,我的步驟是正確的嗎?我如何正確指定種羣大小和變異概率?
你的突變是錯誤的。突變可能發生在任何一個孩子身上,而不僅僅是最糟糕的(如果我對你最後一步的理解是正確的)。這可能不是你問題的根源,因此不是答案。 – NWS
我已經在人羣中添加了更好的孩子,所以當突變在人羣中完成時,它也包括一些更好的孩子 – Yasmin
再次看着你的步驟,我懷疑你對如何交叉和產生新的人羣感到困惑。你讀過:http://en.wikipedia.org/wiki/Genetic_algorithm和文章http://en.wikipedia.org/wiki/Selection_%28genetic_algorithm%29&http://en.wikipedia.org/wiki/ Crossover_%28genetic_algorithm%29? – NWS