0% found this document useful (0 votes)
148 views48 pages

7-Branch and Bound

The document describes the branch and bound method for solving discrete optimization problems. It begins by explaining that branch and bound searches a tree model of the solution space similar to backtracking but is oriented towards optimization problems. It then provides details on how branch and bound algorithms work, including generating the state space tree, computing lower bounds at each node to prune subtrees, and examples applying it to the traveling salesman problem.

Uploaded by

Prateek Agrawal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
148 views48 pages

7-Branch and Bound

The document describes the branch and bound method for solving discrete optimization problems. It begins by explaining that branch and bound searches a tree model of the solution space similar to backtracking but is oriented towards optimization problems. It then provides details on how branch and bound algorithms work, including generating the state space tree, computing lower bounds at each node to prune subtrees, and examples applying it to the traveling salesman problem.

Uploaded by

Prateek Agrawal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 48

Branch and bound

1
Branch and Bound Method
• The design technique known as branch and
bound is similar to backtracking in that it
searches a tree model of the solution space
and is applicable to a wide variety of
discrete combinatorial problems.
• Backtracking algorithms try to find one or
all configurations modeled as N-tuples,
which satisfy certain properties.
• Branch and bound are more oriented
towards optimization.

2
Here all the children of the E- node are
generated before any other live node can
become E- node.
Here two state space trees can be formed
BFS (FIFO)and D search (LIFO).

3
Variable size tuple
1
X1=4
X1=1
X1=2
4 5
2 3

X2=2 X2=4 X2=3


11
6 7 8 9 10

X3=3 X3=4

13 15
12 14

X4=4 BFS
16 SEARCH for
sum of
subset
problem
4
Variable size tuple1
X1=4
X1=1
X1=2
14 16
2 10

X2=2 X2=4 X2=3


15
3 7 9 11 13

X3=3 X3=4

6 12
4 8

X4=4 DFS
5 SEARCH for
sum of
subset
problem
5
Variable size tuple 1
X1=4
X1=1
X1=2
4 5
2 3

X2=2 X2=4 X2=3


6
10 11 12 7 8

X3=3 X3=4

15 9
14 13

X4=4 D- SEARCH
16 for sum of
subset
problem
6
Fixed size tuple
1
X1=1 X1=0

2 3

18 19 4 5

20 21 12 13 6 7

8 9
22 23 16 17 14 15 10 11

Nodes are generated in D -


search manner for sum of
subset problem
7
Traveling salesman problem
• The salesman problem is to find a least
cost tour of N cities in his sales region.
• The tour is to visit each city exactly once.
• Salesman has a cost matrix C where the
element cij equals the cost (usually in terms
of time, money, or distance) of direct travel
between city I and city j.
• Assume cii=infinity for all i.
• Also cij= infinity if it is not possible to move
directly from city I to city j.
8
Branch and bound algorithms for traveling
salesman problem can be formulated in a
variety of ways.
Without loss of generality we can assume
that every tour starts and ends at city one.
So the solution space S is given by
{ 1 , π , 1 | π is a permutation of (2,3,4… n)}

|S|= (n-1)!.
9
1

I1=2 I1=4
I1=3
2 3 4
I2=3 I2=3
I2=4
5 6 9 10
7 8

I3=2
I3=4

12 13 14 15 16
11

Tour 1 2 3 4 1 12431
A State space tree for traveling salesman problem with n= 4

10
all tours

------
{3,5} {3,5}

-------
{2,1} {2,1}

A branch and bound state space tree for traveling salesman


problem
11
What is meant by bounding?

With each vertex in the tree we associate a


lower bound on the cost of any tour in the
set represented by the vertex.
The computation of these lower bounds is
major labor saving device in any branch
and bound algorithm.
There fore much thought should be given to
obtain tight bounds.
12
Assume that we have constructed a specific
complete tour with cost = m.
If the lower bound associated with the set of
tours represented by a vertex v is M.
And
M>= m
Then no need to search further
for descendants of v for the
optimum tour.
13
Basic steps for the computation of
lower bounds
The basic step in the computation of lower
bound is known as reduction. It is based
on following observations:
1- In the cost matrix C every full tour
contains exactly one element from each
row and each column.
Note: converse need not be true e.g {(1,5),
(5,1),(2,3),( 3,4),(4,2)}.
14
{(1,5),(5,1),(2,3),( 3,4),(4,2)}.

15
• 1 5

• 2 3

»4
16
Row Reduction
2- If a constant h is subtracted from every
entry in any row or column of C , the cost
of any tour under the new matrix C’ is
exactly h less than the cost of the same
tour under matrix C. This subtraction is
called a row (column) reduction

17
3- By a reduction of the entire cost matrix C
we mean the following: Sequentially go
down the rows of C and subtract the value
of each row’s smallest element hi from
every element in the row. Then do the
same for each column.
Let h = ∑ hi summation over all rows and
columns
The resulting cost matrix will be called the
reduction of C.
h is a lower bound on the cost of any
tour.
18
Let A be the reduced cost matrix for a node
R. Let S be a child of R such that edge
(R,S) corresponds to including edge (i,j) in
the tour.
1- change all entries in row i and column j of
A to .(so that no edge from this row
(column)leaving from I(coming to j), may
be included in the tour in future).
2- set A(j,1) = ∞

This prevents A(j,1) since node 1 should be


the last node of the tour.
19
4-Reduce all rows and columns in the
resulting matrix except for rows and
columns containing only ∞
.
Let the resulting matrix be B.
Let r be the total amount subtracted then
lower bound on S is
lower bound for (R) + A(i,j) + r

20
example
Cost matrix Reduced Cost Matrix

∞ 20 30 10 11 ∞ 10 17 0 1
15 ∞ 16 4 2 12 ∞ 11 2 0
3 5 ∞ 2 4 0 3 ∞ 0 2
19 6 18 ∞ 3 15 3 12 ∞ 0
16 4 7 16 ∞ 11 0 0 12 ∞

Reduced cost matrix lower bound = 25(subtracting from


rows 10,2,2,3,4) and 1,3 from column 1 and 3.
So all tours in the given graph have length at least 25.

21
∞ 20 30 10 11
15 ∞ 16 4 2
3 5 ∞ 2 4
19 6 18 ∞ 3
16 4 7 16 ∞

2 3 1 4 5 2 h1 h2 h3 h4 h5 ∞ 10 20 00 1
C1 C2 C3 C4 C5 15 ∞ 16 4 2
3 5 ∞ 2 4
19 6 18 ∞ 3
16 4 7 16 ∞
22
1 25

I1=2 I1=5
I1=4
I1=3
5
35 2 53 3 25 4 31
I2=2
i2= 3
28 7 8
6
36
50
I3=3
I3=5

52
52 9 10 28
I4=3

28
11

23
∞ 10 17 0 1 ∞ ∞ ∞ ∞ ∞
11 2
12 ∞ 11 2 0 ∞ ∞ 0
0 3 ∞ 0 2 0 ∞ ∞ 0 2
15 12
15 3 12 ∞ 0 ∞ ∞ 0
11 12
11 0 0 12 ∞ ∞ 0 ∞
Reduced Cost Matrix Path (1,2) node 2(25 + 10=35)

24
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
11 2
∞ ∞ 0 1 ∞ ∞ 2 0

0 ∞ ∞ 0 2 ∞ 3 ∞ 0 2
15
∞ 12
∞ 0 4 3 ∞ ∞ 0
11 12 0 0 ∞ 12 ∞
∞ 0 ∞

Path (1,2) node 2(25 + 10=35) path(1,3) node 3 (25+17+11=53


= ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞ ∞
12
∞ 9 0 ∞ 12
∞ 11 ∞ 0
0 3 ∞ 0 ∞ 0 3 ∞ ∞ 2
12
0 9 ∞ ∞ ∞ 3 12 ∞ 0
12
∞ 0 0 ∞ 11
0 0 ∞ ∞ Path 1,4
25
path(1,5) node 5 node 4
∞ 10 17 0 1 ∞ ∞ ∞ ∞ ∞

12 ∞ 11 2 0 12
∞ 9 0 ∞
0 3 ∞ 0 2
0 3 ∞ 0 ∞
15 3 12 ∞ 0 12
0 9 ∞ ∞
11 0 0 12 ∞ 12
∞ 0 0 ∞
Reduced Cost Matrix
path(1,5) node 5

25 + +2 + 3=31 26
∞ 10 17 0 1 ∞ ∞ ∞ ∞ ∞
1 ∞ ∞ 2 0
12 ∞ 11 2 0
∞ 3 ∞ 0 2
0 3 ∞ 0 2
4 3 ∞ ∞ 0
15 3 12 ∞ 0
0 0 ∞ 12 ∞
11 0 0 12 ∞

Reduced Cost Matrix path(1,3) node 3 (25+17+11=53

27
∞ 10 17 0 1 ∞ ∞ ∞ ∞ ∞

12
12 ∞ 11 2 0 ∞ 11 ∞ 0

0 3 ∞ 0 2 0 3 ∞ ∞ 2

15 3 12 ∞ 0 ∞ 3 12 ∞ 0

11
11 0 0 12 ∞ 0 0 ∞ ∞

Reduced Cost Matrix Path 1,4 node 4 28


∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

12 11
∞ 11 ∞ 0 ∞ ∞ ∞ 0

0 3 ∞ ∞ 2 0 ∞ ∞ ∞ 2

∞ 3 12 ∞ 0 ∞ ∞ ∞ ∞ ∞

11 11
0 0 ∞ ∞ ∞ 0 ∞ ∞

Path 1,4 node 4 bound 25 Path 1-4-2 node 6 29


∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

∞ ∞ 11 ∞ 0 ∞ ∞ ∞ ∞ ∞

0 ∞ ∞ ∞ 2 ∞ ∞ ∞ ∞ 0

∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞

11 ∞ 0 ∞ ∞ 0 ∞ ∞ ∞ ∞

Path 1-4-2 node 6 30


Path 1-4-2-3 node 9
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
11
∞ ∞ ∞ 0 1 ∞ ∞ ∞ 0
0 ∞ ∞ ∞ 2 ∞ 1 ∞ ∞ 0
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
11
∞ 0 ∞ ∞ 0 0 ∞ ∞ ∞
Path 1 4 3 : node 7
Path 1-4-2 npde 6

∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞ 0 0 ∞ ∞ ∞ ∞
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞
0 ∞ ∞ ∞ ∞ ∞ ∞ 0 ∞ ∞

Path 1-4-2-3 node 9 Path 1-4-2-5 node 10 31


Least cost (LC) Search
In both LIFO and FIFO branch and bound the
selection rule for the next E- node is rather rigid
and in a sense blind.The selection rule for the
next E- node does not give any preference to a
node that has a very good chance of getting the
search to an answer node quickly.
The search for an answer node can often be
speeded by using an “ intelligent ranking C*(.)
for live nodes.The next E- node is selected on
the basis of this ranking function.
32
Let g^ (x) be an estimate of the additional effort
needed to reach an answer node from x.
H(x) is the cost of reaching x from the root.
F(.) is any non decreasing function.
Node x is assigned a rank using c^(.) such that
C^(x)= f(h(x)) + g^(x)
Using f(.)=0 usually biases the search algorithm to
make deep probes into the search tree.
Note: BFS and d-search are special cases of LC
search.
If g^(x)= 0 and f(h(x)) = level of node x then a LC
search generates nodes by level.Which is BFS
33
Assignment Problem

34
There are n people who need to be
assigned to execute n jobs, one person
per job. (i.e. each person is assigned to
exactly one job and each job is
assigned to exactly one person).
C(i, j) is the cost if the i th person is
assigned j th job
for each pair i, j =1,2…n
The problem is to find an assignment with
the smallest total cost.

35
• Hungarian method is much more efficient
for this problem.

36
Lower bound
There are many ways to find a lower bound.
We can relax the condition on person,
i.e. one Person may be assigned more than
one job
Or
We can relax he condition on jobs
More than one person may be assigned to a
job
37
problem
Job1 Job2 Job3 Job4 persons

9 2 7 8 A

6 4 3 7 B

5 8 1 8 C

7 6 9 4 D

38
Person A to job 1
Cut first row and first column
then try to assign the remaining persons to
cheapest jobs lower bound 9+3+1+4=17
Job1 Job2 Job3 Job4 persons

9 2 7 8 A

6 4 3 7 B

5 8 1 8 C

7 6 9 4 D

39
Start
Lb=10

a1 a 2 a 3 a 4
Lb=17 Lb=10 Lb=20 Lb =18

b1 b 3 b4
Lb=13 Lb=14 Lb=17

For a 2 delete 2nd col ,1st row find


c3 c4 min of each row and total of it
d 4 d 3 40
Lower bound when A-2 and B-1
Lower bound 2+6+1+4=13

Job1 Job2 Job3 Job4 persons

9 2 7 8 A

6 4 3 7 B

5 8 1 8 C

7 6 9 4 D

41
Lower bound=2+3+1+4=10
Job1 Job2 Job3 Job4 persons

9 2 7 8 A

6 4 3 7 B

5 8 1 8 C

7 6 9 4 D

42
Knapsack Problem

Ite Wt Val Val


m / wt
Knapsack ’s capacity is 10
1 4 40 10
2 7 42 6
3 5 25 5
4 3 12 4

43
• A simple way to compute upper bound is
= v + (W – w) (vi+1/wi+1)
Where v = total value of items already
added in bag
w = wt of items already selected
i+1 is the best per unit payoff among the
remaining items

44
Sate space tree

W=0,v=0
Up=100 W /o 1
With 1

W=4,v=40 W=0,v=0
Up=76 Up=60
With 2 w/ o 2

W=4, v=40
 Ite W V V
W=11
Not feas
Up=70 m t al al/
w/ o 3 wt
 With 3

W=9, v=65 W=4, v=40 1 4 40 10


Up=69 Up=64 2 7 42 6
 3 5 25 5
W= 12 W=9, v=65
4 3 12 445
 Not feas Up=65
Traveling salesman problem

3
a b
6 9
1 5 7

c 4 d

2
3 9
8
e

46
Lower Bound
for each city I find the sum si of the
distances from city I to the two nearest
cities; compute the sum s of these n
numbers; divide the result by two and
round up if all distances are integers.

Lb = [(1 +3)+ (3 +6) + (1 +2) + (3 +4) + (2+3)]/2 =


14

47
a
Lb=14

a, b a, c a, d a, e
Lb=14 X Lb=16 Lb=19

X X
a, b, c
a, b, d a, b, e
Lb=16
Lb=16 Lb=19

a, b, c, d a, b, c ,e a, b, d, c a, b, d,e
(e,a) (d, a) (e, a) (c, a)
Lb= 24 Lb=19 Lb=24 Lb= 16

First tour Better tour Inferior tour Optimal tour

48

You might also like