Gurobi Modeling Examples

Explore our modeling examples for the Gurobi Python API

Electrical Power Generation


Electrical Power 1

This model is an example of an electrical power generation problem (also known as a unit commitment problem). It selects an optimal set of power stations to turn on in order to satisfy anticipated power demand over a 24-hour time horizon.

This model is example 15 from the fifth edition of Model Building in Mathematical Programming, by H. Paul Williams on pages 270-271 and 325-326.

This example is of intermediate difficulty; 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


Electrical Power 2

This model is an extension of an earlier ‘Electrical Power 1 ‘ example (example 15 from HP Williams); the extension adds the option of using hydroelectric power plants to satisfy demand.

This model is example 16 from the fifth edition of Model Building in Mathematical Programming, by H. Paul Williams on pages 271-272 and 326-327.

This example is of intermediate difficulty; 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