Skip to main content

A fast MPS file parser for mathematical programming

Project description

numnom

PyPI

A fast MPS file parser for Python, powered by Rust.

  • Fast: 745 MB/s throughput on raw MPS text (4.2× faster than SCIP on MIPLIB 2017)
  • Zero-copy numpy arrays: model data lands directly in numpy with no extra copies
  • Compressed files: reads .mps.gz with SIMD-accelerated decompression
  • Well-tested: 0 failures across all 1065 MIPLIB 2017 instances

Install

pip install numnom

# Optional: scipy.sparse integration
pip install "numnom[scipy]"

Usage

import numnom

model = numnom.parse_file("problem.mps.gz")

print(model.name, model.num_row, "rows,", model.num_col, "cols")
print("Nonzeros:", model.a_matrix.value.size)

# Numpy arrays — zero-copy from Rust
model.col_cost      # np.ndarray[float64], shape (num_col,)
model.col_lower     # np.ndarray[float64]
model.col_upper     # np.ndarray[float64]
model.row_lower     # np.ndarray[float64]
model.row_upper     # np.ndarray[float64]
model.col_integrality  # np.ndarray[uint8] — see numnom.{CONTINUOUS,INTEGER,...}

# CSC sparse matrix
A = model.a_matrix
A.start    # np.ndarray[uint32], shape (num_col + 1,)
A.index    # np.ndarray[uint32], shape (nnz,)
A.value    # np.ndarray[float64], shape (nnz,)

# Names
model.col_names    # list[str]
model.row_names    # list[str]

scipy.sparse integration

import numnom

model = numnom.parse_file("problem.mps")
A = numnom.to_scipy(model)   # scipy.sparse.csc_matrix, shape (num_row, num_col)

Parse from string

mps_text = open("problem.mps").read()
model = numnom.parse_str(mps_text)

Write MPS

numnom.write_file(model, "out.mps")
mps_text = numnom.write_str(model)

Variable type codes

model.col_integrality is a uint8 array; values map to:

Code Constant Meaning
0 numnom.CONTINUOUS Continuous
1 numnom.INTEGER Integer
2 numnom.SEMI_CONTINUOUS Semi-continuous
3 numnom.SEMI_INTEGER Semi-integer

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numnom-0.4.3.tar.gz (27.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

numnom-0.4.3-cp38-abi3-win_arm64.whl (273.7 kB view details)

Uploaded CPython 3.8+Windows ARM64

numnom-0.4.3-cp38-abi3-win_amd64.whl (289.4 kB view details)

Uploaded CPython 3.8+Windows x86-64

numnom-0.4.3-cp38-abi3-musllinux_1_2_x86_64.whl (581.8 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

numnom-0.4.3-cp38-abi3-musllinux_1_2_aarch64.whl (528.3 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

numnom-0.4.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (370.0 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

numnom-0.4.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (350.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

numnom-0.4.3-cp38-abi3-macosx_11_0_arm64.whl (326.3 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

numnom-0.4.3-cp38-abi3-macosx_10_12_x86_64.whl (357.8 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file numnom-0.4.3.tar.gz.

File metadata

  • Download URL: numnom-0.4.3.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numnom-0.4.3.tar.gz
Algorithm Hash digest
SHA256 089ae97a113951343af2379e241f7c5a985caac14b1570a5e630c0e740e466c7
MD5 5b30116bd075c2e1e01a8e387cfb2c76
BLAKE2b-256 a2ed7b884e233167fbbe5b9d4a00829729dcc35bbc9eaf0a66cc59d709abede6

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3.tar.gz:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-win_arm64.whl.

File metadata

  • Download URL: numnom-0.4.3-cp38-abi3-win_arm64.whl
  • Upload date:
  • Size: 273.7 kB
  • Tags: CPython 3.8+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numnom-0.4.3-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 bc64ed35d167a8328e7e4c7d6a0f608039972771b3e4ae6b5dbc2862f1db9403
MD5 c119f229a0beb0fa34b6b64f6accff70
BLAKE2b-256 29bb8384798bb7fc58072dd0c07148c762bedeb2bfed824e37c47617d2d74a81

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-win_arm64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: numnom-0.4.3-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 289.4 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numnom-0.4.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 dec53b1ef0cf76539e0c9229a665e64c779fbed00c2bfcc71c7e63fc37166071
MD5 74cb809f4aaa21320bc451ed19859763
BLAKE2b-256 aadda2644765f7893621b501589b0f595df0de1af7f7106e823097d1ed91d394

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-win_amd64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for numnom-0.4.3-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d226203e0f24d1ec2b21a8d1585b16a19943eb7932eb6e7d650ba798ca6f0fc4
MD5 2c53c6900ed0e7a24896c3a743dd0726
BLAKE2b-256 dac70ecc9288dc2e4693831edfb66f2bc6b738405e8f5e734bc598343cf71514

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-musllinux_1_2_x86_64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for numnom-0.4.3-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a0b54139f36b8ffdcde02d5699cb41e415399d306db09c1276d6ea356ca40e99
MD5 3c8f55666138c41e5e1ca4dcd7dae446
BLAKE2b-256 805fc86bcef1131632962530b2f8a4e37edd3d2593413007007d66a8663ad228

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-musllinux_1_2_aarch64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for numnom-0.4.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d4fd275f9f80ca346a6ab220db6b6f4e974795608f5542112f17699a054510ee
MD5 5db2c4ff29c347748d819e99b089b848
BLAKE2b-256 13142aefe09ec15d70f827f791252fd573ef2aea551129bb123d19c77081a771

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for numnom-0.4.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a9e7224c04f2fb8edc72f95a4a2734772a336610706dd3cd6d22acde23a35942
MD5 eb284e5f9cdd05fde94a95e52068533a
BLAKE2b-256 8ccb823cdfb58c9ea5b579daba749279e8dd116a60c5ab693e0cebe5eb027f48

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: numnom-0.4.3-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 326.3 kB
  • Tags: CPython 3.8+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for numnom-0.4.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e1d6863a910c28d2da24961185cbbe933778c69158b551af4efa32886a6def45
MD5 1d5ce594b922ca7fae52bfcf84ffc6eb
BLAKE2b-256 e28d9957be542659f60820e4dbf3ed04d6cc0f68fac9f260f0c0d14ec274ad06

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file numnom-0.4.3-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for numnom-0.4.3-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 15e8a53149a2a9203cf80bafb166689f5a200ec24e6785379411a3039318035b
MD5 a76f01643f01f1965762a08ae71f7d3a
BLAKE2b-256 68c35b5a0f77ad7518ecf2e35e915bc1979474367707ff75f39acea85444361d

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.3-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: python.yml on mmghannam/numnom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page