Welcome to PyMathProg

This is the documentation for PyMathProg. PyMathProg is an easy and flexible mathematical programming environment for Python. It makes modelling, solving, analyzing, modifying and manipulating linear programs super easy and highly flexible in Python.

Great features offered by PyMathProg include:

  • Ergonomic syntax for modelling
  • Friendly interactive session
  • Sensitivity report
  • Advanced solver options
  • Automatic model update on parameter changes
  • Parameters sharable between models
  • Deleting variables/constraints
  • Supporting both Python 2 and 3
  • Supporting all major platforms

Quick installation

Assuming you already have Python 2 or Python 3 installed, now open a terminal window (also known as a command window), and type in this line of command and hit return:

pip install pymprog

That’s it! In a couple of minutes it will download the necessary packages and install them, and you should be all set. Since pymprog is a pure Python project that only depends on swiglpk, it can be installed this way wherever swiglpk can be installed. Currently, swiglpk comes with binary wheels for Windows, Mac, and Linux. If you’d like to have pymprog installed on other exotic platforms, the only hurdle to overcome is to get swiglpk installed there first.

Quick example

Below is a small example taken from Whetting your appetite:

from pymprog import *
begin('bike production')
x, y = var('x, y') # variables
maximize(15 * x + 10 * y, 'profit')
x <= 3 # mountain bike limit
y <= 4 # racer production limit
x + y <= 5 # metal finishing limit
solve()

Getting Help

There are several ways to get some help:

  1. Project homepage: http://pymprog.sf.net/
  2. Email list: https://lists.sourceforge.net/mailman/listinfo/pymprog-help
  3. Forum: https://sourceforge.net/forum/forum.php?forum_id=942151

More PyMathProg resources at SourceForge.net Logo

Indices and tables