Skip to content

Organization of the lab

The lab at a glance

7 application chapters · 3 chapters of tools · LP models only · one Colab notebook per chapter · reproducible Python/Gurobi code. The full list, chapter by chapter, is in the syllabus.

  • Self-assessment


    Mock exam

    A new mock exam at every start: 13 questions, 33 points, with the solutions and links to the notes.

    Test yourself

Download as PDF

Getting started

Nothing to install: every chapter has its own notebook that opens in Colab and runs in the browser. Those who prefer to work locally find the commands and the notes on the Gurobi licence on the same page.

Essential path in four lab sessions

Content Learning objectives
Lab 1 Production and inventory formulate a multi-period LP; read duals, slacks and ranges; verify a shadow price by perturbation
Lab 2 Data Envelopment Analysis build one LP per unit; read the envelopment form (peers and targets); tell weak from strong efficiency
Lab 3 Newsvendor or CVaR formulate a scenario LP; read the optimal quantile; measure the cost of protection
Lab 4 Project of your choice EV charging, arbitrage or robust and quantile regression; managerial presentation

The most common mistakes

  1. Reading .X or .Pi without checking m.Status.
  2. Forgetting lb=-GRB.INFINITY on the free variables (\(b\) of the regression, \(\eta\) of the CVaR).
  3. Using a shadow price outside its validity range.
  4. Getting the sign of the duals wrong in minimization problems.
  5. Updating the RHS of a constraint that contains constants on the left-hand side.
  6. Optimizing a single objective when the problem has two (pure minimax).
  7. Choosing the parameters (\(\tau\), \(\lambda\), the budget) by looking at the data used to decide.
  8. Reporting six decimal digits from estimates that wobble at the second.

Reproducibility

python3 -m pip install gurobipy matplotlib pandas scipy   # scipy: statistical functions only
python3 python/run_all.py            # regenerates data, results and figures

The slides are on the downloads page; the solutions to the exercises are distributed in class.