coin-or / pulp

A python Linear Programming API
http://coin-or.github.io/pulp/
Other
2.01k stars 376 forks source link

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

Open tle4336 opened 8 months ago

tle4336 commented 8 months ago

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?

I'm using python version:

I installed PuLP via:

Did you also

pchtsp commented 6 months ago

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)