TSP Heuristics - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

TSP Heuristics

Description:

AB CD EH won't work (no link EH) AB CH DE = 28. AE BH CD = 28 ... Can't guarantee to find best solution. Can't guarantee any speed up. 16. Exercises ... – PowerPoint PPT presentation

Number of Views:84
Avg rating:3.0/5.0
Slides: 20
Provided by: mt76
Category:
Tags: tsp | heuristics

less

Transcript and Presenter's Notes

Title: TSP Heuristics


1
TSP Heuristics
January 2002
2
Heuristics for the Travelling Salesman Problem
  • Faced with the likely impossibility of an
    efficient algorithm for finding the optimum
    solution of problems like TSP, we resort to
    heuristics instead. A heuristic is a rule of
    thumb which should give a reasonable approximate
    solution, in polynomial time.
  • E.g. a heuristic we might use to find a well-off
    person in the street is to look for smart clothes
    and neat hair.
  • For example, consider the following TSP

3
Example
4
1. Nearest neighbour heuristic
  • Heuristic 1.
  • always move to the nearest unvisited city
  • E.g.
  • starting from A
  • A F G B H D J E A - but misses C!
  • Starting from G
  • G F J H D E A B C G ? A B C G F J H D E A
  • length 67

5
2. Christofides algorithm
  • Heuristic 2.
  • Christofides algorithm
  • three steps
  • ? Find a minimum length spanning tree
  • start with the shortest link (road), consider
    links of progressively greater length, add a link
    to the tree if it connects either a new node to
    the tree, or two subtrees

6
Christofides algorithm contd
  • Thus
  • i. length 3 DH
  • ii. length 4 HJ, FG, GB
  • iii. length 5 EF, FJ, but not DJ
  • iv. length 6 AF, but not GJ, GH
  • v. length 7 not AG, EJ
  • vi. length 8 CH, but not BH
  • Tree complete since all nodes linked, and there
    are no circuits

7
Christofides algorithm contd
  • ? There must be an even number of odd order
    nodes (i.e. with an odd number of links) A B
    C D E H in this case
  • Find the minimum length matching of disjoint
    pairs of these.
  • Thus
  • AB CD EH wont work (no link EH)
  • AB CH DE 28
  • AE BH CD 28
  • AE BC DH 23 minimum length

8
Christofides algorithm contd
  • Add these new links (AE BC DH in this case) to
    the tree (dashed lines). Every node now has even
    order.

9
Christofides algorithm contd
  • ? An Euler tour traverses each link once (since
    each node now has even order)
  • e.g.
  • A F G B C H D H J F E A - total length 62
  • Can use shortcuts to skip over cities already
    visited.
  • A F G B C H D J E A - total length 57
  • Shortcuts DJ and JE

10
Christofides algorithm contd
  • Shortcuts DJ JE
  • A F G B C H D J E A - total length 57
  • Shortcuts CD AG
  • A E F J H D C B G A - total length 58

11
Christofides algorithm contd
  • The Christofides algorithm generates a good tour
    (but not necessarily the best!) in O(n3) time.
  • E.g. shortcuts AG JE JD give route A G B C H D J
    E F A - length 55
  • Cant guarantee to find best solution because
  • then general problem of finding the best set of
    shortcuts around an Euler tour is NP-Complete

These shortcuts have not been found by bypassing
already-visited cities
12
3. Branch and bound
  • BB is A search strategy rather than a heuristic
  • Algorithm
  • Find one route R1 (e.g. at random) this has
    length L1
  • Now search for another route R2
  • build it city by city e.g. R2 a,b,c,, noting
    the total length L2 so far.
  • if L2 gt L1 then stop, discard R2 (whether
    complete or not) and try another route.
  • Never start a new route with a discarded route.

13
Branch and bound contd
  • 1. Pick a route R1
  • R1 AFCEDBGDCA
  • L1 24
  • 2. Build new route R2
  • R2 AF L2 3
  • R2 AFE L2 13
  • R2 AFEB L2 28
  • L2 gt L1 therefore discard L2
  • and try 2. again
  • The best route cannot possibly start AFEB

e.g.
14
Branch and bound contd
  • Branch and bound prunes the tree of choices as we
    search.
  • BB can simplify the search tree dramatically but
    in the worst case will not reduce problem time at
    all.

?
Prune tree here
15
Summary
  • TSP problem is NP-Complete
  • But we can find reasonable solution in polynomial
    time.
  • Use heuristics
  • nearest neighbour
  • christofides algorithm
  • or search strategy
  • branch and bound

Cant guarantee to find best solution
Cant guarantee any speed up
16
Exercises
  • 1. What does the following Turing Machine do
  • Q q0, q1, q2, T 0, 1, F q2
  • g(q0,0) (q0,0,R), g(q0,1) (q1,1,R),
  • g(q1,0) (q2,1,R), g(q1,1) (q1,1,R)
  • 2. Modify the machine in question 1 so that it
    always leaves an even number of ones on the tape

17
Exercises
  • 3. Apply the nearest neighbour heuristic and
    Christofides algorithm to the following
    travelling salesman problem, with starting point
    at A

18
Exercises
  • 4. Apply Christofides algorithm to the following
    travelling salesman problem, with starting point
    at A

B
8
A
8
C
5
7
5
6
D
4
F
E
6
5
8
9
4
7
H
8
G
6
K
6
8
J
9
19
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com