SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
NOVEMBER 29, 2019
USING PULP AND SOLVERS FOR BUSINESS ANALYTICS
At MOKA, we build intelligent planning software that allows
organizations to make smarter, faster, strategic decisions.
The Winning Model powers strategic planning for manufacturing business models – from CPG to automotive to industrials.
Ready to go out-of-the box, we tailor the core modules and intelligence engine to a client’s specific business.
Unifies strategic data model,
automates & speeds analysis,
and addresses data gaps
Delivers a lasting organizational
capability. Enterprise-ready, secure &
light-weight for fast deployment
Encode and distribute high-quality
strategy frameworks across your
entire organization
Predictive & prescriptive
analytics drive insights &
evaluate complex scenarios
Descriptive
Analytics
Diagnostic
Analytics
Predictive
Analytics
Prescriptive
Analytics
What happened?
Why did it happen?
What will happen?
How can we make it happen?
INFORMATION
OPTIMIZATION
HINDSIGHT
INSIGHT
FORESIGHT
Value
Difficulty
Source: Gartner
BUSINESS ANALYTICS VALUE LADDER
4
Talk Outline
1
What is Linear
Programming?
2
Using PuLP for Macro
Capacity Planning
3
Python Solver
Landscape
4
Best Practices for Using
Solvers for Analytics
3/31/2017
LINEAR PROGRAMMING
Matrix Form Standard Form
! "#, "%, … = (#"# + (%"% + ⋯
+##"# + +#%"% + ⋯ ≤ -#
+%#"# + +%%"% + ⋯ ≤ -%
+.#"# + +.%"% + ⋯ ≤ -.
…
"# ≥ 0
"% ≥ 0
…
12
3
43 ≤ 5
3 ≥ 6
minimize
subject to
and
Trick #1: negate all the constants to
maximize a function
Trick #2: re-arrange expressions
(e.g., subtract from both sides) to
isolate constant on the right side
Trick #3: add slack/dummy
variables to encode other
relationships, e.g., strict equality
Many tools, including PuLP, can apply
these tricks automatically to allow a
more natural expression
MACRO CAPACITY PLANNING:
BUSINESS QUESTIONS
• Where are the inefficiencies in our supply chain?
• Will we have enough production capacity if
demand grows?
• Is our supply chain positioned to profitably
capture growth opportunities?
• Should we open a new warehouse and/or factory?
If so, where?
With the Winning Model’s Network Strategy Module, Network Planners and CEOs
can evaluate network strategy and investment opportunities instantaneously
3/31/2017
Jupyter Walkthrough
https://github.com/moka-analytics/engineering
Paradigm1 Problem Form Example Use Cases Example Python Packages
Mathematical/Numerical
Linear Programming • Supply chain optimization
• Production planning
• PuLP: interface to linear and mixed-integer solvers
• MIPCL: commercial mixed-integer programming
• GLOP: Google’s LP-only solver
Integer Programming • Minimize interference across
cellular network
• Bus scheduling/Vehicle routing
• “Knapsack” problem
Quadratic Programming • Financial portfolio optimization
• Image/signals processing
• Least-Squares regression
• qpsolvers: unified interface around quadratic solvers
• quadprog: implementation of the Goldfarb/Idnani dual algorithm
Convex Optimization • Training ML models
• Linear/Quadratic are a special
case of Convex
• cvxpy
• cvxopt
Non-Linear Programming • pyOpt
Multi-Paradigm • Pyomo: multi-paradigm interface to multiple solvers
• Google OR-Tools: Google’s operations research tools
• Gurobi: commercial optimizer supporting multiple languages
• SciPy: its optimize package contains numerous solvers
Logical/Constraint
Logic Programming
P(x).
?- Q(x).
• Expert system AI
• Knowledge graph inference
• Natural Language Processing
(NLP)
• logpy (aka kanren)
• PySWIP: SWI-Prolog bridge
• ErgoAI: via a Java bridge
• Pyke: pure Python
Satisfiability Modulo
Theories (SMT)
• Static software analysis
• Program synthesis
• Scheduling
• pySMT: interface to SMT-LIB format supporting all major solvers
• Z3: Microsoft’s SMT solver with support for multiple
• CP-SAT: Google’s constraint programming solver
PYTHON SOLVER LANDSCAPE 1
Not all paradigms shown. Wikipedia is a good resource for exploring various paradigms
∃". $(")
3/31/2017
BEST PRACTICES FOR USING SOLVERS FOR ANALYTICS
Avoid false precision
Support user intuition with
analytics and visualizations
Know when to tradeoff speed
vs. precision
Benchmark optimizers to find
best for your workload
Get creative with elastic
computing resources
Educate users about what’s being
optimized, e.g., assumptions and
limitations
Profile your Python problem
creation code
Don’t be afraid to run a solver
multiple times
KEY TAKEAWAYS
• Important business problems can be
framed as optimization problems
• There’s a Python interface for every
kind of problem
• Augment solver output with
complementary analyses and
visualizations
We’re Hiring!
• Senior Full Stack Engineer
• Senior Front-End Engineer
• Data Integration Engineer
• Vice President, Deployment Strategy
• Business Project Manager
Come find me after the talk, or email me at todd@moka.nyc
We offer $$$ for successful referrals
Slides and notebook available on GitHub:
https://github.com/moka-analytics/engineering
Find more of my talks and articles at
https://toddschiller.com/
Learn more about MOKA Analytics at
https://www.moka.nyc
3/31/2017
Appendix
3/31/2017
THREE PYTHON SOLVER ARCHITECTURES
Python Library/DSL
Python
Python Library/DSL
Python
C Extension
Pure Python Python w/ C
Python Library/DSL
Python
Standard Representation
Subprocess
Python w/ External
Executable
DSL = Domain Specific Language
Can easily swap solvers. But pay a
speed penalty for (de)serialization
3/31/2017
TACTICS FOR SUPPORTING INTUITION BEHIND OPTIMIZATION RESULTS
Leverage existing descriptive
and diagnostic analytics
Show “diff” of output as user
tweaks assumptions
Show local trade-offsFocus on major drivers /
points of sensitivity

Mais conteúdo relacionado

Último

data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdfKamal Acharya
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 

Último (20)

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 

Destaque

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 

Destaque (20)

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 

Using PuLP and optimization in business analytics

  • 1. NOVEMBER 29, 2019 USING PULP AND SOLVERS FOR BUSINESS ANALYTICS
  • 2. At MOKA, we build intelligent planning software that allows organizations to make smarter, faster, strategic decisions. The Winning Model powers strategic planning for manufacturing business models – from CPG to automotive to industrials. Ready to go out-of-the box, we tailor the core modules and intelligence engine to a client’s specific business. Unifies strategic data model, automates & speeds analysis, and addresses data gaps Delivers a lasting organizational capability. Enterprise-ready, secure & light-weight for fast deployment Encode and distribute high-quality strategy frameworks across your entire organization Predictive & prescriptive analytics drive insights & evaluate complex scenarios
  • 3. Descriptive Analytics Diagnostic Analytics Predictive Analytics Prescriptive Analytics What happened? Why did it happen? What will happen? How can we make it happen? INFORMATION OPTIMIZATION HINDSIGHT INSIGHT FORESIGHT Value Difficulty Source: Gartner BUSINESS ANALYTICS VALUE LADDER
  • 4. 4 Talk Outline 1 What is Linear Programming? 2 Using PuLP for Macro Capacity Planning 3 Python Solver Landscape 4 Best Practices for Using Solvers for Analytics
  • 5. 3/31/2017 LINEAR PROGRAMMING Matrix Form Standard Form ! "#, "%, … = (#"# + (%"% + ⋯ +##"# + +#%"% + ⋯ ≤ -# +%#"# + +%%"% + ⋯ ≤ -% +.#"# + +.%"% + ⋯ ≤ -. … "# ≥ 0 "% ≥ 0 … 12 3 43 ≤ 5 3 ≥ 6 minimize subject to and Trick #1: negate all the constants to maximize a function Trick #2: re-arrange expressions (e.g., subtract from both sides) to isolate constant on the right side Trick #3: add slack/dummy variables to encode other relationships, e.g., strict equality Many tools, including PuLP, can apply these tricks automatically to allow a more natural expression
  • 6. MACRO CAPACITY PLANNING: BUSINESS QUESTIONS • Where are the inefficiencies in our supply chain? • Will we have enough production capacity if demand grows? • Is our supply chain positioned to profitably capture growth opportunities? • Should we open a new warehouse and/or factory? If so, where?
  • 7. With the Winning Model’s Network Strategy Module, Network Planners and CEOs can evaluate network strategy and investment opportunities instantaneously
  • 9. Paradigm1 Problem Form Example Use Cases Example Python Packages Mathematical/Numerical Linear Programming • Supply chain optimization • Production planning • PuLP: interface to linear and mixed-integer solvers • MIPCL: commercial mixed-integer programming • GLOP: Google’s LP-only solver Integer Programming • Minimize interference across cellular network • Bus scheduling/Vehicle routing • “Knapsack” problem Quadratic Programming • Financial portfolio optimization • Image/signals processing • Least-Squares regression • qpsolvers: unified interface around quadratic solvers • quadprog: implementation of the Goldfarb/Idnani dual algorithm Convex Optimization • Training ML models • Linear/Quadratic are a special case of Convex • cvxpy • cvxopt Non-Linear Programming • pyOpt Multi-Paradigm • Pyomo: multi-paradigm interface to multiple solvers • Google OR-Tools: Google’s operations research tools • Gurobi: commercial optimizer supporting multiple languages • SciPy: its optimize package contains numerous solvers Logical/Constraint Logic Programming P(x). ?- Q(x). • Expert system AI • Knowledge graph inference • Natural Language Processing (NLP) • logpy (aka kanren) • PySWIP: SWI-Prolog bridge • ErgoAI: via a Java bridge • Pyke: pure Python Satisfiability Modulo Theories (SMT) • Static software analysis • Program synthesis • Scheduling • pySMT: interface to SMT-LIB format supporting all major solvers • Z3: Microsoft’s SMT solver with support for multiple • CP-SAT: Google’s constraint programming solver PYTHON SOLVER LANDSCAPE 1 Not all paradigms shown. Wikipedia is a good resource for exploring various paradigms ∃". $(")
  • 10. 3/31/2017 BEST PRACTICES FOR USING SOLVERS FOR ANALYTICS Avoid false precision Support user intuition with analytics and visualizations Know when to tradeoff speed vs. precision Benchmark optimizers to find best for your workload Get creative with elastic computing resources Educate users about what’s being optimized, e.g., assumptions and limitations Profile your Python problem creation code Don’t be afraid to run a solver multiple times
  • 11. KEY TAKEAWAYS • Important business problems can be framed as optimization problems • There’s a Python interface for every kind of problem • Augment solver output with complementary analyses and visualizations
  • 12. We’re Hiring! • Senior Full Stack Engineer • Senior Front-End Engineer • Data Integration Engineer • Vice President, Deployment Strategy • Business Project Manager Come find me after the talk, or email me at todd@moka.nyc We offer $$$ for successful referrals Slides and notebook available on GitHub: https://github.com/moka-analytics/engineering Find more of my talks and articles at https://toddschiller.com/ Learn more about MOKA Analytics at https://www.moka.nyc
  • 14. 3/31/2017 THREE PYTHON SOLVER ARCHITECTURES Python Library/DSL Python Python Library/DSL Python C Extension Pure Python Python w/ C Python Library/DSL Python Standard Representation Subprocess Python w/ External Executable DSL = Domain Specific Language Can easily swap solvers. But pay a speed penalty for (de)serialization
  • 15. 3/31/2017 TACTICS FOR SUPPORTING INTUITION BEHIND OPTIMIZATION RESULTS Leverage existing descriptive and diagnostic analytics Show “diff” of output as user tweaks assumptions Show local trade-offsFocus on major drivers / points of sensitivity