SlideShare a Scribd company logo
Brief journey in the big world of
Integer Programming
with the
Knapsack
Olivier Pirson
Presentation for the oral exam of
INFO-F424 Combinatorial optimization
Computer Science Department
Université Libre de Bruxelles
June 1st
, 2017
(Cosmetic correction November 26, 2017)
Last version: https://bitbucket.org/OPiMedia/
brief-journey-in-the-big-world-of-integer-programming-with-the/
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
1 Problem
2 Primal and dual bounds
3 Branch and Bound
4 References
Brief journey. . . with the Knapsack 2 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
0 − 1 Knapsack Problem formulation
Let
a set of n items, for each i ∈ {1, 2, . . . , n}
a weight ai
a value ci
a knapsack of capacity b
Find the subset of {1, 2, . . . , n}
that it may be contained in the knapsack and maximizes the value.
The canonical Binary Integer Program formulation:
Variables: xi ∈ {0, 1}, xi =
1 if item i is selected
0 otherwise
Constraint:
n
i=1
ai xi ≤ b
Objective function: max
n
i=1
ci xi
Brief journey. . . with the Knapsack 3 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
1 Problem
2 Primal and dual bounds
3 Branch and Bound
4 References
Brief journey. . . with the Knapsack 4 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
Greedy heuristic algorithm – primal/lower bound
Sort variables by decreasing order of density value
weight
: ci
ai
In this order, pick each possible item.
That fill the knapsack with the best independent choice.
For example:
max 45x1 + 48x2 + 9x3
subject to 5x1 + 12x2 + 3x3 ≤ 16
density 9 4 3
Give the solution: (1, 0, 1) with value 45 + 9 = 54.
54 is a lower bound of the problem.
Indeed (0, 1, 1) is a better solution (in fact the optimal solution 1
)
of value 48 + 9 = 57.
1
In simple example like this
it is very easy to perform an exhaustive search.
Brief journey. . . with the Knapsack 5 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
Linear relaxation – dual/upper bound
The idea is to permit piece of item, and then fill completely the knapsack.
Of course the relaxed problem is an other problem and its solution is not a
solution of the initial problem.
But this solution is an upper bound for the initial problem.
With the same example:
max 45x1 + 48x2 + 9x3
subject to 5x1 + 12x2 + 3x3 ≤ 16
and now xi ∈ [0, 1] instead ∈ {0, 1}
5 + α12 = 16 =⇒ α = 11
12
Give (1, 11
12
, 0) with value 45 + 11
12
48 = 89.
We known now that the optimal solution x⋆
of the initial problem is such
that: 54 ≤ x⋆
≤ 89
We obtained theses two bound in O(n).
Brief journey. . . with the Knapsack 6 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
General principle of relaxation
For the Integer Programming
z = max{c(x) | x ∈ X ⊆ Rn
}
zR
= max{f (x) | x ∈ T ⊆ Rn
}
is a relaxation if
X ⊆ T
c(x) ≤ f (x) ∀x ∈ X
So zR
is an upper bound for the initial problem.
Brief journey. . . with the Knapsack 7 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
1 Problem
2 Primal and dual bounds
3 Branch and Bound
4 References
Brief journey. . . with the Knapsack 8 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
Exhaustive search
We can break the problem into two subproblems, and so forth.
That give this kind of binary tree representation:
Figure: Discrete Optimization
Brief journey. . . with the Knapsack 9 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
Contain the Exponential Explosion
There is 2n
possibilities, so an exhaustive search is quickly impossible.
In fact, it is a NP-hard problem.
(The decision problem is already NP-complete.)
The goal is to push as far as possible the exponential curve.
Figure: Discrete Optimization
How avoid the impossible (in practice) exhaustive search?
Brief journey. . . with the Knapsack 10 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
Depth-First Branch and Bound
Pruning. . .
Figure: Discrete Optimization
We have the optimal solution 80 with only 7 nodes visited,
instead 24
− 1 = 15.
Brief journey. . . with the Knapsack 11 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
1 Problem
2 Primal and dual bounds
3 Branch and Bound
4 References
Brief journey. . . with the Knapsack 12 / 13
Brief
journey. . .
with the
Knapsack
Problem
Primal and
dual bounds
Branch and
Bound
References
References
References:
Pascal Van Hentenryck.
Discrete Optimization.
MOOC, University of Melbourne,
https://www.coursera.org/learn/discrete-optimization
Laurence A. Wolsey.
Integer Programming.
Wiley, 1998
NP-Complete, xkcd
Brief journey. . . with the Knapsack 13 / 13

More Related Content

PDF
PDF
Bt0080 fundamentals of algorithms2
PDF
Subproblem-Tree Calibration: A Unified Approach to Max-Product Message Passin...
PDF
Astaño 4
PDF
Fixed Point Theorems for Weak K-Quasi Contractions on a Generalized Metric Sp...
PDF
(DL輪読)Variational Dropout Sparsifies Deep Neural Networks
PDF
(研究会輪読) Weight Uncertainty in Neural Networks
PDF
(DL hacks輪読) How to Train Deep Variational Autoencoders and Probabilistic Lad...
Bt0080 fundamentals of algorithms2
Subproblem-Tree Calibration: A Unified Approach to Max-Product Message Passin...
Astaño 4
Fixed Point Theorems for Weak K-Quasi Contractions on a Generalized Metric Sp...
(DL輪読)Variational Dropout Sparsifies Deep Neural Networks
(研究会輪読) Weight Uncertainty in Neural Networks
(DL hacks輪読) How to Train Deep Variational Autoencoders and Probabilistic Lad...

What's hot (20)

PDF
(DL hacks輪読)Bayesian Neural Network
PDF
Subproblem-Tree Calibration: A Unified Approach to Max-Product Message Passin...
PDF
The complexity of promise problems with applications to public-key cryptography
PDF
Quiz 1 solution
PPTX
머피의 머신러닝: 17장 Markov Chain and HMM
PDF
7f44bdd880a385b7c1338293ea4183f930ea
PDF
(DL hacks輪読) Variational Inference with Rényi Divergence
PPTX
Murpy's Machine Learning:14. Kernel
PPTX
Simplification of switching functions
PDF
Integrated methods for optimization
PPTX
머피의 머신러닝 13 Sparse Linear Model
PDF
NEW NON-COPRIME CONJUGATE-PAIR BINARY TO RNS MULTI-MODULI FOR RESIDUE NUMBER ...
PDF
Amelioration of Modeling and Solving the Weighted Constraint Satisfaction Pro...
PDF
16 Machine Learning Universal Approximation Multilayer Perceptron
PPTX
Limits of Computation
PDF
11.[8 17]numerical solution of fuzzy hybrid differential equation by third or...
PDF
KDD Poster Nurjahan Begum
PDF
Numerical solution of fuzzy hybrid differential equation by third order runge...
PDF
11.numerical solution of fuzzy hybrid differential equation by third order ru...
PDF
Permutations and Combinations IIT JEE+Olympiad Lecture 3
(DL hacks輪読)Bayesian Neural Network
Subproblem-Tree Calibration: A Unified Approach to Max-Product Message Passin...
The complexity of promise problems with applications to public-key cryptography
Quiz 1 solution
머피의 머신러닝: 17장 Markov Chain and HMM
7f44bdd880a385b7c1338293ea4183f930ea
(DL hacks輪読) Variational Inference with Rényi Divergence
Murpy's Machine Learning:14. Kernel
Simplification of switching functions
Integrated methods for optimization
머피의 머신러닝 13 Sparse Linear Model
NEW NON-COPRIME CONJUGATE-PAIR BINARY TO RNS MULTI-MODULI FOR RESIDUE NUMBER ...
Amelioration of Modeling and Solving the Weighted Constraint Satisfaction Pro...
16 Machine Learning Universal Approximation Multilayer Perceptron
Limits of Computation
11.[8 17]numerical solution of fuzzy hybrid differential equation by third or...
KDD Poster Nurjahan Begum
Numerical solution of fuzzy hybrid differential equation by third order runge...
11.numerical solution of fuzzy hybrid differential equation by third order ru...
Permutations and Combinations IIT JEE+Olympiad Lecture 3
Ad

Similar to Brief journey in the big world of Integer Programming with the Knapsack (20)

PPT
Knapsack problem using fixed tuple
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
PPT
lecture 27
PPTX
UNIT V.pptx
PPTX
0/1 DYNAMIC PROGRAMMING KNAPSACK PROBLEM
PDF
Lesson 19: Optimization Problems
PPT
Optimization problems
PDF
Algorithm chapter 10
PPTX
Dynamic programming
PPTX
Knapsack problem using greedy approach
PDF
P, NP, NP-Hard & NP-complete problems, Optimization
PPT
Knapsack prooblem using greedy based algoithm
PPT
Elak1 greedy presentation for design and analysis of algorithms.ppt
PPTX
Knapsack Problem (DP & GREEDY)
PDF
A New Lagrangian Relaxation Approach To The Generalized Assignment Problem
Knapsack problem using fixed tuple
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
lecture 27
UNIT V.pptx
0/1 DYNAMIC PROGRAMMING KNAPSACK PROBLEM
Lesson 19: Optimization Problems
Optimization problems
Algorithm chapter 10
Dynamic programming
Knapsack problem using greedy approach
P, NP, NP-Hard & NP-complete problems, Optimization
Knapsack prooblem using greedy based algoithm
Elak1 greedy presentation for design and analysis of algorithms.ppt
Knapsack Problem (DP & GREEDY)
A New Lagrangian Relaxation Approach To The Generalized Assignment Problem
Ad

More from 🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬 (9)

PDF
Parallel Numerical Verification of the σ_odd problem
PDF
An Efficient and Parallel Abstract Interpreter in Scala — 3x3 Parallel Implem...
PDF
An Efficient and Parallel Abstract Interpreter in Scala — First Algorithm
PDF
An Efficient and Parallel Abstract Interpreter in Scala — Second Presentation
PDF
An Efficient and Parallel Abstract Interpreter in Scala — Presentation
PDF
An Efficient and Parallel Abstract Interpreter in Scala — Preparatory Work — ...
Parallel Numerical Verification of the σ_odd problem
An Efficient and Parallel Abstract Interpreter in Scala — 3x3 Parallel Implem...
An Efficient and Parallel Abstract Interpreter in Scala — First Algorithm
An Efficient and Parallel Abstract Interpreter in Scala — Second Presentation
An Efficient and Parallel Abstract Interpreter in Scala — Presentation
An Efficient and Parallel Abstract Interpreter in Scala — Preparatory Work — ...

Recently uploaded (20)

PPT
protein biochemistry.ppt for university classes
PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
PPTX
Cell Membrane: Structure, Composition & Functions
PPTX
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
PPT
POSITIONING IN OPERATION THEATRE ROOM.ppt
PDF
An interstellar mission to test astrophysical black holes
PDF
The scientific heritage No 166 (166) (2025)
PPTX
2Systematics of Living Organisms t-.pptx
PPTX
7. General Toxicologyfor clinical phrmacy.pptx
PPTX
TOTAL hIP ARTHROPLASTY Presentation.pptx
PPTX
BIOMOLECULES PPT........................
PDF
. Radiology Case Scenariosssssssssssssss
PPTX
famous lake in india and its disturibution and importance
PPTX
2. Earth - The Living Planet earth and life
PDF
bbec55_b34400a7914c42429908233dbd381773.pdf
PDF
Placing the Near-Earth Object Impact Probability in Context
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
PDF
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
PPTX
Classification Systems_TAXONOMY_SCIENCE8.pptx
PDF
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
protein biochemistry.ppt for university classes
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
Cell Membrane: Structure, Composition & Functions
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
POSITIONING IN OPERATION THEATRE ROOM.ppt
An interstellar mission to test astrophysical black holes
The scientific heritage No 166 (166) (2025)
2Systematics of Living Organisms t-.pptx
7. General Toxicologyfor clinical phrmacy.pptx
TOTAL hIP ARTHROPLASTY Presentation.pptx
BIOMOLECULES PPT........................
. Radiology Case Scenariosssssssssssssss
famous lake in india and its disturibution and importance
2. Earth - The Living Planet earth and life
bbec55_b34400a7914c42429908233dbd381773.pdf
Placing the Near-Earth Object Impact Probability in Context
Taita Taveta Laboratory Technician Workshop Presentation.pptx
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
Classification Systems_TAXONOMY_SCIENCE8.pptx
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf

Brief journey in the big world of Integer Programming with the Knapsack

  • 1. Brief journey in the big world of Integer Programming with the Knapsack Olivier Pirson Presentation for the oral exam of INFO-F424 Combinatorial optimization Computer Science Department Université Libre de Bruxelles June 1st , 2017 (Cosmetic correction November 26, 2017) Last version: https://bitbucket.org/OPiMedia/ brief-journey-in-the-big-world-of-integer-programming-with-the/
  • 2. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References 1 Problem 2 Primal and dual bounds 3 Branch and Bound 4 References Brief journey. . . with the Knapsack 2 / 13
  • 3. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References 0 − 1 Knapsack Problem formulation Let a set of n items, for each i ∈ {1, 2, . . . , n} a weight ai a value ci a knapsack of capacity b Find the subset of {1, 2, . . . , n} that it may be contained in the knapsack and maximizes the value. The canonical Binary Integer Program formulation: Variables: xi ∈ {0, 1}, xi = 1 if item i is selected 0 otherwise Constraint: n i=1 ai xi ≤ b Objective function: max n i=1 ci xi Brief journey. . . with the Knapsack 3 / 13
  • 4. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References 1 Problem 2 Primal and dual bounds 3 Branch and Bound 4 References Brief journey. . . with the Knapsack 4 / 13
  • 5. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References Greedy heuristic algorithm – primal/lower bound Sort variables by decreasing order of density value weight : ci ai In this order, pick each possible item. That fill the knapsack with the best independent choice. For example: max 45x1 + 48x2 + 9x3 subject to 5x1 + 12x2 + 3x3 ≤ 16 density 9 4 3 Give the solution: (1, 0, 1) with value 45 + 9 = 54. 54 is a lower bound of the problem. Indeed (0, 1, 1) is a better solution (in fact the optimal solution 1 ) of value 48 + 9 = 57. 1 In simple example like this it is very easy to perform an exhaustive search. Brief journey. . . with the Knapsack 5 / 13
  • 6. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References Linear relaxation – dual/upper bound The idea is to permit piece of item, and then fill completely the knapsack. Of course the relaxed problem is an other problem and its solution is not a solution of the initial problem. But this solution is an upper bound for the initial problem. With the same example: max 45x1 + 48x2 + 9x3 subject to 5x1 + 12x2 + 3x3 ≤ 16 and now xi ∈ [0, 1] instead ∈ {0, 1} 5 + α12 = 16 =⇒ α = 11 12 Give (1, 11 12 , 0) with value 45 + 11 12 48 = 89. We known now that the optimal solution x⋆ of the initial problem is such that: 54 ≤ x⋆ ≤ 89 We obtained theses two bound in O(n). Brief journey. . . with the Knapsack 6 / 13
  • 7. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References General principle of relaxation For the Integer Programming z = max{c(x) | x ∈ X ⊆ Rn } zR = max{f (x) | x ∈ T ⊆ Rn } is a relaxation if X ⊆ T c(x) ≤ f (x) ∀x ∈ X So zR is an upper bound for the initial problem. Brief journey. . . with the Knapsack 7 / 13
  • 8. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References 1 Problem 2 Primal and dual bounds 3 Branch and Bound 4 References Brief journey. . . with the Knapsack 8 / 13
  • 9. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References Exhaustive search We can break the problem into two subproblems, and so forth. That give this kind of binary tree representation: Figure: Discrete Optimization Brief journey. . . with the Knapsack 9 / 13
  • 10. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References Contain the Exponential Explosion There is 2n possibilities, so an exhaustive search is quickly impossible. In fact, it is a NP-hard problem. (The decision problem is already NP-complete.) The goal is to push as far as possible the exponential curve. Figure: Discrete Optimization How avoid the impossible (in practice) exhaustive search? Brief journey. . . with the Knapsack 10 / 13
  • 11. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References Depth-First Branch and Bound Pruning. . . Figure: Discrete Optimization We have the optimal solution 80 with only 7 nodes visited, instead 24 − 1 = 15. Brief journey. . . with the Knapsack 11 / 13
  • 12. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References 1 Problem 2 Primal and dual bounds 3 Branch and Bound 4 References Brief journey. . . with the Knapsack 12 / 13
  • 13. Brief journey. . . with the Knapsack Problem Primal and dual bounds Branch and Bound References References References: Pascal Van Hentenryck. Discrete Optimization. MOOC, University of Melbourne, https://www.coursera.org/learn/discrete-optimization Laurence A. Wolsey. Integer Programming. Wiley, 1998 NP-Complete, xkcd Brief journey. . . with the Knapsack 13 / 13