Contribute Media
A thank you to everyone who has made this possible: Read More

How to improve your diet and save money with Python

Translations: en


Zuria Bauer/Daniel Domene López - How to improve your diet and save money with Python [EuroPython 2016] [19 July 2016] [Bilbao, Euskadi, Spain] (

Optimization in Python (also known as mathematical programming) can be performed by minimization (or maximization) of an objective function within a model that can include discrete variables subject to a set of constrains. At this talk, chemical engineering students of the University of Alicante will introduce the audience to the possibilities of optimization, presenting Pyomo and showing real world examples such as how to improve your diet and save money at fast food restaurants.

Process optimization in industry has become essential in order to maximize the resources available and reduce energy consumption. Optimization problems become interesting when dealing with restrictions (linear or nonlinear) and integer variables (modeling the discrete decisions). Python ecosystem presents different libraries to solve optimization problems, some of them are CVXOpt, CVXPy, PulP, OpenOpt, or Pyomo. Among them, Pyomo results interesting because:

  • It can be used for Mathematical modeling in Python similarly to AMPL (and GAMS)
  • It communicates with the main solvers used in this field such as GLPK, Gurobi, CPLEX, CBC and PICO
  • It's free and open source Python library (BSD license), being developed by Sandia National Laboratories, USA.
  • It supports Python 3 and it is easy to install.

The talk will be divided in three parts:

  1. Introduction to Mathematical Programming/Optimization (15 min): visual introduction to optimization concepts including restrictions and non linearties (linear Programming, Nonlinear Programming, ILP, MIP, MINLP).
  2. Introduction to the Pyomo sintax and a quick note for the installation (20 min): showing how to improve their diet and save money when ordering food in fast food restaurants.
  3. Optimization problems in engineering (10 min): showing more advanced optimization examples that include decision variables.
Improve this page