coin-or / coin-or/pulp

Unsupported bound type "MI"

Open
#886 1 comment 0 reactions 0 assignees View on GitHub
lp/mps
Dominant language
Python
Stars
2.5k
Forks
433
PR merge metrics
No merged PRs in 30d

Description

Details for the issue
--------------------

#### What did you do?
I called
```py
pulp.LpProblem.fromMPS("problem.mps")
```
with this problem

[problem.zip](https://github.com/user-attachments/files/23588034/problem.zip)

#### What did you expect to see?
I expected the problem to be loaded without errors.

#### What did you see instead?
This error (output truncated)
> File "/home/runner/work/Antares_Simulator/Antares_Simulator/src/tests/cucumber/features/steps/common_steps/mps_utils.py", line 4, in load_problem
> return pulp.LpProblem.fromMPS(path)[1]
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/pulp/pulp.py", line 1702, in fromMPS
> data = mpslp.readMPS(filename, sense=sense, dropConsNames=dropConsNames)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/pulp/mps_lp.py", line 244, in readMPS
> readMPSSetBounds(line, variable_info) # type: ignore[arg-type]
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/site-packages/pulp/mps_lp.py", line 289, in readMPSSetBounds
> raise const.PulpError(f"Unknown bound {bound}")
> pulp.constants.PulpError: Unknown bound UI

Useful extra information
-------------------------
It looks like this line was added between 3.0.2 and 3.3.0
```py
else:
raise const.PulpError(f"Unknown bound {bound}")
```
in the last nested if..else case, making `fromMPS` less tolerant to unknown bound types such as "UI".

According to [this page](https://lpsolve.sourceforge.net/5.5/mps-format.htm), UI should be a valid bound qualifier
> UI integer variable (0 <=) x <= b

#### What operating system are you using?
I have been able to reproduce in these environments

- [X] Windows: ( _version: Windows Server 2022)
- [X] Linux: ( _distro: Ubuntu 22.04)
- [ ] Mac OS: ( _version:_ ___ )
- [ ] Other: ___

#### I'm using python version:

- [ ] 3.7
- [ ] 3.8
- [ ] 3.9
- [ ] 3.10
- [ ] 3.11
- [X] Other: 3.12

#### I installed PuLP via:

- [X] pypi (python -m pip install pulp)
- [ ] github (python -m pip install -U git+https://github.com/coin-or/pulp)
- [ ] Other: ___ (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

Contributor guide

Open the contributing guide

Research direction

Start in pulp/mps_lp.py at readMPSSetBounds and reproduce the failure with the attached problem archive, noting that the report title says MI while the traceback reports UI. Done means the supplied MPS problem loads through LpProblem.fromMPS without the reported unsupported-bound error, with regression coverage added for the accepted bound type.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.