Optimization23 13
Optimization23 13
Techniques
for AI
Lecture
CS/AI 13
2101
Branch & Bound Algorithm-
(0, 1) Knapsack Problem
(0, 1)-Knapsack Problem
x3 =
0
P(0, 1)
x2 =
x3 = P1(0, 1) 0
1
x2 =
1 P11(0, 1)
Solve- k=0, x1 =0.6 ,
x4 =0
P2(0, 1)
x3 =
0
P(0, 1)
x2 =
x3 = P1(0, 1) 0
1
x2 =
1 P11(0, 1)
Solve- k=0, x1 =0.6 ,
x4 =0
P12(0,
1)
Max z = 6+8x1 +
11x2 + 4x4 Max z = 6+8x1 + 4x4 Solve- k=2, x1 =1 , x4
5x1 + 3x4 ≤ 10 =1
5x1 + 7x2 + 3x4 ≤ 10
x2 =0 xi ∈ { 0, 1} for all i
xi ∈ { 0, 1} for all i = 1, 4
P2(0, 1)
x3 =
0
P(0, 1)
P12(0, 1)
P1(0, 1) x2 = P112(0, 1)
x3 = 0
1
x2 = x1 =
1 P 11
(0, 1)
0
x1 = P111(0, 1)
1
P(0, 1) INFEASIBLE
Maximize z = 8x1 + 11x2 + 6x3 + 4x4
5x1 + 7x2 + 4x3 + 3x4 ≤ 14
xi ∈ { 0, 1} for all i = 1, 2, 3, 4
P2(0, 1)
x3 =
0
P(0, 1)
P12(0, 1)
P1(0, 1) x2 = P112(0, 1)
x3 = 0
1
x2 = x1 =
1 P 11
(0, 1)
0
x1 = P111(0, 1)
1
P(0, 1) INFEASIBLE
Maximize z = 8x1 + 11x2 + 6x3 + 4x4
5x1 + 7x2 + 4x3 + 3x4 ≤ 14
xi ∈ { 0, 1} for all i = 1, 2, 3, 4
Branch-and-bound strategy
It is a tree search.
It gradually (as it traverses the tree) assigns
values to variables
Root node – no variable is assigned
12
Tree
Search
x1 ←0 1→
x2 ←0 1→
x3 ←0 1→
x=
(1,0,0)T
Branch-and-bound strategy
It is efficient in the average case
because many branches can be
terminated very early.
15
Branch & Bound Method
Slide 1- Initialization
Maintain a structure L as the list of problems
(nodes) to solve ( set of Knapsack Subproblems).
We shall take L to be a Stack OR Priority Queue
The algorithm runs till L is not empty
A lower Bound LB - value of the z at the best
known integer solution. It is global variable. One
value for the entire tree, gets updated time to time.
incumbent as the best integer solution found so
far. It goes with LB.
A upper bound at every node. It is local
Any node is labeled (not visited/visited/fathomed/qualified for
expansion )
Initially L has only the original problem
Initially lower Bound LB = −∞,
Branch & Bound Method
Select a Candidate Problem
CANDIDATE PROBLEM-
If L is empty, STOP
If L is not empty.
Take a Candidate problem from list L (a (0, 1)
knapsack problem)
RELAXATION - The LP relaxation of Candidate is .
FEASIBILITY CHECK - Check if infeasible.
If infeasible Select another problem from L.
Else, solve
Branch & Bound Method
Slide 3- When is solved
UPDATING BOUND-
if the optimal solution is integer,
if > LB then update LB as , and incumbent as
else, no change in LB, incumbant
Node k is not to be expanded. Select another problem from
L
if the optimal solution is not integer
if ≤ LB, node k is Fathomed. Select another problem from
L
x2 = x1 =
1 P 11
(0, 1)
0
x1 = P111(0, 1)
1
P(0, 1) INFEASIBLE
Maximize z = 8x1 + 11x2 + 6x3 + 4x4
5x1 + 7x2 + 4x3 + 3x4 ≤ 14 If infeasible
xi ∈ { 0, 1} for all i = 1, 2, 3, 4 Select another
problem from L.
Else,
solve
Maximize 24 x1 + 17 x2 + 12 x3 + 6 x4
such that 10 x1 + 8 x2 + 6 x3 + 5 x4 ≤
15
x1,x2,x3,x4 {0,1}
LB = −∞ LP solution