Branch and Bound
Branch and Bound
Figure 1
Portion of the Tree Generated during
Backtracking
Figure 2
Portion of 4-Queens State Space Tree
Generated by FIFO Branch-and-Bound
Figure 3
Problem with LIFO and FIFO Branch-and-
Bound
• 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.
• When node 30 is generated, it should have become
obvious to the search algorithm that this node will lead to
an answer node in one move.
• However, the rigid FIFO rule first requires the expansion of
all live nodes generated before node 30 was expanded.
Least Cost (LC) Search
Rank the live nodes by using a cost function 𝑐(.)
The next E-node is selected on the basis of this ranking function
Assign ranks based on the expected additional computational effort
Problem with the above techniques to compute the cost at node 𝑥 is “by the
Let 𝑔ො(𝑥) be an estimate of the addition effort needed to reach an answer node
from 𝑥. Node 𝑥 is assigned a rank using a function 𝑐Ƹ (.) defined as:
ሺ 𝑥ሻ = 𝑓൫ℎሺ 𝑥ሻ ൯ + 𝑔ො(𝑥)
𝑐Ƹ
where ℎሺ 𝑥ሻ is the cost of reaching 𝑥 from the root and 𝑓(.) is non decreasing
function.
LC Branch-and-Bound Search
node 𝑥.
In DFS, we use 𝑓൫ℎሺ 𝑥ሻ ൯ ≡ 0 and 𝑔 ොሺ 𝑥ሻ ≥ 𝑔
ොሺ 𝑦ሻ whenever 𝑦
is a child of 𝑥.
An LC-search coupled with bounding functions is called
Figure 4
Part of the State Space Tree for 15-Puzzle
Problem
Figure 5
First Ten Steps of Depth First Search
Figure 6
An Intelligent Solution to 15-Puzzle Problem
Associate a cost cሺ 𝑥ሻ with each node 𝑥 in the state space tree.
The cost cሺ 𝑥ሻ can be the length of a path from root to a nearest goal node (if
any) in the sub tree with root 𝑥.
Begin with root as E-node and generate a child node with 𝑐(.) value same as
the root node.
length of a shortest path from 𝑥 to a goal node in the sub tree with root 𝑥.
• Define the cost function 𝑐(.) such that 𝑐(𝑥) is minimum for all nodes
answer node in a state space search tree.
• The easiest way to do this is to use the objective function itself for 𝑐(.).
representing an optimal solution.
• For nodes representing feasible solutions, 𝑐(𝑥) is the value of the objective
• For nodes representing partial solutions 𝑐(𝑥) is the cost of the minimum-cost
node in the sub tree with root 𝑥.
• Since 𝑐(𝑥) is in general as hard to compute as the original optimization
𝑐Ƹ
(𝑥) such that 𝑐Ƹ (𝑥) ≤ 𝑐(𝑥) for all 𝑥.
problem is to solve, the branch-and-bound algorithm will use an estimate
• Any node representing a feasible solution will be an answer node but only
minimum-cost answer nodes correspond to an optimal solution
Job Sequencing with Deadlines
Figure 7
Example: Job Sequencing with Deadlines (fixed tuple size
formulation
J1 J2 J3 J4
Profit 5 10 6 3
Deadline 1 3 2 1
Processing Time 1 2 1 1
Figure 8
FIFO Branch-and-Bound for Job Sequencing (Variable Tuple Size)
• 𝑈= ∞ or 𝑈= σ1≤𝑖≤𝑛 𝑝𝑖
• 𝑢ሺ 2ሻ = 19,𝑢ሺ 3ሻ = 14,𝑢ሺ 4ሻ =
18,𝑢ሺ 5ሻ = 21
• Variable 𝑈 is updated to 14 when node
• E-node=2, 𝑢ሺ 6ሻ = 9 and so 𝑈 is
• Only nodes 2 and 3 remain alive
killed
• E-node=3, 𝑢ሺ 9ሻ = 8 and so 𝑈 is
• Node 8 is infeasible and it gets killed
killed
• Next E-node is 6, both its children are
Figure 9 infeasible
• 9’s only child is infeasible, leaving 9
as the minimum-cost answer node
LC Branch-and-Bound
the function − σ 𝑝𝑖 𝑥𝑖 .
• Clearly, σ 𝑝𝑖 𝑥𝑖 is maximized iff − σ 𝑝𝑖 𝑥𝑖 is
minimized.
• The modified knapsack problem is stated as
follows:
Minimize − σ 𝑝𝑖 𝑥𝑖
Subject to σ 𝑤𝑥𝑖 ≤ 𝑚,
𝑥𝑖 = 0 or 1,1 ≤ 𝑖 ≤ 𝑛
0/1 Knapsack Problem
We define two functions 𝑐Ƹ ሺ 𝑥ሻ and 𝑢ሺ 𝑥ሻ such that 𝑐Ƹ
(𝑥) ≤ 𝑐ሺ 𝑥ሻ ≤ 𝑢(𝑥).
Let 𝑥 be a node at level 𝑗, 1 ≤ 𝑗≤ 𝑛 + 1. At node 𝑥 assignments have
already been made to 𝑥𝑖 , 1 ≤ 𝑖 < 𝑗; hence 𝑢ሺ 𝑥ሻ = − σ1≤𝑖<𝑗 𝑝𝑖 𝑥𝑖 .
𝑢ሺ 𝑥ሻ can
computing 𝑢ሺ 1ሻ and 𝑐Ƹ ሺ 1ሻ . The computation of 𝑢ሺ 1ሻ and 𝑐Ƹ ሺ 1ሻ is done as
An improved value for be obtained by first
follows:
o The objects are scanned from left to right and the objects are added into
negation of the total profit of all the objects in the knapsack is the 𝑢(1).
the knapsack until the first object that doesn’t fit is encountered. The
o In the calculation of ෝ 𝑐 ሺ 1ሻ , the fraction (that fills the knapsack) of the first
the total profit of all objects in the knapsack i.e., 𝑢ሺ 1ሻ and the negation
object that doesn’t fit is also considered. It is the sum of the negation of
of the profit corresponding to the fraction (that fills the knapsack) of the
The left child of node 1 corresponds to the inclusion of object 1 (𝑖.𝑒., 𝑥1 = 1).
first object that doesn’t fit.
knapsack.
0/1 Knapsack Problem LC Search
Figure 11
0/1 Knapsack Problem FIFO Branch and
Bound
Figure 12
State Space Tree for Traveling Salesperson
Problem for n=4
Figure 13
Least Cost Branch and Bound (LCBB) Search for
Travelling Salesperson Problem
𝑐Ƹ
(𝑥) ≤ 𝑐(𝑥) ≤ 𝑢(𝑥)
LCBB Search for Travelling Salesperson Problem
• A row(column) is said
to be reduced iff it
contains at least one
zero and all remaining
entries are non-
negative.
• A matrix is reduced iff
every row and column
is reduced.
LCBB Search for Travelling Salesperson Problem
𝑐Ƹሺ 𝑆ሻ = 𝑐Ƹ
ሺ 𝑅ሻ + 𝐴ሺ 𝑖,𝑗ሻ + 𝑟
LCBB Search for Travelling Salesperson Problem