Gurobi Modeling Examples

Explore our modeling examples for the Gurobi Python API

Car Rental


Car Rental 1

This model is an example of a Car Rental problem. A car rental company wants to determine how many cars to own and where should they be located at the start of each day of a week to maximize weekly profits. This problem is formulated as a linear programming problem using the Gurobi Python API and solved with the Gurobi Optimizer.

This model is example 25 from the fifth edition of Model Building in Mathematical Programming by H. Paul Williams on pages 284-286 and 340-342.

This example is at the intermediate level, where we assume that you know Python and the Gurobi Python API and that you have some knowledge of building mathematical optimization models.

View the notebook

Google Colab Link


Car Rental 2

This model is an extension of the Car Rental problem. In this problem, the car rental company wants to determine in which locations it should expand repair capacity. This problem is formulated as a mixed integer linear programming problem using the Gurobi Python API and solved with the Gurobi Optimizer.

This model is example 26 from the fifth edition of Model Building in Mathematical Programming by H. Paul Williams on pages 287 and 342-343.

This example is at the intermediate level, where we assume that you know Python and the Gurobi Python API and that you have some knowledge of building mathematical optimization models.

View the notebook

Google Colab Link


For details on licensing or on running the notebooks, see the overview on Modeling Examples

© Gurobi Optimization, LLC