coin-or / pulp

A python Linear Programming API

Home Page:http://coin-or.github.io/pulp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LpProblem.fromMPS() function does not work on UNIX system?

tle4336 opened this issue · comments

Details for the issue

What did you do?

I currently need to read a .mps file back into Pycharm using LpProblem.fromMPS([file directory], sense=Lp.Maximize). However, when doing things on UNIX system in a Docker container (Jenkins), I kept bumping into the weird error:

15:36:40 File "/-python/.local/lib/python3.10/site-packages/pulp/pulp.py", line 1541, in fromMPS
15:36:40 data = mpslp.readMPS(filename, sense=sense, **kwargs)
15:36:40 File "/
-python/.local/lib/python3.10/site-packages/pulp/mps_lp.py", line 91, in readMPS
15:36:40 row_name = line[1]
15:36:40 IndexError: list index out of range

What did you expect to see?

I expect the file to be read successfully, as I was able to do so locally on a Windows 10 system.

What did you see instead?

Error message:

15:36:40 File "/-python/.local/lib/python3.10/site-packages/pulp/pulp.py", line 1541, in fromMPS
15:36:40 data = mpslp.readMPS(filename, sense=sense, **kwargs)
15:36:40 File "/
-python/.local/lib/python3.10/site-packages/pulp/mps_lp.py", line 91, in readMPS
15:36:40 row_name = line[1]
15:36:40 IndexError: list index out of range

Useful extra information

The info below often helps, please fill it out if you're able to. :)

What operating system are you using?

  • Windows: ( version: ___ )
  • Linux: ( distro: ___ )
  • Mac OS: ( version: ___ )
  • Other: UNIX

I'm using python version:

  • 2.7
  • 3.4
  • 3.5
  • 3.6
  • [X ] Other: 3.10

I installed PuLP via:

Did you also

you're giving a list of files as argument, from what I get from your example. The package is constantly tested in Linux.

You should do:

LpProblem.fromMPS(file directory, sense=Lp.Maximize)