These lecture notes are part of the broader course on Statistics, Simulation and Optimization (SSO) at the University of Amsterdam (UvA). They support the lectures, slides, tutorials, and assignments of the simulation and optimization component of the course. Large parts of these lecture notes are based on the book An Introduction to Business Analytics by Ger Koole written in 2019.
About the simulation and optimization course part¶
The simulation and optimization part of this course is about turning big data into effective future decisions using mathematical modeling and optimization. Different quantitative methods are discussed to solve optimization problems in both deterministic and stochastic settings. Simulation techniques are used to evaluate models realistically in uncertain environments.
The course covers the following topics:
(Integer) linear optimization/programming and commercial solvers
Algorithms, heuristics, and complexity theory
Monte Carlo simulation of functions of random variables
Discrete-event simulation
Statistical analysis of simulation results
Simulation optimization techniques
Learning objectives¶
On successful completion of this part of the course, participants are able to:
Understand the importance of optimization and simulation in a big-data era
Understand the role of statistics and data science in simulation and optimization
Recognize, classify, and model optimization problems of deterministic and stochastic nature
Solve optimization problems using algorithms and solvers in Python
Translate optimization solutions into real-life decisions and critically reflect on them
Simulate and statistically analyze random processes using Python and dedicated simulation software such as Arena and SimQuick
Reflect on the importance of addressing uncertainty in light of the “flaw of averages”
Recognize optimization and simulation opportunities in real life
Apply optimization and simulation in real life in an ethically well-considered way
Find and comprehend further simulation and optimization resources for problem-solving in practice
Prerequisites¶
This course assumes a basic understanding of quantitative methods, including algebra, probability, statistics, and introductory data analysis. Familiarity with Python is beneficial, as many examples and exercises are implemented in Python.
How to use these lecture notes¶
These notes are intended to support the lectures and other course materials rather than replace them. They are best read sequentially, with attention to the examples, exercises, and computational tasks. Students are encouraged to work through the examples actively and to connect the mathematical concepts to practical decision problems. Try the exercises first before looking at the solutions.
The notes are updated during the course. The Changelog lists what changed in each version, and the bottom of every page shows which version you are reading.
The materials are organized by lecture, and each lecture is divided into topic-specific Jupyter notebooks. The table of contents in the left-hand menu follows this structure: lectures are grouped together, and the individual topics are listed underneath each lecture.
Running the notebooks¶
Every notebook has an “Open in Colab” button at the top, which opens it directly in Google Colab: a free, browser-based Jupyter environment that needs no local installation and already provides everything these notebooks need, including pulp. This allows you to run the notebooks without installing anything on your own machine. Use it to actively learn about the concepts: change parameters, add constraints, etc.
You can also download the notebooks with the download button and run them locally in a local Python environment with required packages installed such as jupyter(lab), PuLP, and plotly (used for the interactive figures).
PuLP version¶
These notes use PuLP 3.3.2. The newer PuLP 4.0 has since been released, and the code in these notes does not run on it (for example, pulp.LpVariable(...) and pulp.PULP_CBC_CMD(...) no longer exist in 4.0), so make sure you work with version 3.3.2:
In Google Colab, you do not need to install anything: Colab already provides PuLP 3.3.2 with the CBC and HiGHS solvers.
Locally, install it with
pip install "pulp[highs]==3.3.2". This includes the CBC solver and adds the HiGHS solver, which Solvers and How to Help Them shows how to use (pip install pulp==3.3.2gives you CBC only). If you already installed PuLP 4.0, the same command switches you back to 3.3.2.Check which version you have with
import pulp; print(pulp.__version__).
PuLP’s own website and many examples online now show PuLP 4.0 code. Much of it also runs on version 3.3.2, which already includes the new ways of writing a model, such as prob.add_variable(...) to create variables. Two things differ: reading the result of a solve (in 4.0, stats = prob.solve() and stats.status_str instead of pulp.LpStatus[prob.status]), and the solver (4.0 uses pulp.COIN_CMD(...), which needs a separate CBC installation that Colab does not have). When in doubt, follow the code in these notes.
PuLP’s website only documents the newest version. The documentation of version 3.3.2 is available on GitHub, including case studies such as a transportation problem. In Python, help(pulp.LpVariable) shows the documentation of the version you have installed, for any PuLP function or class.
Tooling¶
The simulation and optimization part of this course uses Python. Python’s built-in functions are deliberately minimal; the data-analysis functionality comes from libraries, most importantly numpy (arrays and numerical computing), pandas (tabular data), matplotlib (plotting), and scipy (statistics and scientific computing). For optimization we add pulp (introduced in Linear Optimization; see PuLP version for the version these notes use). These notes are themselves Jupyter notebooks, combining code, its output, and explanation.
Contributing¶
Spotted an error, unclear explanation, or broken example in the notes? The notebook is organized on Github. Please feel free to report issues or suggest improvements.
Acknowledgments¶
These lecture notes are based on Ger Koole’s book An Introduction to Business Analytics (2019) and the lectures by Joost Berkhout. The notes were compiled with the help of Claude (Anthropic). Joost Berkhout takes full responsibility for the materials.