Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 937
Panos Kal. Avatar asked Nov 15 '17 11:11

Panos Kal.


2 Answers

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

like image 121
sascha Avatar answered Sep 22 '22 22:09

sascha


You can use pysmps package in Python. It can simply be installed through pip install pysmps. Further details can be found in:

https://pypi.org/project/pysmps/

https://github.com/jmaerte/pysmps

like image 20
rasul Avatar answered Sep 25 '22 22:09

rasul