April 17 – 10:30AM ET

Where Data Meets Decisions:
An Overview of Our Free Jupyter Notebook Data
Science Example Library

Rahul Swamy

Jerry Yurchisin

Data Science Intern, Gurobi

Data Science Strategist, Gurobi© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved

Where Data Meets Decisions:
An Overview of Our Free Jupyter Notebook Data
Science Example Library

AgendaWELCOMEABOUT OPTIMIZATION
Why do data scientists care about
optimization and how can they combine
predictive and prescriptive analytics?

GUROBI’S EXAMPLE LIBRARY
More about our educational python
notebooks

NOTEBOOK SPOTLIGHT
1. Planning for Airline Disruption
2. Avocado Price Optimization – Parts 1and 2© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 2DATA SCIENCETOOLKIT& OPTIMIZATIONPRESCRIPTIVEANALYTICS

EXPLAINABLESCALABLE
TRUSTED

PREDICTIVEANALYTICS

PLAN &EXECUTE

What will
happen next?

M
TI
OP

DIAGNOSTICANALYTICS
ANTICIPATEDESCRIPTIVEANALYTICS
UNDERSTAND

OPTIMAL
DECISON

How do we makeand execute a plan?

IZ
ATIO
N

VALUE

Predictive + Prescriptive Analytics

What alreadyhappened?

Why did ithappen?

INECHAM

INGRN
A
LE

MEASURECOMPLEXITY© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 3

More on Predictive + Prescriptive Analytics• Use Multistructured Analytics forComplex Business Decisions• Combine Predictive and PrescriptiveAnalytics for Better Decision Making• Market Guide for Consumer Goods
Trade Promotion Solutions© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 4

When is Math Optimization the Right Tool?
What is mathematical optimization?
An approach to solving complex decision problems
where you want to…
1. Find the best course of action
2. Among many possibilities
3. That the decision maker can set
4. Given specified limitations
5. With some particular objective(s) in mind
6. Guarantee the solution is feasible and optimal!
Quantities• Continuous (Ex: setting the price of produce)• Integer (Ex: manufacturing cars)
Alternatives• Binary (Ex: yes/no decision to use and aircraft
for a given flight)

Decision problems to optimization models
Max 𝑐! 𝑥! + 𝑐" 𝑥"
Subject to:𝑎!,! 𝑥! + 𝑎!," 𝑥" ≤ 𝑏!
𝑎",! 𝑥! + 𝑎"," 𝑥" = 𝑏"objectivefunction𝑙! ≤ 𝑥! ≤ 𝑢!
𝑙" ≤ 𝑥" ≤ 𝑢"
decisionvariablesYour favorite
programming
languageconstraints© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 5

Gurobi’s Example Notebook Library
NEW: DS EXAMPLE LIBRARY
Introductory to advanced examples
Key features of Gurobi and the Python API
Covers numerous industries
Experiment and learn with mathematical optimization
Find inspiration for your projects• Fantasy Basketball• Renewable Scheduling• Price Optimization• Airline Disruption• MusicRecommendations• Text Similarity

FULL EXAMPLE LIBRARY• Telecommunications• Manufacturing• Logistics• Metals and Mining• Financial Services• Oil and Gas• Energy and Utilities• Transportation• Healthcare• Services• Food and Agriculture• Government• Research, Analytics, and • Professional ServicesOptimization• Airlines© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 6

1Flight Planning
After Disruption

2

Avocado PriceOptimization

Notebook Spotlight© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 7

I. Flight Planning After Disruption© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 8

I. Flight Planning After Disruption• During a weather event, airport capacities are diminished• Let’s say you are running airline operations (how fun!)• You have made flight plans for all your aircrafts for 24 hours• Goals: Re-optimize the flight plan during the disruption day• Which flights to cancel?
• What are the new routes for the aircrafts?
• Real data from AMADEUS (France)© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 9

II. Integrating ML into an MIP modelPart 1: Price Optimization with Avocado SalesEXAMPLE PART 1 OVERVIEW• You supply avocados to the US and need to:• Decide avocado price• Amount to supply to each region• Maximize profit• Use data available from Hass Avocado Board• Ordinary Least Squares model (OLS) to predict
demand• Formulate an optimization model to find the best priceand allocation for each region
Image courtesy:© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 10

II. Integrating ML into an MIP modelPart 2: Price Optimization with Avocado Sales

WHAT’S NEW IN PART 2• Two open-source, experimental packages from Gurobi:
1. Gurobi Machine Learning• Replaces the OLS model with a trained Scikit Learn object
directly as a constraint• add_predictor_constr
2. Gurobipy Pandas• Easily create decision variables using a pandas data frameand corresponding constraints• add_vars, add_constrs• Offers a small glimpse of functionality• See github.com/Gurobi for more on our open-source work

Image courtesy:© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 11II. Integrating ML into an MIP modelPart 2: Price Optimization with Avocado Sales

Linear predictor
model added 64
variables and 8
constraints to theoptimizationmodel© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 12

II. Integrating ML into an MIP modelPart 2: Price Optimization with Avocado Sales© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 13

II. Integrating ML into an MIP modelPart 2: Price Optimization with Avocado Sales

Gradient boosting
added many
more variables
and constraints tothe optimizationmodel© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved | 14Gurobi Machine Learning:

Incorporate your Machine
Learning Models intoOptimization
Zed DeanTechnical Account Manager

Alison Cozad
Gurobi Expert Team NA Manager

April 2023

Tuesday, April 18 | 9:10-10am | Cottonwood 11© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved

MARCH 14 – SEPT 1, 2023 | ON-DEMAND TRAINING

Optimization 101 for Data Scientists:
NOW ON-DEMAND: Two partial days of pre-recorded, hands-on training
with experts teaching the relationship between Optimization and DataScience, introducing the basics of optimization, and guiding you to aculminating real-world application in Jupyter Notebooks.

LEAD INSTRUCTOR

WITH GUEST INSTRUCTOR/PARTNER

Jerry Yurchisin

Ehsan Khodabandeh

Data Science Strategist, Gurobi &Former Instructor of Mathematics
and Statistics

Principal OR Scientist, Decision Spot &Lecturer, Northwestern University:
MS in Analytics© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved

GUROBI: ALWAYS FREE FOR ACADEMICS& RECENT GRADUATESOPTIMIZATION SUCCESS STARTS HERE
Special opportunities for the academic community:•Gurobi: Always free for academics•Gurobi user community page•

Educational Resources:•

www.gurobi.com/academia

Email academicprogram@gurobi.com to learn more.

Introducing:www.BurritoOptimizationGame.com

TAKE GUROBI
WITH YOU
Gurobi is also available torecent graduates throughour Take Gurobi With
You ProgramQUESTIONS?

Thank YouFor more information: gurobi.com
Jerry Yurchisin
Data Science Strategist
yurchisin@gurobi.com© 2023 Gurobi Optimization, LLC. Confidential, All Rights Reserved