Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture Notes on Simulation and Optimization

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:

Learning objectives

On successful completion of this part of the course, participants are able to:

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:

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.