of 34
8/12/2019 Branch_and_Bound.doc
1/34
Branch and Bound
Definitions:
Branch and Bound is a state space search method in which
all the children of a node are generated before expanding
any of its children.
Live-node: A node that has not been expanded.
It is similar to backtracking technique but uses BF!like
search.
Dead!node: A node that has been expanded
olution!node
"#!earch $"east #ost earch%:
&he selection rule for the next '!node in FIF( or "IF(
branch!and!bound is sometimes )blind*. i.e. the selection
+
, - /
0 1 2 3
+
, - /
0 12 3
+
, - /
"i4e 5ode: ,6 -6 6 and /
FIF( Branch 7 Bound $BF%
#hildren of '!node are inserted
in a queue.
"IF( Branch 7 Bound $D!earch%
#hildren of '!node are inserted in a
stack.
8/12/2019 Branch_and_Bound.doc
2/34
rule does not gi4e any preference to a node that has a 4ery
good chance of getting the search to an answer node quickly.
&he search for an answer node can often be speeded by using
an )intelligent* ranking function6 also called an
approximate cost function#
8
'xpanded!node $'!node%: is the li4e node with the best#
8
4alue
9equirements
Branching: A set of solutions6 which is represented by a
node6 can be partitioned into mutually exclusi4e sets.
'ach subset in the partition is represented by a child of the
original node.
"ower bounding: An algorithm is a4ailable for calculating
a lower bound on the cost of any solution in a gi4en
subset.
earching: "east!cost search $"#%
#ost and approximation
'ach node6 6 in the search tree is associated with a
cost: #$%
8/12/2019 Branch_and_Bound.doc
3/34
#$% ; cost of reaching the current node6 $'!
node%6 from the root+ the cost of reaching an
answer node from .
#$% ; g$% < h$%
=et an approximation of #$x%6#
8$x% such that
#
8$x% #$x%6 and
#
8$x% ; #$x% if x is a solution!node.
&he approximation part of#
8$x% is
h$x%;the cost of reaching a solution!node from 6
not known.
"east!cost search:
&he next '!node is the one with least#
8
'xample: 2!pu>>le
#ost function: #
8
; g$x%
8/12/2019 Branch_and_Bound.doc
4/34
Assumption: mo4e one tile in any direction cost +.
12356784 12358674
Initial State inal State
/-,
8
# =+=
12358674
12356784
1235647812356784
12563784
12358674 12356784 13526784
12358674
-+,
8
# =+=
/.+
8
# =+=-,+
8
# =+= /.+
8
# =+=
/-,
8
# =+=
-?-
8
# =+=
/,-
8
# =+=
8/12/2019 Branch_and_Bound.doc
5/34
5ote: In case of tie6 choose the leftmost node.
8/12/2019 Branch_and_Bound.doc
6/34
Algorithm:
@ li4enodeset: set to hold the li4e nodes at any time @
@ lowcost: 4ariable to hold the cost of the best cost at any
gi4en node @
Begin"owcost ; C
hile li4enodeset do
! choose a branching node6 k6 such that
k li4enodesetC @ k is a '!node @
- li4enodeset; li4enodeset ! EkC
- =enerate the children of node k and the
corresponding lower boundsC
k;E$i6>i%: i is child of k and >iits lower
bound
- For each element $i6>i% in kdo
- If >iG H
- then
- ill child iC @ i is a child node @
- 'lse
If child i is a solution&hen
H ;>iC current best ; child iC
'lse
Add child i to li4enodesetC
'ndifC
'ndifC
! 'ndforC
'ndwhileC
8/12/2019 Branch_and_Bound.doc
7/34
&ra4elling alesman Jroblem: ! "ranc# and "ound al$orit#m
Definition: Find a tour of minimum cost starting from a
node going through other nodes only once and returning
to the starting point .
Definitions:
A row$column% is said to be reduced iff it contains at
least one >ero and all remaining entries are non!
negati4e.
A matrix is reduced iff e4ery row and column isreduced.
"ranc#in$:
'ach node splits the remaining solutions into two
groups: those that include a particular edge and
those that exclude that edge
'ach node has a lower bound.
'xample: =i4en a graph =;$K6'%6 let Li6MG '6
!ll Solutions
Solutions %it# &i'() Solutions %it#out &i'()
"+
"
",
8/12/2019 Branch_and_Bound.doc
8/34
"oundin$: Now to compute the cost of each nodeO
ubtract of a constant from any row and any column
does not change the optimal solution $&he path%.
&he cost of the path changes but not the path itself.
"et A be the cost matrix of a =;$K6'%.
&he cost of each node in the search tree is computed
as follows:
"et 9 be a node in the tree and A$9% its
reduced matrix
&he cost of the child $9%6 :
et row i and column M to infinity
et A$M6+% to infinity
9educed and let 9#" be the
reduced cost.
#$% ; #$9% < 9#"
8/12/2019 Branch_and_Bound.doc
9/34
8/12/2019 Branch_and_Bound.doc
10/34
=i4en the following cost matrix:
tate pace &ree:
Kertex ; - Kertex ; /
0 1 2
+?
/-/ /- ,/
Kertex ; , Kertex ; /Kertex ; -
-
Kertex ; , Kertex ; /Kertex ; Kertex ; -
,2 /? -0
/, ,2
,/+
,
3
++ ,2
Kertex ; -
8/12/2019 Branch_and_Bound.doc
11/34
&he &J starts from node +: *ode 1
o 9educed Qatrix: &o get the lower bound of the
path starting at node +
9ow R +: reduce by +?
9ow R,: reduce ,
9ow R-: reduce by ,
8/12/2019 Branch_and_Bound.doc
12/34
9ow R : 9educe by -:
9ow R : 9educe by
#olumn +: 9educe by +
#olumn ,: It is reduced.
#olumn -: 9educe by -
8/12/2019 Branch_and_Bound.doc
13/34
#olumn : It is reduced.
#olumn /: It is reduced.
&he reduced cost is: 9#" ; ,/
o the cost of node + is:
#ost$+% ; ,/
&he reduced matrix is:
cost1,; ,/
8/12/2019 Branch_and_Bound.doc
14/34
#hoose to go to 4ertex ,: *ode 2
- #ost of edge L+6,G is: A$+6,% ; +?
- et row R+ ; inf since we are choosing edge L+6,G
- et column R , ; inf since we are choosing edge
L+6,G
- et A$,6+% ; inf
-&he resulting cost matrix is:
- &he matrix is reduced:
o 9#" ; ?
- &he cost of node , $#onsidering 4ertex , from
4ertex +% is:
ost2, . cost1, + !1'2, . 25 + 1/ . 35
8/12/2019 Branch_and_Bound.doc
15/34
#hoose to go to 4ertex -: *ode 3
- #ost of edge L+6-G is: A$+6-% ; +1 $In the reduced
matrix
- et row R+ ; inf since we are starting from node +
- et column R - ; inf since we are choosing edge
L+6-G
- et A$-6+% ; inf
- &he resulting cost matrix is:
9educe the matrix:
o 9ows are reduced
o &he columns are reduced except for column R +:
9educe column + by ++:
8/12/2019 Branch_and_Bound.doc
16/34
&he lower bound is:
o 9#" ; ++
&he cost of going through node - is:
o cost$-% ; cost$+% < 9#" < A$+6-% ; ,/ < ++ < +1
; /-
8/12/2019 Branch_and_Bound.doc
17/34
#hoose to go to 4ertex : *ode 4
o 9emember that the cost matrix is the one that was
reduced at the starting 4ertex +
o #ost of edge L+6G is: A$+6% ; ?
o et row R+ ; inf since we are starting from node
+
o et column R ; inf since we are choosing edge
L+6G
o et A$6+% ; inf
o &he resulting cost matrix is:
o 9educe the matrix:
9ows are reduced
#olumns are reduced
o &he lower bound is: 9#" ; ?
o &he cost of going through node is:
8/12/2019 Branch_and_Bound.doc
18/34
cost$% ; cost$+% < 9#" < A$+6% ; ,/ < ?
< ? ; ,/
8/12/2019 Branch_and_Bound.doc
19/34
#hoose to go to 4ertex /: *ode 5
o 9emember that the cost matrix is the one that was
reduced at starting 4ertex +
o #ost of edge L+6/G is: A$+6/% ; +
o et row R+ ; inf since we are starting from node
+
o et column R / ; inf since we are choosing edge
L+6/G
o et A$/6+% ; inf
o &he resulting cost matrix is:
o 9educe the matrix:
9educe rows:
9educe row R,: 9educe by ,
8/12/2019 Branch_and_Bound.doc
20/34
9educe row R: 9educe by -
#olumns are reduced
o &he lower bound is:
9#" ; , < - ; /
o &he cost of going through node / is:
cost$/% ; cost$+% < 9#" < A$+6/% ; ,/ < /