Gurobi Modeling Examples

Explore our modeling examples for the Gurobi Python API

Portfolio Selection Optimization

This model is an example of the classic Markowitz portfolio selection optimization model: to allocate investments to minimize risk. This is best suited to a matrix formulation, so we use the Gurobi Python matrix interface. The basic model is fairly simple, so we also solve it parametrically to find the efficient frontier.

View the notebook

Google Colab Link


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

© Gurobi Optimization, LLC