logo
Ciencia

How to Improve Your Diet and Save Money with Python

Zuria Bauer Hartwig

  • 8 de Octubre de 2016, 16:00 - 16:40
  • Sala Cajamar
  • Idioma: en

Optimization (also known as mathematical programming) can be simplified to a selection of the best element/s (minimum or maximum) for a given circumstance (objective function), which may include some conditions (subject to restrictions).

One of the classic problems in field optimization is the (diet problem) [http://www.neos-guide.org/content/diet-problem]. This problem came up during the Second World War when the Army wanted to minimize the cost of feeding their soldiers in the field (objective function) while maintaining a balanced diet.

For this occasion, we will take as an example a set of foods from a well-know fast food restaurant and try to minimize the cost of the menu while being as healthy as possible.

To solve this problem, there are plenty of commercial algebraic modeling languages —such as GAMS and AMPL—, which are used mainly in academia and professional environments. But as Python lovers, we can use several libraries for solving such optimization problems, —e.g. [CVXOpt] (http://cvxopt.org/) [CVXPy] (http: // www.cvxpy.org/en/latest/) [PULP] (https://pythonhosted.org/PuLP/) [OpenOpt] (http://openopt.org/Welcome), or [Pyomo] (http: //www.pyomo.org/).

In this talk we will use Pyomo because:

  • We can use it as an Algebraic Modeling Language, being similar to AMPL and GAMS.
  • Solve these problems by means of a variety of solvers such as GLPK, Gurobi, CPLEX, CBC and PICO.
  • It is a free, open source library (BSD license), being developed by Sandia National Laboratories, USA.
  • Supports Python 3 and is easy to install.
  • Moreover, it automatically connects with NEOS server (web platform that gives free access to commercial solvers).

The talk will be divided in three parts:

  1. Introduction to Mathematical Programming/Optimization (10 min): visual introduction to optimization concepts including restrictions and non linearties (linear Programming, Nonlinear Programming, ILP, MIP, MINLP).
  2. Introduction to the diet problem, Pyomo sintax and a quick note for the installation (15 min): showing how to improve your diet and save money when ordering food in fast food restaurants.
  3. Optimization problems in engineering (5 min): showing more advanced optimization examples in the area of process engineering

Don't miss this talk if are one of those "undecided pythonistas" that want to learn how to solve optimization problems with determination ;)