Optimization notebooks in Python: run them in Colab
48 classic optimization problems as Jupyter notebooks: the problem, the model with a note on every line, Python code (cvxpy) and its real output, and the checked answer. Open one in Google Colab and run it in your browser, free and with nothing to install, or download it from GitHub (code under the MIT License, text under CC BY 4.0).
Linear programming
- Product mix problem · Open in Colab · GitHub
- Diet problem · Open in Colab · GitHub
- Transportation problem · Open in Colab · GitHub
- Maximum flow problem · Open in Colab · GitHub
- Shortest path as a linear program · Open in Colab · GitHub
- Minimum-cost network flow · Open in Colab · GitHub
- Blending problem · Open in Colab · GitHub
- Multi-period production and inventory planning · Open in Colab · GitHub
- Two-stage supply chain · Open in Colab · GitHub
- Shadow prices of a production plan · Open in Colab · GitHub
- Dual of the diet problem · Open in Colab · GitHub
- Dual of a transportation problem · Open in Colab · GitHub
- LP dual with equality constraints · Open in Colab · GitHub
- Least absolute deviations regression · Open in Colab · GitHub
- Minimax (Chebyshev) line fit · Open in Colab · GitHub
- Mean-absolute-deviation portfolio · Open in Colab · GitHub
- CVaR (worst-case loss) portfolio · Open in Colab · GitHub
- Cash-flow matching with bonds · Open in Colab · GitHub
- Largest circle inside a polygon · Open in Colab · GitHub
Integer programming
- Assignment problem · Open in Colab · GitHub
- 0-1 knapsack problem · Open in Colab · GitHub
- Travelling salesman problem · Open in Colab · GitHub
- Facility location problem · Open in Colab · GitHub
- Set covering problem · Open in Colab · GitHub
- Capacitated facility location · Open in Colab · GitHub
- Bin packing problem · Open in Colab · GitHub
- Graph colouring as an integer program · Open in Colab · GitHub
- Cutting stock problem · Open in Colab · GitHub
- Lot sizing with setup costs · Open in Colab · GitHub
- Machine scheduling (makespan) · Open in Colab · GitHub
- Big-M either-or constraint · Open in Colab · GitHub
- Fixed-charge (setup cost) problem · Open in Colab · GitHub
- LP relaxation versus integer optimum · Open in Colab · GitHub
Quadratic programming
- Markowitz minimum-variance portfolio · Open in Colab · GitHub
- Least squares line fit · Open in Colab · GitHub
- Ridge regression · Open in Colab · GitHub
- Lasso regression · Open in Colab · GitHub
- Support vector machine (soft margin) · Open in Colab · GitHub
Convex optimization
- Economic order quantity · Open in Colab · GitHub
- Logistic regression · Open in Colab · GitHub
- Kelly criterion bet size · Open in Colab · GitHub
- Smallest circle covering points · Open in Colab · GitHub
- Warehouse location (Fermat-Weber point) · Open in Colab · GitHub
- Consumer's best bundle (utility maximization) · Open in Colab · GitHub
- Water-filling power allocation · Open in Colab · GitHub
Eigenvalue problem
Fractional programming
Geometric programming
Try ProvenDecisions free: type, photograph or say an optimization problem; every answer is checked by a solver.