You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I attempted to read an .mps file using pulp.LpProblem.fromMPS.
I discovered the issue when converting problems to pulp style .json files, and an .mps file containing an MI type bound caused pulp to error. MI bounds specify that the lower bound is -inf for a variable (see note E here)
MPS File bounds section (simplified):
BOUNDS
...
MI bnd d_losvq_trnsf
UP bnd d_losvq_trnsf 400
...
ENDATA
What did you expect to see?
Successful file read.
What did you see instead?
IndexError raised.
In the function readMPSSetBounds, a series of checks are made against the bound type. Bound types that do not specify a bound value are caught and handled separately (currently FR, BV, and PL are caught). If the type is not caught, the bound value is read from the lines object, which is a list.
Since the MI bound type does not specify a bound value, and it is not caught by the if statements, an index error is raised since the lines list is an unexpected length.
Proposed Solution
Adding an additional clause to readMPSSetBounds in pulp.mps_lp.
I am uncertain if this causes side effects, as I have not tested the solution against the unit-tests myself. I have successfully used this as a "patch" to finish my conversion effort.
I couldn't find any documentation discussing the support of MI bound types, so my assumption is that they are supported. If I am incorrect, disregard this issue.
Useful extra information
What operating system are you using?
Windows: (11, Version 10.0.22631 Build 22631)
I'm using python version:
3.11
I installed PuLP via:
pypi (python -m pip install pulp)
Other: conda (conda environment, pulp is installed via pip, no other packages)
thanks! could you make a Pull Request with this change so that we can run the unit tests? and, if you have a small .mps file with this unsupported behavior, could you add it as a unit test?
Details for the issue
What did you do?
I attempted to read an
.mps
file usingpulp.LpProblem.fromMPS
.I discovered the issue when converting problems to
pulp
style.json
files, and an.mps
file containing anMI
type bound causedpulp
to error.MI
bounds specify that the lower bound is-inf
for a variable (see note E here)MPS File bounds section (simplified):
What did you expect to see?
Successful file read.
What did you see instead?
IndexError
raised.In the function
readMPSSetBounds
, a series of checks are made against the bound type. Bound types that do not specify a bound value are caught and handled separately (currentlyFR
,BV
, andPL
are caught). If the type is not caught, the bound value is read from thelines
object, which is a list.Since the
MI
bound type does not specify a bound value, and it is not caught by the if statements, an index error is raised since thelines
list is an unexpected length.Proposed Solution
Adding an additional clause to
readMPSSetBounds
inpulp.mps_lp
.I am uncertain if this causes side effects, as I have not tested the solution against the unit-tests myself. I have successfully used this as a "patch" to finish my conversion effort.
I couldn't find any documentation discussing the support of
MI
bound types, so my assumption is that they are supported. If I am incorrect, disregard this issue.Useful extra information
What operating system are you using?
I'm using python version:
I installed PuLP via:
Did you also
The text was updated successfully, but these errors were encountered: