pulp icon indicating copy to clipboard operation
pulp copied to clipboard

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

Open tle4336 opened this issue 2 years ago • 1 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: ___ )
  • [X] Other: UNIX

I'm using python version:

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

I installed PuLP via:

  • [ ] pypi (python -m pip install pulp)
  • [ ] github (python -m pip install -U git+https://github.com/coin-or/pulp)
  • [X ] Other: pipfile (conda?)

Did you also

  • [X] Tried out the latest github version: https://github.com/coin-or/pulp
  • [X] Searched for an existing similar issue: https://github.com/coin-or/pulp/issues?utf8=%E2%9C%93&q=is%3Aissue%20

tle4336 avatar Nov 22 '23 22:11 tle4336

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)

pchtsp avatar Jan 15 '24 13:01 pchtsp