Loading/Parsing Mathematical Programming System files

In order not to reinvent the wheel I tried to find some code to parse
Mathematical Programming System files but I didnt find any implementations in python.

enter image description here

Is there any code allready available for this?

Update

Reading Mathematical Prog. files

Example MPS (afiro.mps: link1, link2)
Contains:

  1. objective function, one row, n columns
  2. table with restrictions, m rows, n columns
  3. right table, one column, m rows

Many languages have packages for reading and writing these files.

Answer

The question does not address the specifics, e.g. pure python vs. c-wrapper-based, nor any license-issues.

But well… two things which worked for me in the past (the former was more tested for my own IPM-method on the netlib dataset; the latter looked good too):

Dirty code to use netlib’s test cases with scipy’s solvers based on the former approach.

cvxopt

MPS-reading is somewhat hidden here and here.

Looks pretty much python-only to me.

One should be careful about potentially modifications already done to the problem by cvxopt, at least when asking cvxopt for the matrix-form. I don’t remember right now what to expect here (and it also did not matter much in my cases).

Warning: cvxopt is known for a non-trivial installation-process on windows, if you try to install the whole project!

There are also some warnings about what features of MPS-files are not supported.

GLPK + swiglpk

Basically swig-based bindings for GLPK. Available here (probably most newest python-bindings to GLPK). If using this, use it together with GLPK’s manual and some understanding of SWIG (or else ).

This one should be more controllable in terms of what we read (see manual)!

Leave a Reply

Your email address will not be published. Required fields are marked *