MO-BOOK: Hands-On Mathematical Optimization with AMPL in Python 🐍#

Welcome to this repository of notebooks Hands-On Mathematical Optimization with AMPL in Python, also know as Data-Driven Mathematical Optimization with AMPL in Python, or MO-Book With AMPL, a project currently under development with completion expected by the end of 2023. This is the AMPL version of Hands-On Mathematical Optimization in Python. These notebooks introduce the concepts and tools of mathematical optimization with examples from a range of disciplines. The goals of these notebooks are to:

  • provide a foundation for hands-on learning of mathematical optimization,

  • demonstrate the tools and concepts of optimization with practical examples,

  • help readers to develop the practical skills needed to build models and solving problems using state-of-the-art modeling languages and solvers.

Getting started#

The notebooks in this repository make extensive use of amplpy which is an interface that allows developers to access the features of AMPL from within Python. AMPL (A Mathematical Programming Language) is an algebraic modeling language to describe and solve high-complexity problems in large-scale optimization. Natural mathematical modeling syntax lets you formulate optimization models the way you think about them. AMPL’s new Python ecosystem allows you to collaborate, ideate, and prototype to build full optimization applications and deploy them to larger systems.

All notebooks in this repository can be opened and run in Google Colab. A launch icon appearing at the top of a page (look for the rocket) indicates the notebook can be opened as an executable document. Selecting Colab will reopen the notebook in Google Colab. Cells inside of the notebooks will perform any necessary installations of amplpy and solvers needed to execute the code within the notebook.

Start your journey with the first chapter!

Help us!#

We seek your feedback! If you encounter an issue or have suggestions on how to make these examples better, please open an issue using the link at the top of every page (look for the Github cat icon).

About Us#

We are a group of researchers and educators who came together with a common purpose of developing materials for use in our classroom teaching. Hopefully, these materials will find use in other classrooms and, most importantly, by those seeking entry into the world of building optimization models for data-rich applications.

  • Krzysztof Postek, Boston Consulting Group (formerly TU Delft)

  • Alessandro Zocca, VU Amsterdam

  • Joaquim Gromicho, ORTEC and the University of Amsterdam

  • Jeffrey Kantor, University of Notre Dame


If you wish to cite this work, please use

title     = "Hands-On Mathematical Optimization with AMPL in Python",
author    = "Postek, Krzysztof and Zocca, Alessandro and Gromicho, Joaquim and Kantor, Jeffrey",
year      = 2024,
publisher = "Online",
url       = ""