travelling salesman problem stewart adam kevin visser may 14, 2010

16
Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

Upload: adele-skinner

Post on 18-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

Travelling Salesman Problem

Stewart AdamKevin Visser

May 14, 2010

Page 2: 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

Page 3: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

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

Page 4: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010
Page 5: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

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

Page 6: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

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

Page 7: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

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 duplicatesChild 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]

Page 8: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

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)

Page 9: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

Fun stuff: VideosCircle: Long

Page 10: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

Fun stuff: VideosCircle: Short

Page 11: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

Fun stuff: VideosRandom: Local minimum

Page 12: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

Fun stuff: VideosTest case: Stuck

Page 13: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

Fun stuff: VideosTest case: Best

Page 14: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

The best solution had a distance of 948.33 units (shown on left).

Results

Page 15: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010

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

Results

Page 16: Travelling Salesman Problem Stewart Adam Kevin Visser May 14, 2010