TSP – Upper Bounds and Lower Bounds Initial problem : Upper Bound A salesman based in Stockton...

Post on 17-Jan-2016

221 views 0 download

transcript

TSP – Upper Bounds and Lower Bounds

Initial problem : Upper Bound

A salesman based in Stockton needs to visit shops based in Darlington, Billingham, Middlesbrough, Hartlepool and Yarm and return to Stockton.What is the minimum distance he needs to travel?

TSP – Upper Bounds and Lower Bounds

The model

The distances between the towns is given below:

  S M D H Y B

S - 5 13 12 6 4

M 5 - 16 10 9 6

D 13 16 - 25 13 -

H 12 10 25 - - 8

Y 6 9 13 - - -

B 4 6 - 8 - -

D M

S

B

Y

H

25 4

613

6

16

139

5

8 1012

TSP – Upper Bounds and Lower Bounds

Nearest neighbour algorithm

1. Choose any vertex as the starting point.

2. From the vertices not already selected find the nearest vertex to the last one.

3. Repeat step 2 until all vertices have been selected.

4. Join the last vertex to the first vertex.

5. Repeat for different starting vertices.

6. Choose the smallest upper bound.

TSP – Upper Bounds and Lower Bounds

1. Choose a starting vertex

D M

S

B

Y

H

25 4

613

6

16

139

5

8 1012S is chosen as a starting vertex.

S

TSP – Upper Bounds and Lower Bounds

2. Find the nearest vertex

D M

S

B

Y

H

25 4

613

6

16

139

5

8 1012B is the nearest vertex to S (the last one).S

B4

TSP – Upper Bounds and Lower Bounds

3. Repeat 2 ‘til all vertices selected

D M

S

B

Y

H

25 4

613

6

16

139

5

8 1012

M is the nearest vertex to B.

S

B4

M

6

Y is the nearest vertex to M (not already selected).

Y

9D is the nearest vertex to Y (not already selected).

D

13

H is the nearest vertex to D (not already selected).

H

25

TSP – Upper Bounds and Lower Bounds

4. Join the last vertex to the first

D M

S

B

Y

H

25 4

613

6

16

139

5

8 1012

H is joined to S.

S

B4

M

6

Y

9D

13

H

2512 The resulting tour has

length:4+6+9+13+25+12 = 69

TSP – Upper Bounds and Lower Bounds

5. Repeat for a different start vertex

Upper bound found starting at S:

Upper bound found starting at D:

Upper bound found starting at B:

Upper bound found starting at H:

Upper bound found starting at M:

Upper bound found starting at Y:

69

64*

64

64

64

64

*Choosing DY as first edge

TSP – Upper Bounds and Lower Bounds

6. Choose the least upper bound

The shortest tour (least upper bound) has length 64.

D M

S

B

Y

H

25 4

613

16

139

5

812

S

B4

M

6

Y

6D

13

H

2510

D-Y-S-B-M-H-D has been chosen, but we could have had B-S-M-Y-D-H-B

TSP – Upper Bounds and Lower Bounds

Initial problem: Lower Bound

A salesman based in Stockton needs to visit shops based in Darlington, Billingham, Middlesbrough, Hartlepool and Yarm and return to Stockton.What is the minimum distance he needs to travel?

TSP – Upper Bounds and Lower Bounds

The model

The distances between the towns is given below:

  S M D H Y B

S - 5 13 12 6 4

M 5 - 16 10 9 6

D 13 16 - 25 13 -

H 12 10 25 - - 8

Y 6 9 13 - - -

B 4 6 - 8 - -

D M

S

B

Y

H

25 4

613

6

16

139

5

8 1012

TSP – Upper Bounds and Lower Bounds

An algorithm – Nearest Neighbour

1. Choose a vertex and delete it and all its edges from the network.

2. Find a minimum connector for the remaining network using Kruskal’s or Prim’s.

3. Add in the weights of the two least weight deleted edges.

4. Repeat deleting a different vertex.

5. Choose the greatest lower bound.

TSP – Upper Bounds and Lower Bounds

1. Choose a vertex and delete it

S

B

Y

H

25 4

613

6

16

139

5

8 1012

D M

D is chosen (arbitrarily) and deleted along with all of the edges from D.

TSP – Upper Bounds and Lower Bounds

2. Find a minimum connector

S

B

Y

H

25 4

613

6

16

139

5

8 1012

D M

A minimum connector is found (in this case using Kruskal’s algorithm)

4

5

6

8

TSP – Upper Bounds and Lower Bounds

3. Add in 2 least deleted edges

S

B

Y

H

25 4

613

6

16

139

5

8 1012

D M

The two deleted edges of least weight are added back in.

4

5

6

8

13

13

The Lower Bound found by deleting D has weight :4+5+6+8+13+13 = 49

TSP – Upper Bounds and Lower Bounds

4. Repeat using a different vertex

Lower bound found by removing D:

Lower bound found by removing S:

Lower bound found by removing B:

Lower bound found by removing H:

Lower bound found by removing M:

Lower bound found by removing Y:

49

45

44

46

42

45

TSP – Upper Bounds and Lower Bounds

5. Choose greatest lower bound

The greatest lower bound found is 49

S

B

Y

H

25 4

613

6

16

139

5

8 1012

D M

4

5

6

8

13

13

TSP – Upper Bounds and Lower BoundsInterpreting the Upper and Lower Bound Values

The greatest lower bound found is 49

The shortest tour (least upper bound) has length 64.

So the actual route lies between 49 and 64. It is definitely possible to do it in 64 but a shorter route may be possible. This can only be found by trial and error

If the UB and the LB are the same then that is the answer.

49 64The smaller the gap the better