Branch and Bound TSP - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Branch and Bound TSP

Description:

(No tour can beat it) Need to keep track of the relative cost for taking another exit. ... Does it matter if we consider. cost of arrival first, then cost ... – PowerPoint PPT presentation

Number of Views:159
Avg rating:3.0/5.0
Slides: 43
Provided by: mike437
Category:
Tags: tsp | beat | bound | branch | it

less

Transcript and Presenter's Notes

Title: Branch and Bound TSP


1
Branch and Bound TSP
  • Lecture 31 BB TSP
  • Review DP Formulation
  • A BB Problem Formulation
  • State Space
  • Cost function
  • Bounds
  • Lower Bounds
  • Upper Bounds
  • Example
  • Lecture 30 LC Search
  • Bounding Methods
  • Example 0-1 Knapsack
  • Data Structures Priority Queue
  • LC Search

2
g(1,V-1) as c1kg(k,V-k,1)in Pictures
2
9
Then g(1,1,2,3,4-1) could be c13
g(3,2,4) 8 31 39. To solve the
problem g(1,V-1), need to find g(2,1,3,4) and
g(4,1,2,3) then pick smallest.
9
15
6
12
8
1
3
13
20
16
17
5
10
4
3
Building The DP Solution
  • Base case is g(i,ø)
  • Get g(i,ø) easily.
  • Build g(i, j) cijg(j, ø) from g(j, ø).
  • What are the dimensions of the DP Table?

4
Call Tree for DP TSP
g(1,2,3,4)
c13g(3,2,4)
c14g(4,2,3)
c12g(2,3,4)
c23g(3,4)
c24g(4,3)
c42g(2,3)
c43g(3,2)
c32g(2,4)
c34g(4,2)
5
DP Solution Complexity
  • Enumerate all tours?
  • O(n!) time
  • Use this DP solution?
  • O(n2 2n) time and O(n 2n) space

6
Problem Formulation
  • Given graph (V,E), with Vn and cij be the cost
    of edge lti,jgt. If edge lti,jgt is not an element
    of E, then cij is infinite (999).
  • Without loss of generality, assume every tour
    starts and ends at vertex 1.
  • A solution is an array s 1, p, 1, where p is
    a permutation of (2, 3, , n).
  • An optimal solution is a solution s with minimum
    total cost.

7
Problem Formulation
  • Need to define
  • State Space
  • Cost function c(x)
  • Bounds on the cost function
  • Use bounds to
  • Choose most promising direction
  • Eliminate obviously bad choices

8
Example
1
9
8
2
10
6
5
3
12
7
4
What is a good State Space? Cost Function?
Lower Bound? Upper Bound?
9
One State Space Idea
Note that there are only 5 vertices on the graph,
but 65 nodes on the SS tree
2
5
3
4
5
3
2
5
2
5
2
4
4
4
3
3
10
One State Space Idea
Note that there are only 5 vertices on the graph,
but 65 nodes on the SS tree
2
5
3
4
5
3
2
5
2
5
2
4
4
4
3
3
Leaves represent all possible tours
11
Cost Function
Here x refers to a state on the State Space Tree,
not a vertex of the graph Be careful to keep
these concepts straight since node may refer to
either!
2
5
3
4
5
3
2
5
2
5
2
4
4
4
3
3
12
Cost Function
2
5
3
4
5
3
2
5
2
5
2
4
4
4
3
3
If x is not a leaf, then c(x) is the best
possible cost of any tour through x (minimum of
leaf costs in subtree)
13
One Lower Bound on Tour Cost
Consider the partial cost on the tour up to the
node x
2
5
3
4
5
3
2
5
2
5
2
4
4
4
3
3
Not very tight. Can we do better?
14
Lower Bound on TSP Tour
1
9
8
2
10
6
5
3
12
7
4
Every tour must leave every node and and arrive
at every node.
15
Lower Bound on TSP Tour
Lower bound 82361 20
1
9
8
2
10
6
5
3
12
7
4
Whats the cheapest way to leave each node?
16
Lower Bound on TSP Tour
Lower bound20 (No tour can beat it)
0
1
0
0
9
0
2
0
6
1
1
Save the sum of those costs. Subtract each cost
from the cost of leaving each individual node.
Why?
Need to keep track of the relative cost for
taking another exit.
17
Lower Bound on TSP Tour
1
Lower bound20
0
1
0
0
2
5
9
0
2
0
6
1
3
4
1
Does that edge collection arrive at every node?
In this case, the tour never arrives at node 3.
We can tighten our estimate of the best tour cost
by using the fact that a tour must arrive at node
3 somehow.
18
Lower Bound on TSP Tour
Lower bound21
0
1
0
0
9
0
1
0
6
0
1
At best have to get to node 3 along the cheapest
edge Add this cost to our lower bound and assign
relative costs of arrival into node 3.
19
Lower Bound on TSP Tour
Algorithms do this using a matrix. Heres the
representation.
20
Lower Bound on TSP Tour
8 2 3 6 1
1
9
8
2
10
6
4
3
12
7
4
Find the minimum element in each row. This is
the cheapest way to leave each node.
21
Lower Bound on TSP Tour
8 2 3 6 1
1
9
8
2
10
6
4
3
12
7
4
Compute the relative cost of leaving by
subtracting the minimum from each row.
22
Lower Bound on TSP Tour
8 2 3 6 1
0
1
0
0
9
0
2
0
6
1
1
Compute the relative cost of leaving by
subtracting the minimum from each row.
23
Lower Bound on TSP Tour
8 2 3 6 1
0
1
0
0
9
0
2
0
6
1
1
Does this edge collection arrive at every
node? Check for a zero in each column.
24
Lower Bound on TSP Tour
8 2 3 6 1
0
1
0
0
9
0
2
0
6
1
0 0 1 0 0
1
Does this edge collection arrive at every
node? Check for a zero in each column.
25
Lower Bound on TSP Tour
8 2 3 6 1
0
1
0
0
9
0
1
0
6
0
0 0 1 0 0
1
Lower Bound 823611 21
Subtract the minimum from each column to compute
relative cost of arrival.
26
Lower Bound on TSP Tour
Does it matter if we consider cost of arrival
first, then cost leaving?
1
9
8
2
10
6
5
3
12
7
4
Every tour must leave every node and and arrive
at every node.
27
Lower Bound on TSP Tour
1 3 4 4 2
Consider cost of arrival first, then cost of
leaving.
28
Lower Bound on TSP Tour
0
6
4
0
6
3
0
0
10
3
1 3 4 4 2
0
Consider cost of arrival first, then cost of
leaving.
29
Lower Bound on TSP Tour
4 0 0 3 0
0
6
4
0
6
3
0
0
10
3
1 3 4 4 2
0
Consider cost of arrival first, then cost of
leaving.
30
Lower Bound on TSP Tour
4 0 0 3 0
0
2
0
0
6
0
0
0
7
0
1 3 4 4 2
0
Lower Bound 1344243 21
Consider cost of arrival first, then cost of
leaving.
31
Lower Bound on TSP Tour
4 0 0 3 0
0
2
0
0
6
0
0
0
7
0
1 3 4 4 2
0
Lower Bound 1344243 21
The lower bound is the same, but the relative
cost matrix is different.
32
Problem Formulation
  • Need to define
  • State Space
  • Cost function c(x)
  • Bounds on the cost function
  • Use bounds to
  • Choose most promising direction
  • Eliminate obviously bad choices

State Space Tree
Cost of (subtree) tour
  • Lower Bounds
  • Path cost so far
  • Cost of leaving/arrival

Good Upper Bound?
33
Example
bound 21
1to2
1to3
1to4
1to5
bound 211
34
Chose to go from 1 to 2
bound 21
1to2
0
1
0
1
0
0
0
9
9
0
1
0
1
6
6
0
0
bound 211
1
1
Add extra cost from 1 to 2, exclude edges from 1
or into 2.
35
Chose to go from 1 to 2
bound 21
1to2
0
1
0
1
0
0
0
9
9
0
1
0
1
6
6
0
0
bound 2111
1
1
No edges into node 4 w/ 0 reduced cost.
36
Chose to go from 1 to 2
bound 21
1to2
0
1
0
8
1
6
0
bound 2111
0
Add cost of reducing edge into node 4.
37
Bounds For Other Choices
bound 21
1to3,1to5,1to2,1to4
1to2
1to3
1to4
1to5
bound 23
bound 999
bound 21
bound 999
38
Two Possibilities
0
1
0
0
0
0
9
0
1
1
0
6
6
0
0
1
bound 23
bound 21
39
Leaving Node 4
0
0
4to2,1to2,4to3
bound 21
0
0
1
0
6
0
4to2
4to3
4to5
bound 22
bound 21
bound 28
40
Leaving Node 3
0
bound 21
0
4to2,1to2,3to2
0
0
6
0
3to5
3to2
bound 21
bound 999
41
Leaving Node 3
0
bound 21
0
4to2,1to2,3to2
0
0
6
0
3to5
3to2
bound 21
bound 999
42
Call Tree For This Example
b21
b23
b999
b21
b999
b22
b21
b28
b21
b999
Write a Comment
User Comments (0)
About PowerShow.com