Download presentation
Presentation is loading. Please wait.
Published byKarin Roberts Modified over 9 years ago
1
The travelling Salesman problem involves visiting every town (node) on a graph and returning to the start in the shortest distance. The slides will show how to find 2 values that the actual journey lies between called the Upper and Lower Bound. The French towns below have to be visited Travelling Salesman Problem
2
The following slides show how to find an Upper Bound to the travelling Salesman Problem using the Nearest Neighbour Algorithm and a Lower Bound by removing a town and using the Minimum Connector Algorithm Travelling Salesman Problem Link to Nearest Neighbour Algorithm to find an Upper Bound Link to finding a Lower Bound using Kruskals Algorithm
3
Nearest Neighbour Algorithm This is will give an Upper Bound to the Travelling Salesman problem. It may be possible to complete the journey in a smaller distance but the Upper Bound is an upper limit to the required distance and is definitely possible. The smaller the Upper Bound the better
4
Nearest Neighbour from a Table The chart shows the distances between French towns
5
1.Choose a starting town 2.Find the nearest neighbour 3.Repeat step 2 ensuring that you have not already been there. 4.When all the towns have been visited return to the starting town using the shortest route. 5.Repeat using a different starting place and the answer giving the lowest total distance is the Upper Bound
6
Start at Lyons Reading across nearest neighbour is Dijon – 192 miles Reading down nearest neighbour is St Etienne – 59 miles Choose St Etienne LyonsSt Etienne 1 2
7
Carry on from St Etienne Reading across nearest neighbour is Dijon – 244 miles Reading down nearest neighbour is Toulouse – 528 miles Choose Dijon LyonsSt Etienne 1 2 3 Dijon
8
Carry on from Dijon Cannot choose Lyons as this has already been used Reading across nearest neighbour is Calais – 543 miles Reading down nearest neighbour is Orleans – 297 miles Choose Orleans LyonsSt Etienne Dijon 1 2 3 4 Orleans
9
Carry on from Orleans Reading across nearest neighbour is Calais – 421 miles Reading down nearest neighbour is Poitiers – 212 miles Choose Poitiers LyonsSt Etienne Dijon Orleans 1 2 3 4 5 Poitiers
10
Carry on from Poitiers Reading across nearest neighbour is Bordeaux – 247 miles Reading down nearest neighbour is Toulouse – 435 miles Cannot choose St Etienne as already visited Choose Bordeaux LyonsSt Etienne Dijon OrleansPoitiers 1 2 3 4 5 Bordeaux 6
11
Carry on from Bordeaux Reading down nearest neighbour is Toulouse – 244 miles Cannot read across Choose Toulouse LyonsSt Etienne Dijon OrleansPoitiers 1 2 3 4 5 Bordeaux Toulouse 6 7
12
Carry on from Toulouse Reading across nearest neighbour is Marseille – 405 miles Cannot read down Choose Marseille LyonsSt Etienne Dijon OrleansPoitiers 1 2 3 4 5 Bordeaux Toulouse 6 7 Marseille 8
13
Carry on from Marseille Reading across nearest neighbour is Calais – 1067 miles (Rest have all been visited) Reading down nearest neighbour have all been visited Choose Calais LyonsSt Etienne Dijon Orleans Poitiers 1 2 3 4 5 Bordeaux Toulouse 6 7 Marseille 8 8 Calais
14
Carry on from Calais All towns have been visited so return to Lyons – 751 miles LyonsSt Etienne Dijon OrleansPoitiers 1 2 3 4 5 Bordeaux Toulouse 6 7 Marseille 8 8 Calais Total distance = total of circled values = 3526 miles Upper Bound = 3526
15
Now repeat using a different starting value The lowest value obtained is the Upper Bound This means that the shortest route is equal or less than the Upper Bound
16
Lower Bound This is the smallest journey that it may be possible to do. It may not in fact be possible to actually achieve this distance but it is a value to aim for. The actual journey length lies between the upper and lower bound.
17
Lower Bound from a Table The chart shows the distances between French towns
18
1.Remove one of the towns 2.Find the minimum connector of the remaining towns using Prim or Kruskal 3.Add the town removed back in using the shortest 2 arcs. 4.Find the total length of all the arcs used.
19
Remove Marseille Now do Kruskals Algorithm Find the shortest distance : Draw it 1 2 St EtienneLyons St Etienne to Lyon 59 miles
20
Find the next shortest distance Draw it 1 2 St EtienneLyons Dijon 3 Dijon to Lyons 192 miles
21
Find the next shortest distance Draw it 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 5 Orleans to Poitiers 212 miles
22
Find the next shortest distance Ignore Dijon to St Etienne as this makes a cycle Draw it 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 6 5 7 Bordeaux to Toulouse 244 miles
23
Find the next shortest distance Draw it 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 5 7 6 Bordeaux to Poitiers 247 miles
24
Find the next shortest distance Draw it 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 6 5 7 Orleans to Dijon 297 miles
25
Find the next shortest distance Ignore Orleans to St Etienne and Poitiers to St Etienne as these make a cycle Draw it 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 6 5 7 8 Calais Calais to Orleans 421 miles
26
Now all the towns are connected with the minimum connector Finally join Marseille back in with the shortest 2 arcs 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 6 5 7 8 Calais
27
Now all the towns are connected with the minimum connector Finally join Marseille back in with the shortest 2 arcs 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 6 5 7 8 Calais Marseille
28
Adding up all the circled distances gives a lower bound This can be repeated to find another lower bound by removing a different town 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 6 5 7 8 Calais Marseille Lower Bound = 2297
29
The highest lower bound is the best as the actual answer lies between the Lower and Upper bound. If the Lower and Upper bound are the same then that is the answer 1 2 St EtienneLyons Dijon 3 PoitiersOrleans 4 ToulouseBordeaux 6 5 7 8 Calais Marseille Lower Bound = 2297
30
LyonsSt Etienne Dijon OrleansPoitiers 1 2 3 4 5 Bordeaux Toulouse 6 7 Marseille 8 8 Calais Total distance = 3526 miles Upper Bound = 3526
31
Lower Bound = 2297 The actual answer lies between the Lower and Upper bound and can only be found by trial and error. The Upper and Lower Bound give an idea as to what the actual answer lies between The smaller the gap the better. Remember need High Lower Bound and Low Upper Bound.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.