Discrete
Optimization
The Knapsack Problem:!
Branch and Bound
Goals of the Lecture
Introduce branch and bound!
The value of relaxation
One-Dimensional Knapsack
maximize
subject to
45x1 + 48x2 + 35x3
5x1 + 8x2 + 3x3 10
xi 2 {0, 1} (i 2 1..3)
Exhaustive Search
x x x
? ? ?
0
x1 = 1
x1 = 0
x2 = 1
x3 = 1
3
x2 = 1
x2 = 0
2
x3 = 0
3
x3 = 1
3
x2 = 0
x3 = 0
3
x3 = 1
3
x3 = 0
3
x3 = 1
3
x3 = 0
3
x x x
x x x
x x x
x x x
x x x
x x x
x x x
x x x
1 1 1
1 1 0
1 0 1
1 0 0
0 1 1
0 1 0
0 0 1
0 0 0
Branch and Bound
Iterative two steps!
branching !
bounding!
Branching!
split the problem into a number of
subproblems!
like in exhaustive search!
Bounding!
find an optimistic estimate of the
best solution to the subproblem!
maximization: upper bound!
minimization: lower bound
5
Branch and Bound
How to find this optimistic estimate?!
Relaxation!!
!
!
!
Optimization is the art of relaxation
A Knapsack Model
maximize
subject to
45x1 + 48x2 + 35x3
5x1 + 8x2 + 3x3 10
xi 2 {0, 1} (i 2 1..3)
What can we relax?!
we can relax the capacity constraint
Depth-First Branch and Bound
i
45
48
35
K = 10
X2 = 1
X1 = 1
X1 = 0
$45!
5!
$128
$0!
10!
$83
X2 = 0
---!
-3!
---
X2 = 1
$45!
5!
$80
X3=1
$80!
2!
$80
8
Value!
Room!
Estimate
$0!
10!
$128
$0!
10!
$35
$48!
2!
$83
X3=0
$45!
5!
$45
X3=1
---!
-1!
---
X2 = 0
X3=0
$48!
2!
$48
A Knapsack Model
maximize
subject to
45x1 + 48x2 + 35x3
5x1 + 8x2 + 3x3 10
xi 2 {0, 1} (i 2 1..3)
Can we relax something else?
A Knapsack Model
What if the items are bars of Belgian chocolate?!
In that case, we could actually take a fraction
of the bar!!
!
maximize
Callebaut
!
subject to
45x1 + 48x2 + 35x3
5x1 + 8x2 + 3x3 10
0 xi 1 (i 2 1..3)
!
!
This is called the linear relaxation!
we will come back to this later in the class!
we relax the integrality requirement
10
A Knapsack Model
Can we solve a knapsack when we can
take parts of the items?!
order the items by decreasing value of Vi/Wi !
most value per kilo
maximize
subject to
45x1 + 48x2 + 35x3
5x1 + 8x2 + 3x3 10
0 xi 1 (i 2 1..3)
11
A Knapsack Model
How to solve the relaxation now?!
select the items while the capacity is not exhausted!
select a fraction of the last item!
maximize
!
subject to
!
!
!
!
45x1 + 48x2 + 35x3
5x1 + 8x2 + 3x3 10
0 xi 1 (i 2 1..3)
In this example,!
V1/W1 = 9, V2/W2 = 6, V3/W3 = 11.7!
select items 3 and 1!
select 1/4 of item 2!
estimation: 92
12
A Knapsack Model
Why is correct?
yi
let xi =
vi
maximize
subject to
P
P
y
i21..j i
wi
y
i21..j vi i
K
0 yi 1 (i 2 1..j)
13
A Knapsack Model
Of course, if the items are archeological artifacts...
14
Depth-First Branch and Bound
i
45
48
35
K = 10
X2 = 1
X1 = 1
X1 = 0
$45!
5!
$92
$0!
10!
$77
X2 = 0
---!
-3!
---
$45!
5!
$80
X3=1
$80!
2!
$80
15
Value!
Room!
Estimate
$0!
10!
$92
X3=0
$45!
5!
$45
Until Next Time
16
Citations
Stone Foundation Tablet with Inscription of Gudea - 41221 (http://commons.wikimedia.org/wiki/File:Sumerian __Stone_Foundation_Tablet_with_Inscription_of_Gudea_-_Walters_41221_-_View_A.jpg). Artist Unknown. Walters Art Museum [Public domain, CC-BY-SA-3.0
(http://creativecommons.org/licenses/by-sa/3.0 )], via Wikimedia Commons !
!
Stone Foundation Tablet with Inscription of Gudea - 41220 (http://commons.wikimedia.org/wiki/File:Sumerian_-_
Stone_Foundation_Tablet_with_an_Inscription_of_Gudea_-_Walters_41220_-_View_A.jpg). Artist Unknown. Walters Art Museum [Public domain, CC-BY-SA-3.0
(http://creativecommons.org/licenses/by-sa/3.0) via Wikimedia Commons !
!
Buddha at the Moment of Victory (http://commons.wikimedia.org/wiki/File:Thai_-_Buddha_at_the_Moment_of_Victory_-_Walters_542775.jpg ). Artist Unknown.
Walters Art Museum [Public domain, CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0 )], via Wikimedia Commons !
!
Hoxne Hoard two gold bracelets (http://commons.wikimedia.org/wiki/File:Hoxne_Hoard_two_gold_bracelets_side.JPG) by F (http://commons.wikimedia.org/
wiki/User:F%C3%A6) [CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons !
!
Ring with the engraved portrait of Ptolemy VI Philometor (http://commons.wikimedia.org/wiki/File:Ring_with_engraved_portrait_of_ Ptolemy_VI_Philometor_(3rd
%E2%80%932nd_century_BCE)_-_2009.jpg<http://commons.wikimedia.org/wiki/File:Ring_with_engraved_
portrait_of_Ptolemy_VI_Philometor_(3rd-2nd_century_BCE)_-_2009.jpg>) By Unknown. (Photographed by PHGCOM in 2009.) [Public domain], via Wikimedia
Commons !
!
Calice du sacre Tau (http://commons.wikimedia.org/wiki/File:Calice_du_sacre_Tau.jpg) By Vassil (http://commons.wikimedia.org/wiki/User:Vassil) (Own work)
[Public domain], via Wikimedia Commons !
17
Citations
the mask of agamemnon (http://www.flickr.com/photos/rosemania/5705122218/) by Xuan Che (http://www.flickr.com/people/rosemania/) CC BY-2.0 (http://
creativecommons.org/licenses/by/2.0/deed.en) !
!
Terracotta Warrior (http://www.flickr.com/photos/59627558@N00/4677378806/) by fixermark (http://www.flickr.com/photos/59627558@N00/) CC BY 2.0 (http://
creativecommons.org/licenses/by/2.0/deed.en)!
!
Mmmmm Chocolate [274/366] (http://www.flickr.com/photos/sackton/8041853745) by Tim Sackton (http://www.flickr.com/photos/sackton/) CC BY-SA 2.0 (http://
creativecommons.org/licenses/by-sa/2.0/deed.en)!
18