Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010
The Problem • Need to visit N cities with smallest total distance travelled • Thought of in the 1830s • Mathematicians in the 1930s realized the problem was unsolvable with the current technology
The Problem • Assumptions made: ▫ Must end at same city that we started at ▫ Cannot visit any city twice ▫ Can start the trip at any city
Conventional Approach • Very long to calculate: ▫ Modeling 30 cities means 30!=2.6 x 10^32 possible solutions ▫ Equivalent to 8.4 x 10^24 years of trying at 1 solution/second
Genetic Algorithm • Similar to wind farm problem • Can’t use the same crossover or mutation methods, as that may result in duplicate cities • Must converge on good solutions, but keep enough entropy in the solutions so we can pop out of local minimums ▫ Solution: Morph our way out with lots of mutation ▫ Solution: More elites to keep track of the better solutions
Crossover Given the parents: [7, 2, 4, 1, 9, | 5, 6, 8, 10, 3] and [4, 9, 10, 3, 7, | 5, 8, 6, 1, 2] Copy, excluding duplicates Child 1 (pass 1): [7, 2, 4, 1, 9, X, X, 10, 3, X] Fill in blanks with cities from parent 2 (in unused order) Child 1 (pass 2): [7, 2, 4, 1, 9, 5, 8, 10, 3, 6]
Mutation • Swap the position of two elements • More randomness! ▫ When mutation happens, it randomly performs 1 or 2 “swap” passes ▫ Mutation 50% of the time ▫ 1% of mutations are greedy (force a better solution)
Fun stuff: Videos Circle: Long
Fun stuff: Videos Circle: Short
Fun stuff: Videos Random: Local minimum
Fun stuff: Videos Test case: Stuck
Fun stuff: Videos Test case: Best
Results The best solution had a distance of 948.33 units (shown on left).
Results Best solution != nearest city The best results always seems to form closed shapes Shapes are close as possible to the circumference of a circle (contours). No diagonal lines
Recommend
More recommend