Jump-Start Your Optimization Discovery

Explore our modeling examples below, access them via GitHub, or download the entire collection. You can also check out examples for other programming languages, or dive into our functional code. MIP developers: Be sure to check out ticdat.

Introductory: Tutorial Example

This tutorial assumes that you know Python and that you have a background in a discipline that uses quantitative methods.

Beginner

These modeling examples assume you know Python and have some knowledge about building mathematical optimization models.

Intermediate

These modeling examples 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.

Advanced

These modeling examples 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.

  • Difficulty

  • Business Needs

 

Advanced

Constraint Optimization

If you are looking to improve your modeling skills, then try this tricky constraint optimization problem. We'll show you how to model this problem as a linear programming problem using the Gurobi Python API and solve it using the Gurobi Optimizer.

 Learn More

 

Advanced

Decentralization Planning

Ready for a mathematical optimization modeling challenge? Put your skills to the test with this example, where you'll learn how to model and solve a decentralization planning problem. You'll have to figure out – given a set of departments of a company, and potential cities where these departments can be located – the "best" location for each department in order to maximize gross margins.

 Learn More

 

Advanced

Farm Planning

Cultivate your modeling skills with this example, where you'll learn how to solve a complex, multi-period production planning problem that involves optimizing the operations of a farm over five years. 

 Learn More

 

Advanced

Lost Luggage Distribution

In this example, you'll learn how to use mathematical optimization to solve a vehicle routing problem with time windows, which involves helping a company figure out the minimum number of vans required to deliver pieces of lost or delayed baggage to their rightful owners and determining the optimal assignment of vans to customers.

 Learn More

 

Advanced

Manpower Planning

Staffing problems – which require difficult decisions about the recruitment, training, layoffs, and scheduling of workers – are common across a broad range of manufacturing and service industries. In this example, you'll learn how to model and solve a complex staffing problem by creating an optimal multi-period operation plan that minimizes the total number of layoffs and costs.

 Learn More

 

Advanced

Milk Collection

In this example, you'll discover how mathematical optimization can be leveraged to solve a capacitated vehicle routing problem: the Milk Collection Problem. With only one tanker truck with limited capacity, you will need to determine the best possible route for the tanker to take to collect milk every day from a set of farms.  

 Learn More

 

Advanced

Portfolio Selection Optimization

This model is an example of the classic Markowitz portfolio selection optimization model.

 Learn More

 

Advanced

Protein Comparison

In this example, we'll show you how to use mathematical optimization to address a Protein Comparison problem. You'll learn how to model this problem – which involves measuring the similarities of two proteins – as a quadratic assignment problem using the Gurobi Python API and find an optimal solution to it with the Gurobi Optimizer.

 Learn More

 

Advanced

Protein Folding

Hone your modeling skills with this challenging Protein Folding problem. We'll show you how to create a binary optimization model of the problem with the Gurobi Python API and then solve it using the Gurobi Optimizer.

 Learn More

 

Advanced

Standard Pooling

Companies across numerous industries – including petrochemical refining, wastewater treatment, and mining – use mathematical optimization to solve the pooling problem. In this example, we'll guide you through the process of building a mixed-integer quadratically-constrained programming (MIQCP) model of a pooling problem using the Gurobi Python API and show you how to generate an optimal solution to the problem with the Gurobi Optimizer.

 Learn More

 

Advanced

Traveling Salesman

In this example, you'll learn how to tackle one of the most famous combinatorial optimization problems in existence: the Traveling Salesman Problem (TSP). The goal of the TSP – to find the shortest possible route that visits each city once and returns to the original city – is simple, but solving the problem is a complex and challenging endeavor. We'll show you how to do it!  

 Learn More

 

Advanced

Workforce Scheduling

In this example, you'll learn how to solve a critical, central problem in the services industry: workforce scheduling. We'll demonstrate how you can use mathematical optimization to generate an optimal workforce schedule that meets your business requirements, maximizes employee fairness and satisfaction, and minimizes the number of temporary workers your company needs to hire.

 Learn More

What's
New at Gurobi

News
Gurobi 10.0 Delivers Blazing-Fast Speed, Innovative Data Science Integration, and an Enterprise Development and Deployment Experience
Latest release enables data professionals to easily integrate machine learning models into optimization models to solve new types of problems.
 Learn More
Event
Webinar: What’s New in Gurobi 10.0
In this webinar, attendees will get a first look at our upcoming product release, Gurobi 10.0. We will summarize the performance improvements and highlight some of the underlying algorithmic advances, such as the network simplex algorithm, enhancements in concurrent LP, and optimization based bound tightening.
 Learn More
new content
Cost Savings & Business Benefits for Gurobi Customers
2022 Total Economic Impact™ Study Reveals A 518% ROI with Gurobi
 Learn More