Skip to content

Add cupdlpx.read() to load MPS files from Python#98

Merged
ZedongPeng merged 4 commits into
MIT-Lu-Lab:mainfrom
ZedongPeng:feature/python-read-mps
Jul 7, 2026
Merged

Add cupdlpx.read() to load MPS files from Python#98
ZedongPeng merged 4 commits into
MIT-Lu-Lab:mainfrom
ZedongPeng:feature/python-read-mps

Conversation

@ZedongPeng

Copy link
Copy Markdown
Collaborator

Fixes #19

Summary

Adds cupdlpx.read(filename), a gurobipy-style API that loads an MPS file
(plain or .gz) into a Model via the existing C MPS parser:

m = cupdlpx.read("problem.mps")
m.optimize()

OBJSENSE MAXIMIZE in the file sets ModelSense automatically.

Changes

  • New read_mps pybind11 binding wrapping read_mps_file(); mps_parser.h gains extern "C" guards.
  • mps_parser.c now builds on Windows (strtok_r/strdup MSVC shims), so the CMake exclusion is removed.
  • Tests (test/test_read_mps.py) and README docs.
  • Unrelated fix: feasibility-polishing summary no longer prints when verbose is off.

@ZedongPeng ZedongPeng requested a review from LucasBoTang July 6, 2026 15:42
Comment thread src/mps_parser.c
Comment thread python_bindings/_core_bindings.cpp Outdated
@ZedongPeng ZedongPeng requested a review from LucasBoTang July 7, 2026 01:58
@ZedongPeng ZedongPeng merged commit 9a3c258 into MIT-Lu-Lab:main Jul 7, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for loading MPS file to Python interface

2 participants