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

Description

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. 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, CVXPy, PULP, OpenOpt or Pyomo.

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 ;)

http://2016.es.pycon.org/

Improve this page