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

What's hot (20)

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

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

PPT
Optimization problems
Ruchika Sinha
 
PPT
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
KartikGupta711
 
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
dakccse
 
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
BinayakMukherjee4
 
PPT
Knapsack problem using fixed tuple
Mohanlal Sukhadia University (MLSU)
 
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
AmitBhola17
 
PPT
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
ZeelGoyani
 
PDF
heuristic search Techniques and game playing.pdf
vijeta3feb
 
PPT
01 knapsack using backtracking
mandlapure
 
PDF
Backtracking & branch and bound
Vipul Chauhan
 
PPT
Branch and bound
Dr Shashikant Athawale
 
PPTX
Branch and bound method
VidhyaSenthil
 
PPT
Backtracking
Vikas Sharma
 
PPT
Unit-2 Branch & Bound Design of Algorithms.ppt
HarjotDhillon8
 
PPTX
Algorithms Design Patterns
Ashwin Shiv
 
PDF
Integer programming branch and bound
Alejandro Angulo
 
PDF
Branch and bound technique
ishmecse13
 
PPT
Dynamic Programming for 4th sem cse students
DeepakGowda357858
 
PPT
0/1 knapsack
Amin Omi
 
PDF
module5_backtrackingnbranchnbound_2022.pdf
Shiwani Gupta
 
Optimization problems
Ruchika Sinha
 
fdocuments.in_branch-and-bound-design-and-analysis-of-alogorithm.ppt
KartikGupta711
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
dakccse
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
BinayakMukherjee4
 
Knapsack problem using fixed tuple
Mohanlal Sukhadia University (MLSU)
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
AmitBhola17
 
Parallel_Algorithms_In_Combinatorial_Optimization_Problems.ppt
ZeelGoyani
 
heuristic search Techniques and game playing.pdf
vijeta3feb
 
01 knapsack using backtracking
mandlapure
 
Backtracking & branch and bound
Vipul Chauhan
 
Branch and bound
Dr Shashikant Athawale
 
Branch and bound method
VidhyaSenthil
 
Backtracking
Vikas Sharma
 
Unit-2 Branch & Bound Design of Algorithms.ppt
HarjotDhillon8
 
Algorithms Design Patterns
Ashwin Shiv
 
Integer programming branch and bound
Alejandro Angulo
 
Branch and bound technique
ishmecse13
 
Dynamic Programming for 4th sem cse students
DeepakGowda357858
 
0/1 knapsack
Amin Omi
 
module5_backtrackingnbranchnbound_2022.pdf
Shiwani Gupta
 
Ad

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

PDF
Parallel Numerical Verification of the σ_odd problem
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
PDF
An Efficient and Parallel Abstract Interpreter in Scala — 3x3 Parallel Implem...
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
PDF
An Efficient and Parallel Abstract Interpreter in Scala — First Algorithm
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
PDF
An Efficient and Parallel Abstract Interpreter in Scala — Second Presentation
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
PDF
An Efficient and Parallel Abstract Interpreter in Scala — Presentation
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
PDF
An Efficient and Parallel Abstract Interpreter in Scala — Preparatory Work — ...
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
Parallel Numerical Verification of the σ_odd problem
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
An Efficient and Parallel Abstract Interpreter in Scala — 3x3 Parallel Implem...
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
An Efficient and Parallel Abstract Interpreter in Scala — First Algorithm
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
An Efficient and Parallel Abstract Interpreter in Scala — Second Presentation
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
An Efficient and Parallel Abstract Interpreter in Scala — Presentation
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
An Efficient and Parallel Abstract Interpreter in Scala — Preparatory Work — ...
🌳 Olivier Pirson — OPi 🇧🇪🇫🇷🇬🇧 🐧 👨‍💻 👨‍🔬
 
Ad

Recently uploaded (20)

PDF
Webinar: World's Smallest Pacemaker
Scintica Instrumentation
 
PDF
Plant growth promoting bacterial non symbiotic
psuvethapalani
 
PPTX
CNS.pptx Central nervous system meninges ventricles of brain it's structure a...
Ashwini I Chuncha
 
PDF
GUGC Research Overview (December 2024)
Ghent University Global Campus
 
PDF
2025 Insilicogen Company English Brochure
Insilico Gen
 
PDF
Thermal stratification in lakes-J. Bovas Joel.pdf
J. Bovas Joel BFSc
 
PDF
2025 Insilicogen Company Korean Brochure
Insilico Gen
 
PDF
The scientific heritage No 163 (163) (2025)
The scientific heritage
 
DOCX
Analytical methods in CleaningValidation.docx
Markus Janssen
 
PPTX
Systamatic Acquired Resistence (SAR).pptx
giriprasanthmuthuraj
 
PDF
A High-Caliber View of the Bullet Cluster through JWST Strong and Weak Lensin...
Sérgio Sacani
 
DOCX
Paper - Suprasegmental Features (Makalah Presentasi)
Sahmiral Amri Rajagukguk
 
PDF
Asthamudi lake and its fisheries&importance .pdf
J. Bovas Joel BFSc
 
PDF
The emergence of galactic thin and thick discs across cosmic history
Sérgio Sacani
 
PDF
Historical Knowledge Bases with Semantic MediaWiki
BernhardKrabina
 
PDF
Carbonate formation and fluctuating habitability on Mars
Sérgio Sacani
 
DOCX
Critical Book Review (CBR) - "Hate Speech: Linguistic Perspectives"
Sahmiral Amri Rajagukguk
 
PDF
History of cage culture-J. Bovas Joel.pdf
J. Bovas Joel BFSc
 
PDF
Rapid protoplanet formation in the outer Solar System recorded in a dunite fr...
Sérgio Sacani
 
PDF
Calcium in a supernova remnant as a fingerprint of a sub-Chandrasekhar-mass e...
Sérgio Sacani
 
Webinar: World's Smallest Pacemaker
Scintica Instrumentation
 
Plant growth promoting bacterial non symbiotic
psuvethapalani
 
CNS.pptx Central nervous system meninges ventricles of brain it's structure a...
Ashwini I Chuncha
 
GUGC Research Overview (December 2024)
Ghent University Global Campus
 
2025 Insilicogen Company English Brochure
Insilico Gen
 
Thermal stratification in lakes-J. Bovas Joel.pdf
J. Bovas Joel BFSc
 
2025 Insilicogen Company Korean Brochure
Insilico Gen
 
The scientific heritage No 163 (163) (2025)
The scientific heritage
 
Analytical methods in CleaningValidation.docx
Markus Janssen
 
Systamatic Acquired Resistence (SAR).pptx
giriprasanthmuthuraj
 
A High-Caliber View of the Bullet Cluster through JWST Strong and Weak Lensin...
Sérgio Sacani
 
Paper - Suprasegmental Features (Makalah Presentasi)
Sahmiral Amri Rajagukguk
 
Asthamudi lake and its fisheries&importance .pdf
J. Bovas Joel BFSc
 
The emergence of galactic thin and thick discs across cosmic history
Sérgio Sacani
 
Historical Knowledge Bases with Semantic MediaWiki
BernhardKrabina
 
Carbonate formation and fluctuating habitability on Mars
Sérgio Sacani
 
Critical Book Review (CBR) - "Hate Speech: Linguistic Perspectives"
Sahmiral Amri Rajagukguk
 
History of cage culture-J. Bovas Joel.pdf
J. Bovas Joel BFSc
 
Rapid protoplanet formation in the outer Solar System recorded in a dunite fr...
Sérgio Sacani
 
Calcium in a supernova remnant as a fingerprint of a sub-Chandrasekhar-mass e...
Sérgio Sacani
 

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