# Build Your Optimization Skills with Python

Jupyter Notebook Modeling Examples

### Introduction to Gurobi Jupyter Notebook Modeling Examples

Gurobi Jupyter Notebook Modeling Examples are mathematical optimization models coded using the Gurobi Python API and implemented with Jupyter Notebooks (which are web applications that let you create and share documents that contain live code, equations, visualizations, and narrative text).

With Gurobi Jupyter Notebook Modeling Examples, you will learn how to translate a business, engineering, or scientific problem into a mathematical optimization model.

These modeling examples:

• Instruct users on how to build mathematical optimization models.
• Illustrate the broad applicability of mathematical optimization across various industries.
• Explain the important features of the Gurobi Python API modeling objects such as adding decision variables, building linear expressions, adding constraints, and adding an objective function for a mathematical optimization model.

The examples are taken from real-world use cases, and teach you how to solve problems, such as the traveling salesman problem, marketing campaign optimization, electrical power generation, and more.

No matter if you are a beginner, intermediate or an advanced user, these Jupyter Notebook Modeling Examples will help you improve your optimization modeling skills using Python.

### Introductory

This modeling tutorial is at the introductory level, where we assume that you know Python and that you have a background in a discipline that uses quantitative methods.

Example Description
Intro to Mathematical Optimization Modeling Learn the key components in the formulation of mixed-integer programming (MIP) problems. You will learn how to use the Gurobi Optimizer to compute an optimal solution of the MIP model.

### Beginner

These modeling examples are at the beginner level, where we assume you know Python and have some knowledge about building mathematical optimization models.

Example Description Industry
3D Tic-Tac-Toe Arrange X’s and O’s on a three-dimensional Tic-Tac-Toe board to minimize the number of completed lines or diagonals. Education
Cell Tower Coverage Solve a simple covering problem that builds a network of cell towers to provide signal coverage to the largest number of people possible. Telecommunications
Marketing Campaign Optimization Solve a marketing campaign optimization problem common in the banking and financial services industry. Financial Services
Facility Location Discover how to solve a facility location problem that involves building warehouses to supply a certain number of supermarkets. Logistics
Offshore Wind Farming Learn how to minimize the cost of laying underwater cables that collect electricity produced by an offshore wind farm. Energy and Utilities
Supply Network Design Determine how to satisfy customer demand, while minimizing shipping costs. Logistics

### Intermediate

These modeling examples are at the intermediate level, where we assume that you have some knowledge about building mathematical optimization models. In addition, you should know Python and be familiar with the Gurobi Python API.

Example Description Industry
Best Feature Selection for Forecasting Solve a linear regression problem that minimizes the residual sum of squares subject to the constraint that the number of non-zero feature weights should be less than or equal to a given upper limit. Research, Analytics, and Optimization
Customer Assignment Address the optimal placement of facilities (from a set of candidate locations) in order to minimize the distance between a company’s facilities and its customers. Logistics
Electrical Power Generation Discover how to solve an electrical power generation problem (also known as a unit commitment problem) by selecting an optimal set of power stations to turn on in order to satisfy anticipated power demand over a 24-hour time horizon. Energy and Utilities
Factory Planning Solve a production planning problem and create an optimal production plan to maximize profit. Manufacturing
Food Manufacturing Learn how to solve a blending optimization problem with multiple raw materials combined in a way that meets the stated constraints for the lowest cost. Manufacturing
Mining Discover how to model and solve a multi-period production planning problem to optimize mine production across a number of mines over a five-year period. Metals and Mining
Refinery Solve a production planning problem, where decisions must be made regarding which products to produce, and which resources to use to produce those products. Oil and Gas
Technician Routing and Scheduling Problem Learn how to formulate and solve a multi-depot vehicle routing problem with time windows. Transportation

These modeling examples are at the advanced level, where we assume that you know Python and the Gurobi Python API and that you have advanced knowledge of building mathematical optimization models. Typically, the objective function and/or constraints of these examples are complex or require advanced features of the Gurobi Python API.

Example Description Industry
Farm Planning Solve a production planning problem, where decisions must be made regarding which products to produce, and which resources to use to produce those products. Food and Agriculture
Manpower Planning Learn how to solve staffing planning problems, where choices must be made regarding recruitment, training, redundancy and scheduling of staff. Manufacturing
Standard Pooling Solve a pooling problem, which is common in various industries including petrochemicals, wastewater treatment, mining, food and liquor processing, pharmaceuticals, heat exchanger networks, and supply chain operations. Oil and Gas
Traveling Salesman Discover how to solve the Traveling Salesman Problem (TSP). The goal of the TSP is to find the shortest possible route that visits each city once and returns to the original city. Research, Analytics and Optimization
Workforce Scheduling Solve a workforce scheduling optimization problem that deals with the arrangement of work schedules and the assignment of personnel shifts in order to cover the demand for resources that vary over time. Professional Services

### Commercial Evaluation Trial

Gurobi allows you to try a free, full-featured, commercial evaluation license for 30 days. During that time, you’ll also get:

• Free benchmarking services
• Free model tuning services