Skip to main content

PyMathProg

An easy and flexible mathematical programming environment for Python.

Description

PyMathProg is a pythonic reincarnation of AMPL and GNU MathProg modeling language, implemented in pure Python, connecting to GLPK via swiglpk. Create, optimize, report, change and re-optimize your model with Python, easily integrate database, plotting, etc.

PyMathProg provides an easy and flexible modelling syntax using Python to create and optimize mathematical programming models. Optimization is done by open source optimization packages such as the GNU Linear Programming Kit (GLPK) that is made available to PyMathProg by swiglpk.

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

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. Since it 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 PyMathProg installed on other platforms, the only hurdle to overcome is to get swiglpk installed there first.

Example

Below is a small example taken from the dive-in turorial in the PyMathProg Documentation:

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

Help in the following ways are more than welcome:

  1. tutorials and samples.

  2. bug reports

  3. feature requests

  4. code contribution

I hope you will find it useful.

Metadata

Release files for pymprog 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymprog 1.1.2
File Size Uploaded Provenance Actions
pymprog-1.1.2.tar.gz 44.6 kB Without provenance Details for pymprog-1.1.2.tar.gz

Release files / pymprog-1.1.2.tar.gz

Download URL pymprog-1.1.2.tar.gz
Size 44.6 kB
Tags Source
SHA-256 checksum
How to use checksums
09852ca79b12f558cd791eb66a51203dabe70b570581ae04e08211ab60968b06
BLAKE2b-256 checksum
How to use checksums
fbb427e6dc89387535829127b8e577226f0a82215da174b451198312e0afe5d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pymprog 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page