Branch-and-bound

Branch-and-bound
Jin Zheng, Central South
University
1
Branch and Bound

An enhancement of backtracking

Similarity


A state space tree is used to solve a problem.
Difference


The branch-and-bound algorithm does not limit us to any
particular way of traversing the tree and is used only for
optimization problems
The backtracking algorithm requires the using of DFS
traversal and is used for nonoptimization problems.
Jin Zheng, Central South
University
2
Branch and Bound



Compared to backtracking ,branch-and-bound requires
two additional items.
A way to provide,for every node of a state-space-tree ,a
bound on the best value of the objective function on any
solution that can be obtained by adding further
components to the partial solution represented by the
node.
The value of the best solution seen so far.
Jin Zheng, Central South
University
3
The main idea

Set up a bounding function, which is used to
compute a bound (for the value of the objective
function) at a node on a state-space tree and
determine if it is promising
 Promising (if the bound is better than the
value of the best soluton so far:expand beyond
the node.
 Nonpromising (if the bound is no better than
the value of the best solution so far--:not
smaller for a minimization problem and not
larger for a maxmization problem ): not
expand beyond the node (pruning the statespace tree).
Jin Zheng, Central South
University
4
Terminate a search path at the current node in a statespace tree for any one of the following three reasons:



The value of the node’s bound is not better
than the value of the best solution seen so far.
The node reprsents no feasible solutions
because the constraints of the problem are
already violated.
The subset of feasible solutions reprsented by
the node consists of a single point(and hence no
further choices can be made)-in this case we
compare the value of the objective function
for this feasible solution with that of the best
solution seen so far and update the latter with
Zheng,new
Centralsolution
South
the former ifJinthe
is better.
University
5
Assignment problem
Job1 Job2 Job3 Job4
C=
9
6
5
7
2
4
8
6
7
3
1
9
Jin Zheng, Central South
University
8
7
8
4
6
0
Start
Ib=10
2
1
a→2
a→3
a→4
Ib=17
Ib=10
Ib=20
Ib=18
6
b→3
b→4
Ib=13
Ib=14
Ib=17
9
c→3
c→4
Ib=13
Ib=20
Cost=13
7
b→1
8
d→4
4
a→ 1
5
10
3
complete state-space tree for the
instance of the assignment problem
solved with the best-first branch-andbound algorithm
Jin Zheng, Central South
University
7
Traveling Salesman Problem—Bounding
Function 1

Because a tour must leave every vertex exactly once, a
lower bound on the length of a tour is the sum of the
minimum (lower bound)cost of leaving every vertex.




The lower bound on the cost of leaving vertex v1 is given by
the minimum of all the nonzero entries in row 1 of the
adjacency matrix.
…
The lower bound on the cost of leaving vertex vn is given by
the minimum of all the nonzero entries in row n of the
adjacency matrix.
Note: This is not to say that there is a tour with this
length. Rather, it says that there can be no shorter
tour.Assume that the tour starts with v1.
Jin Zheng, Central South
University
8
Traveling Salesman Problem—Bounding
Function 2

Because every vertex must be entered and exited exactly once,
a lower bound on the length of a tour is the sum of the
minimum cost of entering and leaving every vertex.



For a given edge (u, v), think of half of its weight as the the
exiting cost of u, and half of its weight as the entering cost of
v.
The total length of a tour = the total cost of visiting( entering
and exiting) every vertex exactly once.
The lower bound of the length of a tour = the lower bound of
the total cost of visiting (entering and exiting ) every vertex
exactly once.
 Calculation:



for each vertex, pick top two shortest adjacent edges (their sum
divided by 2 is the lower bound of the total cost of entering and
exiting the vertex);
add up these summations for all the vertices.
Assume that the tour starts with vertex a and that b is visited
before c.
Jin Zheng, Central South
University
9
Traveling salesman
0
a
Ib=14
1
3
2
a,c
a,b
Ib=14
5
6
a,d
a,e
Ib=16
Ib=19
7
a,b,c
a,b,e
a,b,d
Ib=16
Ib=19
Ib=16
8
4
b is not before c
10
9
11
a,b,c,d,e,a
a,b,c,d,e,a
a,b,c,d,e,a
a,b,c,d,e,a
l=24
l=19
I=24
I=16
Jin Zheng, Central South
University
10
Notes



Finding a good bounding is not a simple task.
On the one hand.we want this function to be
easy to compute.
On the other hand,it cann’t bt too simplistic.—
otherwise,it would fail in its principal task to
prune as many branches of a state-space tree
as soon as possible.
Jin Zheng, Central South
University
11
9 palace problem
2
8
3
1
1
6
4
8
5
7
7
Jin Zheng, Central South
University
2
3
4
6
5
12
2 8 3
1 6 4
7
5
1
4
2 2 8 3
1 6 4
6
7 5
2 8 3
1 4
5 7 6 5
5
8 3
2 8 3
2 1 4
7 1 4
6 7 6 5 6
6 5
8
3 2 8 3
1
4
4 7 6 5
6
3
6 2
1 8 4
5 7 6 5
9
5
12
5
13
5
4
2 8 3
1 6 4
7 5
2 8 3 7
1 4
7 6 5 6
2 3 10
1 8 4
7 6 5
2 3 11
1 8 4
7 6 5 6
1 2 3
8 4
7 6 5
1 2 3
A solution
8
4
Jin7Zheng,
6 5 Central South
University
13
Knapsack problem
(1) v1/w1≥v2/w2 ≥… ≥vn/wn
(2) bound function:
ub=v+(W-w)(vi+1/wi+1)
Jin Zheng, Central South
University
14
Example
Item
1
2
3
4
weight value value/weight
4
40
10
7
42
6
5
25
5
3
12
4
W=10
Jin Zheng, Central South
University
15
w=0,v=0
Ub=100
W/o 1
With 1
w=4,v=40
Ub=76
w=11
w=0,v=0
Ub=60
w=4,v=40
Ub=70
w=9,v=65
Ub=69
w=12
w=4,v=40
Ub=64
w=9,v=65
Ub=65
Jin Zheng, Central South
University
16