Unlocking the Power of Integer Programming

Florian Wilhelm
Unlocking the Power of
Integer Programming
Data Analytics & Science
Mathematical Modelling
Modern Data Warehousing & Analytics
Personalisation & RecSys
Uncertainty Quantification & Causality
Python Data Stack
OSS Contributor & Creator of PyScaffold
Dr. Florian Wilhelm
• HEAD OF DATA SCIENCE
FlorianWilhelm.info
florian.wilhelm@inovex.de
FlorianWilhelm
@FlorianWilhelm
2
‣ Application Development (Web Platforms, Mobile
Apps, Smart Devices and Robotics, UI/UX design,
Backend Services)
‣ Data Management and Analytics (Business
Intelligence, Big Data, Searches, Data Science
and Deep Learning, Machine Perception and
Artificial Intelligence)
‣ Scalable IT-Infrastructures (IT Engineering, Cloud
Services, DevOps, Replatforming, Security)
‣ Training and Coaching (inovex Academy)
is an innovation and quality-driven
IT project house with a focus on
digital transformation.
Using technology to
inspire our clients.
And ourselves.
Berlin · Karlsruhe · Pforzheim · Stuttgart · München · Köln · Hamburg · Erlangen
www.inovex.de
3
Definition:
The objective of Operations Research (OR) is the
development and use of mathematical methods to support
decision-making processes in domains such as
manufacturing or finance.
Operations Research
Introduction
4
● Assignment/Allocation Problem
How to schedule some talks in an agenda under some
constraints like room sizes to optimize the conference
experience?
● Transportation Problem
Which supplier should deliver to which factories given some
costs to satisfy each factory with minimal costs?
● Shortest Path Problem
Given some graph with a cost on each edge, what is the
shortest path from source to sink?
● Maximum Flow Problem
Given some pipe system with a source and sink, what is the
maximum flow through the system?
Common Problem Classes in Operations Research
Introduction
5
Definition of Linear Programming (LP)
Introduction
6
LPs can be solved with the Simplex algorithm in cubic on average
but exponential number of steps in worst case scenario or interior
point methods in about .
Definition of Mixed Integer Programming (MIP)
Introduction
7
MIPs are NP-hard, i.e. complexity grows exponentially with n
Dropping the integrality constraints, i.e. "linear relaxation", leads to
an LP problem.
If all variables need to be integer, it is a (pure)
integer linear program (ILP, IP).
If all variables need to be 0 or 1 (binary, boolean), it is a
0 - 1 linear program.
Special Cases of Mixed Integer Programming
Introduction
8
Given a set of items, each with a weight and a value,
determine which items to include in the collection so that the
total weight is less than or equal to a given limit and the
total value is as large as possible.
- Wikipedia
Knapsack problem
Introduction
9
10
Solving a MILP
Introduction
Dropping the integrality constraints, i.e. “linear relaxation”, leads to an LP problem.
Two major method classes for solving MILPs:
● Cutting plane methods
● Branch and bound methods
Often combined as Branch and Cut methods
Source: Introduction to Optimization by Laurent Lessard, Spring 2017–18
Cutting Planes
Cutting Planes Methods
Introduction
11
Idea
● solve the LP relaxation problem
● while solution is not integral:
○ add constraint that excludes solution but no integer points
○ solve LP relaxation again
Cutting Planes Methods
Introduction
12
Optimal point
Feasible point
Infeasible point
0
1
2
3
1 2 3
0
Optimal solution is 4 at (2, 2)
Cutting Planes Methods
Introduction
13
0
1
2
3
1 2 3
0
Optimal solution is 4.5 at (2, 2.5)
● Relaxing the problem and solving the LP instead of MIP
● The LP solution is always an upper bound for the MIP
Cutting Planes Methods
Introduction
14
0
1
2
3
1 2 3
0
Optimal solution is 4.16 at (2.16, 2)
● Add a cut to exclude the LP solution but no feasible
point
● Solve the LP again
● … repeat until LP solution is also an MIP solution
Cutting Planes Methods
Introduction
15
0
1
2
3
1 2 3
0
Optimal solution is 4 at (2, 2)
Branch & Bound
Branch & Bound Methods
Introduction
16
Idea
1. solve the relaxed LP and for a fractional split into two
subproblems
○ with constraint
○ and with constraint
2. repeat step 1. and build a tree of subproblems
3. eliminate branches of the tree using
How can we use MILPs for a
Conference Scheduling?
Use-Case
17
Monday Room 1 Room 2 …
Morning
Afternoon
A
B
C
D
A
B
C
D
● each talk must be assigned exactly once,
● each room/timeslot combination can only be occupied by
one talk at most,
● the length of the timeslot must match the length of the talk
● some tutorials have part 1 & 2, thus need to be consecutive
What Constraints do we have?
Use-Case
18
1. the preferences for day and time of some speakers, e.g.
keynotes, need to be considered
2.popularity of a talk should be reflected in the room
capacity,
3.avoid parallel talks that attract the same audience,
4.have in the same session, i.e. consecutive block of talks, the
same main track, e.g. PyData vs. PyCon,
5.or even the same sub track, e.g. PyData: Data Handling,
What is our objective?
Use-Case
19
Precedence: 1 > 2 > 3 > 4 > 5
1. Framework to formulate the problem, e.g.
a.Pyomo (OSS)
b.PuLP (OSS)
c.AMPL (Commercial)
d.…
2.Solver to solve the canonical problem, e.g.
a.HiGHS (OSS)
b.CBC (OSS)
c.Gurobi (Commercial)
d.IBM CPlex (Commercial)
e.…
Solving MILPs in Python
Use-Case
20
Pyomo: Index Sets
Use-Case
21
Pyomo: Parameters
Use-Case
22
Pyomo: Variables
Use-Case
23
Pyomo: Constraints
Use-Case
24
Pyomo: Objective
Use-Case
25
Solving the MILP Problem and Displaying model.vBScheduleSchedule
Use-Case
26
Pyomo / HiGHS notebook:
https://github.com/FlorianWilhelm/pytanis/blob/main/notebooks/pyconde-pydata-berlin-2023/50_scheduling_v1.ipynb
Check out the Full Source Code
Use-Case
27
Pytanis includes a Pretalx client and all
the tooling you need for conferences
using Pretalx, from handling the initial
call for papers to creating the final
program.
Looks easy enough! But is it really?
Remarks
28
m_caps_dict.keys(), ordered=True)
The Absolute Value is not linear!
Modelling the Absolute Value
Remarks
29
0
1
2
3
1 2 3
-1
-2
-3
m_caps_dict.keys(), ordered=True)
To model in the objective, we introduce auxiliary variables:
Modelling the Absolute Value
Remarks
30
1
2
3
1 2 3
1. MILPs are an important tool in the domain of
Operations Research
2.Many optimal decision use-cases can be formulated
mathematically as a MILP, e.g. Knapsack problem
3.Solving a (M)ILP is NP-hard but good heuristics methods
exists like Branch & Cut
4.Tools like Pyomo translate your problem in a standardized
form and solver like HiGHS solve it
5.Modelling a problem as MILP, especially the Linearity
requirement, is the hardest part
Main Take-Aways
Summary
31
● Introduction to Optimization by
Laurent Lessard
● Mixed Integer Programming for
time table scheduling by Francisco
Espiga
● Schedule Optimisation using Linear
Programming in Python by Lewis
Woolfson
● Some icons taken from
Flaticon.com
References
Summary
32
© 2023
Thank you!
Dr. Florian Wilhelm
Head of Data Science
EuroPython 2023
inovex.de
florian.wilhelm@inovex.de
@inovexlife
@inovexgmbh
waldstack.org
33
1 von 33

Recomendados

A Decomposition Technique For Solving Integer Programming Problems von
A Decomposition Technique For Solving Integer Programming ProblemsA Decomposition Technique For Solving Integer Programming Problems
A Decomposition Technique For Solving Integer Programming ProblemsCarrie Romero
2 views11 Folien
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F... von
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...Allison Thompson
3 views8 Folien
Applying Transformation Characteristics to Solve the Multi Objective Linear F... von
Applying Transformation Characteristics to Solve the Multi Objective Linear F...Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...AIRCC Publishing Corporation
38 views8 Folien
Constraint programming von
Constraint programmingConstraint programming
Constraint programmingJoseph Mathew
260 views5 Folien
“An Industry Standard Performance Benchmark Suite for Machine Learning,” a Pr... von
“An Industry Standard Performance Benchmark Suite for Machine Learning,” a Pr...“An Industry Standard Performance Benchmark Suite for Machine Learning,” a Pr...
“An Industry Standard Performance Benchmark Suite for Machine Learning,” a Pr...Edge AI and Vision Alliance
844 views43 Folien
A (Not So Short) Introduction to CP Optimizer for Scheduling von
A (Not So Short) Introduction to CP Optimizer for SchedulingA (Not So Short) Introduction to CP Optimizer for Scheduling
A (Not So Short) Introduction to CP Optimizer for SchedulingPhilippe Laborie
19.6K views244 Folien

Más contenido relacionado

Similar a Unlocking the Power of Integer Programming

Applying Transformation Characteristics to Solve the Multi Objective Linear F... von
Applying Transformation Characteristics to Solve the Multi Objective Linear F...Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...AIRCC Publishing Corporation
106 views8 Folien
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F... von
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...ijcsit
24 views8 Folien
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A... von
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...Erica Thompson
2 views8 Folien
Prespective analytics with DOcplex and pandas von
Prespective analytics with DOcplex and pandasPrespective analytics with DOcplex and pandas
Prespective analytics with DOcplex and pandasPyDataParis
112 views34 Folien
Packing Problems Using Gurobi von
Packing Problems Using GurobiPacking Problems Using Gurobi
Packing Problems Using GurobiTerrance Smith
498 views12 Folien
QA CHAPTER II.pptx von
QA CHAPTER II.pptxQA CHAPTER II.pptx
QA CHAPTER II.pptxTeshome48
17 views105 Folien

Similar a Unlocking the Power of Integer Programming(20)

APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F... von ijcsit
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...
APPLYING TRANSFORMATION CHARACTERISTICS TO SOLVE THE MULTI OBJECTIVE LINEAR F...
ijcsit24 views
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A... von Erica Thompson
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...
Erica Thompson2 views
Prespective analytics with DOcplex and pandas von PyDataParis
Prespective analytics with DOcplex and pandasPrespective analytics with DOcplex and pandas
Prespective analytics with DOcplex and pandas
PyDataParis112 views
QA CHAPTER II.pptx von Teshome48
QA CHAPTER II.pptxQA CHAPTER II.pptx
QA CHAPTER II.pptx
Teshome4817 views
“Programação paralela híbrida com MPI e OpenMP – uma abordagem prática”. Edua... von lccausp
“Programação paralela híbrida com MPI e OpenMP – uma abordagem prática”. Edua...“Programação paralela híbrida com MPI e OpenMP – uma abordagem prática”. Edua...
“Programação paralela híbrida com MPI e OpenMP – uma abordagem prática”. Edua...
lccausp607 views
Efficient Deep Learning in Natural Language Processing Production, with Moshe... von Seth Grimes
Efficient Deep Learning in Natural Language Processing Production, with Moshe...Efficient Deep Learning in Natural Language Processing Production, with Moshe...
Efficient Deep Learning in Natural Language Processing Production, with Moshe...
Seth Grimes440 views
CP Optimizer pour la planification et l'ordonnancement von Philippe Laborie
CP Optimizer pour la planification et l'ordonnancementCP Optimizer pour la planification et l'ordonnancement
CP Optimizer pour la planification et l'ordonnancement
Philippe Laborie944 views
Dynamic programming prasintation eaisy von ahmed51236
Dynamic programming prasintation eaisyDynamic programming prasintation eaisy
Dynamic programming prasintation eaisy
ahmed51236396 views
chapter-04(Computational Thinking).pptx von ssuserf60ff6
chapter-04(Computational Thinking).pptxchapter-04(Computational Thinking).pptx
chapter-04(Computational Thinking).pptx
ssuserf60ff69 views
Thomas Wolf "Transfer learning in NLP" von Fwdays
Thomas Wolf "Transfer learning in NLP"Thomas Wolf "Transfer learning in NLP"
Thomas Wolf "Transfer learning in NLP"
Fwdays2K views
Solving Industrial Scheduling Problems with Constraint Programming von Philippe Laborie
Solving Industrial Scheduling Problems with Constraint ProgrammingSolving Industrial Scheduling Problems with Constraint Programming
Solving Industrial Scheduling Problems with Constraint Programming
Philippe Laborie3.1K views
Convex optmization in communications von Deepshika Reddy
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communications
Deepshika Reddy2.1K views

Más de Florian Wilhelm

WALD: A Modern & Sustainable Analytics Stack von
WALD: A Modern & Sustainable Analytics StackWALD: A Modern & Sustainable Analytics Stack
WALD: A Modern & Sustainable Analytics StackFlorian Wilhelm
168 views40 Folien
Forget about AI and do Mathematical Modelling instead! von
Forget about AI and do Mathematical Modelling instead!Forget about AI and do Mathematical Modelling instead!
Forget about AI and do Mathematical Modelling instead!Florian Wilhelm
427 views40 Folien
An Interpretable Model for Collaborative Filtering Using an Extended Latent D... von
An Interpretable Model for Collaborative Filtering Using an Extended Latent D...An Interpretable Model for Collaborative Filtering Using an Extended Latent D...
An Interpretable Model for Collaborative Filtering Using an Extended Latent D...Florian Wilhelm
103 views19 Folien
Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar... von
Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar...Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar...
Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar...Florian Wilhelm
340 views36 Folien
Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L... von
Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L...Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L...
Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L...Florian Wilhelm
155 views11 Folien
Uncertainty Quantification in AI von
Uncertainty Quantification in AIUncertainty Quantification in AI
Uncertainty Quantification in AIFlorian Wilhelm
2.3K views55 Folien

Más de Florian Wilhelm(15)

WALD: A Modern & Sustainable Analytics Stack von Florian Wilhelm
WALD: A Modern & Sustainable Analytics StackWALD: A Modern & Sustainable Analytics Stack
WALD: A Modern & Sustainable Analytics Stack
Florian Wilhelm168 views
Forget about AI and do Mathematical Modelling instead! von Florian Wilhelm
Forget about AI and do Mathematical Modelling instead!Forget about AI and do Mathematical Modelling instead!
Forget about AI and do Mathematical Modelling instead!
Florian Wilhelm427 views
An Interpretable Model for Collaborative Filtering Using an Extended Latent D... von Florian Wilhelm
An Interpretable Model for Collaborative Filtering Using an Extended Latent D...An Interpretable Model for Collaborative Filtering Using an Extended Latent D...
An Interpretable Model for Collaborative Filtering Using an Extended Latent D...
Florian Wilhelm103 views
Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar... von Florian Wilhelm
Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar...Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar...
Honey I Shrunk the Target Variable! Common pitfalls when transforming the tar...
Florian Wilhelm340 views
Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L... von Florian Wilhelm
Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L...Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L...
Matrix Factorization for Collaborative Filtering Is Just Solving an Adjoint L...
Florian Wilhelm155 views
Uncertainty Quantification in AI von Florian Wilhelm
Uncertainty Quantification in AIUncertainty Quantification in AI
Uncertainty Quantification in AI
Florian Wilhelm2.3K views
Performance evaluation of GANs in a semisupervised OCR use case von Florian Wilhelm
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use case
Florian Wilhelm1.8K views
Bridging the Gap: from Data Science to Production von Florian Wilhelm
Bridging the Gap: from Data Science to ProductionBridging the Gap: from Data Science to Production
Bridging the Gap: from Data Science to Production
Florian Wilhelm1.3K views
How mobile.de brings Data Science to Production for a Personalized Web Experi... von Florian Wilhelm
How mobile.de brings Data Science to Production for a Personalized Web Experi...How mobile.de brings Data Science to Production for a Personalized Web Experi...
How mobile.de brings Data Science to Production for a Personalized Web Experi...
Florian Wilhelm701 views
Deep Learning-based Recommendations for Germany's Biggest Vehicle Marketplace von Florian Wilhelm
Deep Learning-based Recommendations for Germany's Biggest Vehicle MarketplaceDeep Learning-based Recommendations for Germany's Biggest Vehicle Marketplace
Deep Learning-based Recommendations for Germany's Biggest Vehicle Marketplace
Florian Wilhelm1.3K views
Deep Learning-based Recommendations for Germany's Biggest Online Vehicle Mark... von Florian Wilhelm
Deep Learning-based Recommendations for Germany's Biggest Online Vehicle Mark...Deep Learning-based Recommendations for Germany's Biggest Online Vehicle Mark...
Deep Learning-based Recommendations for Germany's Biggest Online Vehicle Mark...
Florian Wilhelm755 views
Declarative Thinking and Programming von Florian Wilhelm
Declarative Thinking and ProgrammingDeclarative Thinking and Programming
Declarative Thinking and Programming
Florian Wilhelm818 views
Which car fits my life? - PyData Berlin 2017 von Florian Wilhelm
Which car fits my life? - PyData Berlin 2017Which car fits my life? - PyData Berlin 2017
Which car fits my life? - PyData Berlin 2017
Florian Wilhelm566 views
Explaining the idea behind automatic relevance determination and bayesian int... von Florian Wilhelm
Explaining the idea behind automatic relevance determination and bayesian int...Explaining the idea behind automatic relevance determination and bayesian int...
Explaining the idea behind automatic relevance determination and bayesian int...
Florian Wilhelm9.8K views

Último

[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks von
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks
[DSC Europe 23] Aleksandar Tomcic - Adversarial AttacksDataScienceConferenc1
5 views20 Folien
Short Story Assignment by Kelly Nguyen von
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyenkellynguyen01
19 views17 Folien
Advanced_Recommendation_Systems_Presentation.pptx von
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptxneeharikasingh29
5 views9 Folien
Organic Shopping in Google Analytics 4.pdf von
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdfGA4 Tutorials
16 views13 Folien
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo... von
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...DataScienceConferenc1
6 views77 Folien
VoxelNet von
VoxelNetVoxelNet
VoxelNettaeseon ryu
16 views21 Folien

Último(20)

Short Story Assignment by Kelly Nguyen von kellynguyen01
Short Story Assignment by Kelly NguyenShort Story Assignment by Kelly Nguyen
Short Story Assignment by Kelly Nguyen
kellynguyen0119 views
Advanced_Recommendation_Systems_Presentation.pptx von neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
Organic Shopping in Google Analytics 4.pdf von GA4 Tutorials
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdf
GA4 Tutorials16 views
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo... von DataScienceConferenc1
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
[DSC Europe 23][DigiHealth] Muthu Ramachandran AI and Blockchain Framework fo...
Product Research sample.pdf von AllenSingson
Product Research sample.pdfProduct Research sample.pdf
Product Research sample.pdf
AllenSingson29 views
Data Journeys Hard Talk workshop final.pptx von info828217
Data Journeys Hard Talk workshop final.pptxData Journeys Hard Talk workshop final.pptx
Data Journeys Hard Talk workshop final.pptx
info82821710 views
Ukraine Infographic_22NOV2023_v2.pdf von AnastosiyaGurin
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdf
AnastosiyaGurin1.4K views
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int... von DataScienceConferenc1
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx von DataScienceConferenc1
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an... von StatsCommunications
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
4_4_WP_4_06_ND_Model.pptx von d6fmc6kwd4
4_4_WP_4_06_ND_Model.pptx4_4_WP_4_06_ND_Model.pptx
4_4_WP_4_06_ND_Model.pptx
d6fmc6kwd47 views
CRM stick or twist workshop von info828217
CRM stick or twist workshopCRM stick or twist workshop
CRM stick or twist workshop
info82821712 views
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation von DataScienceConferenc1
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
Dr. Ousmane Badiane-2023 ReSAKSS Conference von AKADEMIYA2063
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceDr. Ousmane Badiane-2023 ReSAKSS Conference
Dr. Ousmane Badiane-2023 ReSAKSS Conference
AKADEMIYA20635 views
[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf von DataScienceConferenc1
[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf
[DSC Europe 23] Ales Gros - Quantum and Today s security with Quantum.pdf

Unlocking the Power of Integer Programming

  • 1. Florian Wilhelm Unlocking the Power of Integer Programming Data Analytics & Science
  • 2. Mathematical Modelling Modern Data Warehousing & Analytics Personalisation & RecSys Uncertainty Quantification & Causality Python Data Stack OSS Contributor & Creator of PyScaffold Dr. Florian Wilhelm • HEAD OF DATA SCIENCE FlorianWilhelm.info florian.wilhelm@inovex.de FlorianWilhelm @FlorianWilhelm 2
  • 3. ‣ Application Development (Web Platforms, Mobile Apps, Smart Devices and Robotics, UI/UX design, Backend Services) ‣ Data Management and Analytics (Business Intelligence, Big Data, Searches, Data Science and Deep Learning, Machine Perception and Artificial Intelligence) ‣ Scalable IT-Infrastructures (IT Engineering, Cloud Services, DevOps, Replatforming, Security) ‣ Training and Coaching (inovex Academy) is an innovation and quality-driven IT project house with a focus on digital transformation. Using technology to inspire our clients. And ourselves. Berlin · Karlsruhe · Pforzheim · Stuttgart · München · Köln · Hamburg · Erlangen www.inovex.de 3
  • 4. Definition: The objective of Operations Research (OR) is the development and use of mathematical methods to support decision-making processes in domains such as manufacturing or finance. Operations Research Introduction 4
  • 5. ● Assignment/Allocation Problem How to schedule some talks in an agenda under some constraints like room sizes to optimize the conference experience? ● Transportation Problem Which supplier should deliver to which factories given some costs to satisfy each factory with minimal costs? ● Shortest Path Problem Given some graph with a cost on each edge, what is the shortest path from source to sink? ● Maximum Flow Problem Given some pipe system with a source and sink, what is the maximum flow through the system? Common Problem Classes in Operations Research Introduction 5
  • 6. Definition of Linear Programming (LP) Introduction 6 LPs can be solved with the Simplex algorithm in cubic on average but exponential number of steps in worst case scenario or interior point methods in about .
  • 7. Definition of Mixed Integer Programming (MIP) Introduction 7 MIPs are NP-hard, i.e. complexity grows exponentially with n Dropping the integrality constraints, i.e. "linear relaxation", leads to an LP problem.
  • 8. If all variables need to be integer, it is a (pure) integer linear program (ILP, IP). If all variables need to be 0 or 1 (binary, boolean), it is a 0 - 1 linear program. Special Cases of Mixed Integer Programming Introduction 8
  • 9. Given a set of items, each with a weight and a value, determine which items to include in the collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. - Wikipedia Knapsack problem Introduction 9
  • 10. 10 Solving a MILP Introduction Dropping the integrality constraints, i.e. “linear relaxation”, leads to an LP problem. Two major method classes for solving MILPs: ● Cutting plane methods ● Branch and bound methods Often combined as Branch and Cut methods Source: Introduction to Optimization by Laurent Lessard, Spring 2017–18
  • 11. Cutting Planes Cutting Planes Methods Introduction 11 Idea ● solve the LP relaxation problem ● while solution is not integral: ○ add constraint that excludes solution but no integer points ○ solve LP relaxation again
  • 12. Cutting Planes Methods Introduction 12 Optimal point Feasible point Infeasible point 0 1 2 3 1 2 3 0 Optimal solution is 4 at (2, 2)
  • 13. Cutting Planes Methods Introduction 13 0 1 2 3 1 2 3 0 Optimal solution is 4.5 at (2, 2.5) ● Relaxing the problem and solving the LP instead of MIP ● The LP solution is always an upper bound for the MIP
  • 14. Cutting Planes Methods Introduction 14 0 1 2 3 1 2 3 0 Optimal solution is 4.16 at (2.16, 2) ● Add a cut to exclude the LP solution but no feasible point ● Solve the LP again ● … repeat until LP solution is also an MIP solution
  • 15. Cutting Planes Methods Introduction 15 0 1 2 3 1 2 3 0 Optimal solution is 4 at (2, 2)
  • 16. Branch & Bound Branch & Bound Methods Introduction 16 Idea 1. solve the relaxed LP and for a fractional split into two subproblems ○ with constraint ○ and with constraint 2. repeat step 1. and build a tree of subproblems 3. eliminate branches of the tree using
  • 17. How can we use MILPs for a Conference Scheduling? Use-Case 17 Monday Room 1 Room 2 … Morning Afternoon A B C D A B C D
  • 18. ● each talk must be assigned exactly once, ● each room/timeslot combination can only be occupied by one talk at most, ● the length of the timeslot must match the length of the talk ● some tutorials have part 1 & 2, thus need to be consecutive What Constraints do we have? Use-Case 18
  • 19. 1. the preferences for day and time of some speakers, e.g. keynotes, need to be considered 2.popularity of a talk should be reflected in the room capacity, 3.avoid parallel talks that attract the same audience, 4.have in the same session, i.e. consecutive block of talks, the same main track, e.g. PyData vs. PyCon, 5.or even the same sub track, e.g. PyData: Data Handling, What is our objective? Use-Case 19 Precedence: 1 > 2 > 3 > 4 > 5
  • 20. 1. Framework to formulate the problem, e.g. a.Pyomo (OSS) b.PuLP (OSS) c.AMPL (Commercial) d.… 2.Solver to solve the canonical problem, e.g. a.HiGHS (OSS) b.CBC (OSS) c.Gurobi (Commercial) d.IBM CPlex (Commercial) e.… Solving MILPs in Python Use-Case 20
  • 26. Solving the MILP Problem and Displaying model.vBScheduleSchedule Use-Case 26
  • 27. Pyomo / HiGHS notebook: https://github.com/FlorianWilhelm/pytanis/blob/main/notebooks/pyconde-pydata-berlin-2023/50_scheduling_v1.ipynb Check out the Full Source Code Use-Case 27 Pytanis includes a Pretalx client and all the tooling you need for conferences using Pretalx, from handling the initial call for papers to creating the final program.
  • 28. Looks easy enough! But is it really? Remarks 28
  • 29. m_caps_dict.keys(), ordered=True) The Absolute Value is not linear! Modelling the Absolute Value Remarks 29 0 1 2 3 1 2 3 -1 -2 -3
  • 30. m_caps_dict.keys(), ordered=True) To model in the objective, we introduce auxiliary variables: Modelling the Absolute Value Remarks 30 1 2 3 1 2 3
  • 31. 1. MILPs are an important tool in the domain of Operations Research 2.Many optimal decision use-cases can be formulated mathematically as a MILP, e.g. Knapsack problem 3.Solving a (M)ILP is NP-hard but good heuristics methods exists like Branch & Cut 4.Tools like Pyomo translate your problem in a standardized form and solver like HiGHS solve it 5.Modelling a problem as MILP, especially the Linearity requirement, is the hardest part Main Take-Aways Summary 31
  • 32. ● Introduction to Optimization by Laurent Lessard ● Mixed Integer Programming for time table scheduling by Francisco Espiga ● Schedule Optimisation using Linear Programming in Python by Lewis Woolfson ● Some icons taken from Flaticon.com References Summary 32
  • 33. © 2023 Thank you! Dr. Florian Wilhelm Head of Data Science EuroPython 2023 inovex.de florian.wilhelm@inovex.de @inovexlife @inovexgmbh waldstack.org 33