Professional Documents
Culture Documents
1
Quotes of the Day
The time to relax is when you don't have time for it.
-- Attributed to Jim Goodwin and Sydney J. Harris
2
Overview
3
Overview of this lecture
Complete Enumeration
4
Trading for Profit Game
Points 5 7 4 3 4 6
Utility 16 22 12 8 11 19
6
An Enumeration Tree
IP(1)
1
7
An Enumeration Tree
IP(1)
iPad 1
iPad
x1 = 0 x1 = 1
IP(2) 2 3 IP(3)
8
Which of the following is false?
9
IP(1)
1
x1 = 0 x1 = 1
IP(2) 2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
10
An Enumeration Tree Number of leaves of the
tree: 64.
x1 = 0 x1 = 1
x2 = 0 x2 = 1 x2 = 0 x2 = 1
x3 = 0 x3 = 1 x3 = 0 x3 = 1 x3 = 0 x3 = 1 x3 = 0 x3 = 1
11
On complete enumeration
12
On complete enumeration
Suppose that we could evaluate 1 trillion solutions per
second, and instantaneously eliminate 99.9999999% of
all solutions as not worth considering
Let n = number of binary variables
Solutions times
n = 70, 1 second
n = 80, 17 minutes
n = 90 11.6 days
n = 100 31 years
n = 110 31,000 years
13
Suppose that the number of binary variables is 150.
Suppose that we could evaluate 1 trillion solutions
of an integer program per second.
14
How to solve large integer programs faster
15
Subtrees of an Enumeration Tree
Subtree from
node 2
1
Subtree from
x1 = 0 x1 = 1 node 6
2 3
x2 = 0 x2 = 1 x2 = 0 x2 = 1
4 5 6 7
x3 = 0 x3 = 1 x3 = 0 x3 = 1 x3 = 0 x3 = 1 x3 = 0 x3 = 1
16
The bottom nodes are leaves of the tree.
If we can eliminate an entire subtree in one step,
we can eliminate a fraction of all
complete solutions at in a single step.
1
x1 = 0 x1 = 1
2 3
x2 = 0 x2 = 1 x2 = 0 x2 = 1
4 5 6 7
x3 = 0 x3 = 1 x3 = 0 x3 = 1 x3 = 1 x3 = 0 x3 = 1
17
A simpler problem to work with
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
subject to 8 x1 + 1 x2 + 5 x3 + 4 x4 9 IP(1)
xi {0,1} for i = 1 to 4.
18
The entire enumeration tree (16 leaves)
IP(1)
1
x1 = 0 x1 = 1
IP(2) 2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
19
The entire enumeration tree (16 leaves)
IP(1)
In a branch and bound
1
tree, the nodes
x1 = 0 x1 = 1
represent integer
programs.
IP(2) 2 3 IP(3)
20
What is the optimal objective value for IP(4)?
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
Original IP
subject to 8 x1 + 1 x2 + 5 x3 + 4 x4 9
xi {0,1} for i = 1 to 4.
A. 24
B. 26
C. 9
21
Eliminating subtrees
IP(1)
We eliminate a subtree if
1
1. We have solved the IP
for the root of the x1 = 0 x1 = 1
subtree or
IP(2)
2. We have proved that 2 3 IP(3)
22
But how would
you ever solve
one of the IPs?
If we could do
that, wouldnt we Well explain this
just solve the soon. It all has to do
original with our ability to
problem? solve linear
programs.
23
The LP Relaxation of the IP
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
subject to 8 x1 + 1 x2 + 5 x3 + 4 x4 9 LP(1)
0 xi 1 for i = 1 to 4.
The LP relaxation of the knapsack
If we drop the
problem can be solved using a greedy
requirements that
algorithm.
variables be
integer, we call it
Think of the objective in terms of
the LP relaxation of
dollars, and consider the constraint as a
the IP.
bound on the weight.
24
Solving this LP relaxation
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
subject to 8 x1 + 1 x2 + 5 x3 + 4 x4 9 LP(1)
0 xi 1 for i = 1 to 4.
item 1 2 3 4
value/lb. $3 $2 $4 $1
Opt solution:
Now consider the value per
pound of the four items. Put x3 = 1
items into the knapsack in x1 = 1/2
decreasing order of value per
x2 = 0
pound. What do you get?
x4 = 0
z = 32 25
The LP relaxation of an IP
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
subject to 8 x 1 + 1 x 2 + 5 x3 + 4 x 4 9
We get bounds
for each integer
program by
IP(1) xi {0,1} for i = 1 to 4.
solving the LP
relaxations.
LP(j) = the integer programming
I love LPs. relaxation of IP(j).
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
subject to 8 x 1 + 1 x 2 + 5 x3 + 4 x4 9
LP(1) 0 xi 1 for i = 1 to 4.
26
This LP relaxation solves the IP.
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
Usually, when we
solve the LP, we subject to 8 x 1 + 1 x 2 + 5 x3 + 4 x4 9
get fractional
solutions. But LP(4) x1 = 0, x2 = 0 for i = 1 to 4.
occasionally, we
get a solution that 0 x3 1 0 x4 1
satisfies all of the
integer constraints.
Opt solution for LP(4):
x1 = 0, x2 = 0, x3 = 1, x4 = 1, z = 24.
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
And occasionally,
the LP relaxation is
infeasible.
LP(15) x1 = 1, x2 = 1, x3 = 1
0 x4 1
In this case, the IP
is also infeasible.
There is no feasible solution for LP(15):
I see that
sometimes
the IP gets
solved, Five slides ago you
almost by Well explain this
said that we could
accident. after the mental
eliminate a node if we
break.
can prove that the
optimal solution for
the IP is not optimal
for the original
problem. How is that
possible?
29
Mental Break
30
The Incumbent Solution
The incumbent is a feasible solution for the IP.
Occasionally, the It is the best solution so far in the B&B search.
algorithm will find
a feasible integer
In the vanilla version of Branch and Bound,
solution. We will
there is no initial incumbent. We need to wait
keep track of the
until an LP relaxation gives a feasible integer
feasible integer
solution.
solution with the
best objective In real versions of Branch and Bound, there
value so far. It is are special subroutines that seek out feasible
called the integer solutions with a large objective. The
incumbent. best of these is the initial incumbent.
32
On computing bounds
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
zIP(j) = optimal value
for IP(j). subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
IP(1) xi {0,1} for i = 1 to 4.
zLP(j) = optimal value
for LP(j).
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x(j) = optimal solution
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
for LP(j)
LP(1) 0 xi 1 for i = 1 to 4.
A node is active if it
has not been pruned
and if LP(k) has not
been solved yet.
34
Pruning (fathoming) a node using bounding
37
1
The following question is about x1 = 1
ANY branch and bound tree in
which node 3 was not pruned.
3
x2 = 0 x2 = 1
4 5
Which of the following is false?
1. ZIP(3) ZIP(4).
0 xj 1 for j = 1, 2, 3, 4
39
Branch and Bound: Node 2
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4 No incumbent
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = -
x1 = 0
0 xj 1 for j = 2, 3, 4
40
Sure. Any active
node can be
You selected selected. Have you noticed
node 2. Would it Sometimes it can that Tom is the
have been OK to make a difference one asking the
select node 3? It in speeding up questions, but
was also active. the algorithm. different people
But thats beyond keep answering
the scope of the them?
lecture.
41
Branch and Bound: Node 3
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4 No incumbent
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = -
x1 = 1
0 xj 1 for j = 2, 3, 4
Opt solution for LP(3):
IP(1)
1
x1 = 1; x2 = 0,
x1 = 0 x1 = 1
x3 = 1/4; x4 = 0
zLP(3) = 28.
IP(2) 2 33 IP(3)
x2 = 0 x2 = 1
IP(4) 4 IP(5) 5
42
I notice that when you
No. We could branch on any
create nodes 4 and 5, you
variable. If we branched on x4,
branch on variable x2.
then node 4 would correspond to
On one branch, we
the original IP with the additional
require x2 = 0. On the
constraints:
other side, we require
x1 = 0, x4 = 0.
that x2 = 1. Is that always
the way that B&B works?
Branching makes a big
difference in B&B. The best B&B
algorithms use heuristics to
choose the branching variable.
A good choice can lead to a
much faster solution.
43
Branch and Bound: Node 4
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4 No incumbent
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = -
x1 = 0 , x 2 = 0
0 xj 1 for j = 3, 4
Opt solution for LP(4):
IP(1)
x1 = 0; x2 = 0,
1
x3 = 1; x4 = 1
x1 = 0 x1 = 1
zLP(4) = 24.
IP(2) 2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
IP(4) 4
4 IP(5) 5 IP(6) 6 7 IP(7)
44
Branch and Bound: Node 5
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 0, x2 = 0,
x3 = 1, x4 = 1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 24
x1 = 0 , x 2 = 1
Incumbent
0 xj 1 for j = 3, 4
Opt solution for LP(5):
IP(1)
x1 = 0; x2 = 1,
1
x3 = 1; x4 = 3/4
x1 = 0 x1 = 1
zLP(5) = 25.
IP(2) 2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
IP(4) 4
4 IP(5) 55 IP(6) 6 7 IP(7)
45
Branch and Bound: Node 6
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 0, x2 = 0,
x3 = 1, x4 = 1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 24
x1 = 1 , x2 = 0
Incumbent
0 xj 1 for j = 3, 4
Opt solution for LP(6):
IP(1)
1 x1 = 1; x2 = 0,
x1 = 0 x1 = 1 x3 = 1/5; x4 = 0
IP(2)
zLP(6) = 28.
2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
5
IP(4) 4
4
IP(5) IP(6)
66 7 IP(7)
x3 = 0 x3 = 1
46
Branch and Bound: Node 7
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 0, x2 = 0,
x3 = 1, x4 = 1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 24
x1 = 1 , x2 = 1
Incumbent
0 xj 1 for j = 3, 4
Opt solution for LP(7):
IP(1)
1 x1 = 1; x2 = 1,
x1 = 0 x1 = 1 x3 = 0; x4 = 0
IP(2)
zLP(7) = 26
2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
IP(4) 4
4
IP(5) 5 IP(6) 6 77 IP(7)
x3 = 0 x3 = 1 x3 = 0 x3 = 1
47
Branch and Bound: Node 8
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 1,
0, x2 = 1,
0,
x3 = 0,
1, x4 = 0
1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 26
24
x1 = 0 , x2 = 1, x3 = 0
Incumbent
0 x4 1
Opt solution for LP(8):
IP(1)
1 x1 = 0; x2 = 1,
x1 = 0 x1 = 1 x3 = 0; x4 = 1
IP(2)
zLP(8) = 6
2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
IP(4) 4
4
IP(5) 5 IP(6) 6 77 IP(7)
x3 = 0 x3 = 1 x3 = 0 x3 = 1
48
The labels are just
for convenience.
Why are the When node 4 was
children of node fathomed, we didnt
5 are labeled 8 need to create its
and 9? children. So, the How does he
Previously, they labels 8 and 9 could know about
were labeled 10 be used for the node 4? He
and 11? children of node 5. wasnt even
here for that
slide.
49
Branch and Bound: Node 9
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 1,
0, x2 = 1,
0,
x3 = 0,
1, x4 = 0
1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 26
24
x1 = 0 , x2 = 1, x3 = 1
Incumbent
0 x4 1
Opt solution for LP(9):
IP(1)
1 x1 = 0; x2 = 1,
x1 = 0 x1 = 1 x3 = 1; x4 = 3/4
IP(2)
zLP(9) = 25
2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
IP(4) 4
4
IP(5) 5 IP(6) 6 77 IP(7)
x3 = 0 x3 = 1 x3 = 0 x3 = 1
8 9
50
Branch and Bound: Node 10
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 1,
0, x2 = 1,
0,
x3 = 0,
1, x4 = 0
1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 26
24
x1 = 1 , x2 = 0, x3 = 0
Incumbent
0 x4 1
Opt solution for LP(10):
IP(1)
1 x1 = 1; x2 = 0,
x1 = 0 x1 = 1 x3 = 0; x4 = 1/4
IP(2)
zLP(10) = 25
2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
IP(4) 4
4
IP(5) 5 IP(6) 6 77 IP(7)
x3 = 0 x3 = 1 x3 = 0 x3 = 1
8 9 10
51
Branch and Bound: Node 11
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 1,
0, x2 = 1,
0,
x3 = 0,
1, x4 = 0
1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 26
24
x1 = 1 , x2 = 0, x3 = 1
Incumbent
0 x4 1
Opt solution for LP(11):
IP(1)
IP(2) 2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1
IP(4) 4
4
IP(5) 5 IP(6) 6 77 IP(7)
x3 = 0 x3 = 1 x3 = 0 x3 = 1
8 9 10 11
52
Branch and Bound: the end
Maximize 24 x1 + 2 x2 + 20 x3 + 4 x4
x1 = 1,
0, x2 = 1,
0,
x3 = 0,
1, x4 = 0
1
subject to 8 x 1 + 1 x 2 + 5 x 3 + 4 x4 9
zI = 26
24
x1 = 1 , x2 = 0, x3 = 1
Incumbent
0 x4 1
Opt solution for LP(11):
IP(1)
1
There is no feasible solution
x1 = 0 x1 = 1
IP(2) 2 3 IP(3)
x2 = 0 x2 = 1 x2 = 0 x2 = 1 The end
IP(4) 4
4
IP(5)
x3 = 0
5 IP(6)
x3 = 1 x3 = 0
6
x3 = 1
77 IP(7)
of B&B
8 9 10 11
53
Lessons Learned
Branch and Bound can speed up the search
Only 11 nodes (LPs) out of 31 were evaluated.
55
Rounding down to improve bounds
If all cost coefficients of a maximization problem are
integer valued, then the optimal objective value (for the
IP) is integer. And zIP(j) zLP(j).
So, zIP 5.
56
Adding constraints to improve bounds
57
Max 4 x1 + 3 x2 + 3 x3 + 3 x4 Opt LP Solution
s.t. 2 x1 + 2 x2 + 2 x3 + 2 x4 3 A x1 = 1; x2 = 1/2,
x3 = 0; x4 = 0
xi {0,1} for i = 1 to 4.
zLP = 5.5
Max 4 x 1 + 3 x 2 + 3 x 3 + 3 x4
s.t. x1 + x2 + x3 + x4 1.5 B
xi {0,1} for i = 1 to 4.
s.t. x 1 + x2 + x 3 + x 4 1 C x1 = 1; x2 = 0,
x3 = 0; x4 = 0
xi {0,1} for i = 1 to 4.
zLP = 4
59
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.