TSP Branch and Bound Lecture 2015

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

TSP Problem

Problem: Let G=(V, E) be a directed weighted graph, with weight cij


assigned to each edge of the graph G. problem is to find an optimal
tour.

Solution : Let cij equals to cost of edge <i, j>, and cij = ∞ if <i,j>  E,
and |v|=n.

Assume that every tour start and end at vertex 1. So solution space is
given by S={ 1, x | x is a permutation of (2, 3, ….n) }

Thus size of solution space is |S|= (n-1)! .


We organize the solution space in state-space tree. Each leaf-node L is
solution-node and represent the tour defined by path from root to L.
TSP Problem
1
i1=2 i1=3 i1=4
2 3 4

i2=3 i2=4 i2=2 i2=4 i2=2 i2=3


5 6 7 8 9 10

i3=4 i3=3 i3=4 i3=2 i3=3 i3=2


11 12 13 14 15 16

Figure1: SST for problem with n=4


Each leaf-node L is solution-node and represent the tour defined by path
from root to L.
Node 14 represent the tour i0=1, i1=3, i2=4, i3=2, and i4=1

To use the LCBB to search the SST, we define the cost function C(.) such that
the solution node with least C(.) corresponds to optimal tour.
TSP Problem
To use the LCBB to search the SST, we define the cost function C(.) such that
the solution node with least C(.) corresponds to optimal tour. And two other
^
functions C (.) and U(.).
C(A) = length of tour defined by path from the root to A if A is leaf node
= cost of min-cost leaf in the sub-tree A, If A is not leaf node.
^ ^
A simple C (.) such that C (A) <= C(A) for all A obtained by defining
^
C () = length of path defined at node A.
The path defined at node 6 is i0 , i1, i2 = 1,2,4. it consist of edge <1,2> , <2, 4>.

^
A better C (.) can be obtained by using reduced cost matrix corresponding to
G.
1. A row (column) is reduced iff it contain at least one zero and all remaining
entries are non-negative.
2. A matrix is reduced if every row and column is reduced.
How to reduce the cost matrix of given graph G.
TSP Problem
(a) cost matrix row reduced
∞ 20 30 10 11 ∞ 10 20 0 1

15 ∞ 16 4 2 13 ∞ 14 2 0

3 5 ∞ 2 4 1 3 ∞ 0 2

19 6 18 ∞ 3 16 3 15 ∞ 0

16 4 7 16 ∞ 12 0 3 12 ∞

Since every tour in this graph include exactly one edge <i, j > with i=k, 1<=k<=5
and exactly one edge <i, j > with j=k , 1<=k<=5.

Subtracting a constant t from every entry in one column or row of the cost-
matrix reduced the length of every tour by exactly t. A min-cost tour remain a
min-cost following this operation.

Obtain the reduced cost matrix. The total amount subtracted is the lower
bound on min-cost tour.
Subtracting 10,2,2,3,4 from rows 1,2,3,4,5
TSP Problem
Row reduced matrix (b)reduced matrix  L=25
10 20 0 11
∞ 10 17 0 1

12 ∞ 11 2 0
13 ∞ 13 2 0
0 3 ∞ 0 2
1 3 ∞ 0 2
15 3 12 ∞ 0
16 3 15 ∞ 0
11 0 0 12 ∞
12 0 3 12 ∞

Now subtracting 1, 3 from column 1,3.


Lower bound =The total amount subtracted is = 10+2+2+3+4+1+3=25,
Hence all tour in the graph have length at least 25. Associate a reduced cost
matrix with every node in SST.

Let A be a reduced cost matrix for node R. Let S be child of R such that tree
edge (R,S) corresponds to include the edge <i, j > in the tour.
If S is not the leaf then reduced cost matrix for node S is obtained as follows:
TSP Problem
If S is not the leaf then reduced cost matrix for node S is obtained as follows:
1. Change all entries in row i and column j to ∞ ( this prevent any more edge
leaving vertex i and entering to vertex j ).
2. Set A(j,1) to ∞, this prevent the use of edge <j, 1>
3. Reduced all rows and columns in resulting matrix except for rows and
columns containing only ∞.

Let resulting matrix is B. if r is total amount subtracted in step-3 then


^ ^
C (S) = C (R) + A(i, j) + r
For upper bound we can use U(R) = ∞ for all R. Set upper= ∞.

Start with the root node as E-node, nodes 2,3,4 and 5 are generated.
Calculate the reduced-matrix for these nodes.
(1) Reduced matrix for node 2 is calculated from matrix (b).
a) Set all entries in row 1 and column 2 to ∞ .
b) Set element at position A(2,1) to ∞
TSP Problem
25 1
i1=2 i1=3 i1=4 i1=5
35 2 53 4 25 5 31
3
i2=2 i2=3 i2=5
28 50 36
6 7 8
i3=3 i3=5
52 28
9 10

i4=3
28 11

Figure1: SST generated by procedure LCBB


TSP Problem
∞ 10 17 0 1 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
12 ∞ 11 2 0 ∞ ∞ 11 2 0 1 ∞ ∞ 2 0
0 3 ∞ 0 2 0 ∞ ∞ 0 2 ∞ 3 ∞ 0 2
15 3 12 ∞ 0 15 ∞ 12 ∞ 0 4 3 ∞ ∞ 0
11 0 0 12 ∞ 11 ∞ 0 12 ∞ 0 0 ∞ 12 ∞
reduced matrix: root node (a ) path 1,2 : node 2 (b) path 1,3: node 3
^ ^
C (2) = bound= 35 C (3) = bound= 53
(1) Reduced matrix for node 2 is calculated from matrix (b).
•Set all entries in row 1 and column 2 to ∞ .
• Set element at position (2,1) to ∞
• The matrix is reduced
^ ^
Thus C (2) = C (1) + c12 + 0 = 25 + 10 = 35, bound= 35
(2) Reduced matrix for node 3 is calculated from matrix (b).
•Set all entries in row 1 and column 3 to ∞ .
• Set element at position (3,1) to ∞
• The matrix is reduced by subtracting 11 from column 1
^ ^
Thus C(3) = C (1) + c13 + 11 = 25 + 17 +11= 53, bound =53
TSP Problem
25 1
i1=2 i1=3 i1=4 i1=5
35 2 53 4 25 5 31
3
i2=2 i2=3 i2=5
28 50 36
6 7 8
i3=3 i3=5
52 28
9 10

i4=3
28 11

Figure1: SST generated by procedure LCBB


The next live node become E-node is node 4, because its bound is minimum.
Node 6,7, and 8 are generated. Calculate the reduced matrix for these nodes and
bounds.
TSP Problem
∞ 10 17 0 1 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
12 ∞ 11 2 0 12 ∞ 11 ∞ 0 10 ∞ 9 0 ∞
0 3 ∞ 0 2 0 3 ∞ ∞ 2 0 3 ∞ 0 ∞
15 3 12 ∞ 0 ∞ 3 12 ∞ 0 12 0 9 ∞ ∞
11 0 0 12 ∞ 11 0 0 ∞ ∞ ∞ 0 0 12 ∞
reduced matrix: root node (c ) path 1,4 : node 4 (d) path 1,5: node 5
^ ^
C (4)= bound= 25 C (5)= bound= 31
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞
∞ ∞ 11 ∞ 0 1 ∞ ∞ ∞ 0 1 ∞ 0 ∞ ∞
0 ∞ ∞ ∞ 2 ∞ 1 ∞ ∞ 0 0 3 ∞ ∞ ∞
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞
11 ∞ 0 ∞ ∞ 0 0 ∞ ∞ ∞ ∞ 0 0 ∞ ∞

(e ) path 1,4,2 : node 6 (f) path 1,4,3: node 7 (g) path 1,4,5: node 8
^ ^ ^
C (6)=bound=28 C (7)= bound=50 C (8)= bound=36
TSP Problem
25 1
i1=2 i1=3 i1=4 i1=5
35 2 53 4 25 5 31
3
i2=2 i2=3 i2=5
28 50 36
Green = live nodes 6 7 8
Red = E-nodes i3=3 i3=5
52 28
9 10

i4=3
28 11

Figure1: SST generated by procedure LCBB

Next node 6 become the E-node. Nodes 9 and 10 are generated. Calculate the
reduced matrix for this node, ant its bound are 52 and 28.
TSP Problem
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞
∞ ∞ 11 ∞ 0 ∞ ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞
0 ∞ ∞ ∞ 2 ∞ 1 ∞ ∞ 0 0 ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞
11 ∞ 0 ∞ ∞ 0 ∞ ∞ ∞ ∞ ∞ ∞ 0 ∞ ∞

(e ) path 1,4,2 : node 6 (h) path 1,4,2,3: node 9 (i) path 1,4,2,5: node 10
bound=28 bound=52 bound=28

node 10 is next E-node. The solution node 11 is generated.

^
The tour length for this node is C (11)=28 and upper is updated to 28.
TSP Problem
25 1
i1=2 i1=3 i1=4 i1=5
35 2 53 4 25 5 31
3
i2=2 i2=3 i2=5
28 50 36
6 7 8
i3=3 i3=5
52 28
9 10

i4=3

11 28
solution node
Figure1: SST generated by procedure LCBB

^
For the next E-node , node 5 , C (5) = 31 > upper. (node is non-promising). All other
live nodes becomes non-promising because their bounds > 31.
Hence, LCBB terminates with path 1, 4, 2, 5, 3, 1 as the shortest path( tour).

You might also like