pulp icon indicating copy to clipboard operation
pulp copied to clipboard

PuLP does not recognize PL bound type in .mps files

Open vladimirvalenta opened this issue 1 year ago • 1 comments

System: MacBook (INTEL CPU), Ventura 13.2, Python 3.8 PuLP 2.7.0

From Wikipedia : https://en.wikipedia.org/wiki/MPS_(format) The optional BOUNDS section specifies lower and upper bounds on individual variables, if they are not given by rows in the matrix. .... Bound type PL is for a free positive from zero to plus infinity, but as this is the normal default, it is seldom used.

About 10% of models in MipLib2017 benchmark contain PL Bound variable lines and PuLP throws an exception when running var, prob = LpProblem.fromMPS(modelName)

The fix appears to be easy: in mps_lp.py, under readMPSSetBounds add two lines. There is no need to call set_both_bounds because the bounds are <0, infinity> which is the default

   if bound == "FR":
        set_both_bounds(None, None)
        return
    elif bound == "BV":
        set_both_bounds(0, 1)
        return
    # add these two lines
    elif bound == "PL":
        return

vladimirvalenta avatar Mar 07 '23 18:03 vladimirvalenta

I ran into exactly the same issue and came up, with the same solution.

rutger-van-beek-cqm avatar Apr 17 '24 14:04 rutger-van-beek-cqm