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.0.tar.gz (26.9 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.0-cp38-abi3-win_amd64.whl (288.6 kB view details)

Uploaded CPython 3.8+Windows x86-64

numnom-0.4.0-cp38-abi3-musllinux_1_2_x86_64.whl (581.6 kB view details)

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

numnom-0.4.0-cp38-abi3-musllinux_1_2_aarch64.whl (528.0 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

numnom-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (369.9 kB view details)

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

numnom-0.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (350.2 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

numnom-0.4.0-cp38-abi3-macosx_11_0_arm64.whl (326.1 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

numnom-0.4.0-cp38-abi3-macosx_10_12_x86_64.whl (357.7 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: numnom-0.4.0.tar.gz
  • Upload date:
  • Size: 26.9 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.0.tar.gz
Algorithm Hash digest
SHA256 03d4db3c96199fe0bd74ace56f75eff64e5d8db30737b543a0dcd951b565b0e4
MD5 70f2452a746d6c2bf6fe48ad3fb28a79
BLAKE2b-256 14b6240b5f8181adf6c471706386dceda8200c12943092bc6e18b640d9ef3f91

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0.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.0-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: numnom-0.4.0-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 288.6 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.0-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 23605499a9490ccd9b6fd1d34ebfe2e6fe011c38275d1df98612550b6e261568
MD5 bf1005a3eab4707525191f023a2fd7aa
BLAKE2b-256 0cae52b83ecbbe24d29fcb4e9f1599241f5c407a0d66a92cf30e04cd2e422e63

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0-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.0-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for numnom-0.4.0-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5a4ffe5bc8caf39fc6e79370612eca3232ae5ab09fb8fe3d8d2781aa856f07fb
MD5 bfa8740ad3ecab9bf8f2b33d8cae747b
BLAKE2b-256 1451897e86cf0d383056dacfe00d73f5fc6c880913f2357b737a7bb747cbda29

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0-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.0-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for numnom-0.4.0-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 067011be95f9ed2709db71948f1e914b274af86bcc30826b2b92c87873cd98fe
MD5 0bde4c9427ec30a1b77ea2f93a958911
BLAKE2b-256 80c226a61dfc325cf2922b4c50108c6855e438640f327c5f2a42ba84c814cb50

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0-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.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for numnom-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ffe012a707345feff3e33f63f9d8c48d519fc175eed864eb6456569cfbf7062
MD5 bff13fb6dbf276cfb6b4d40e59fceb61
BLAKE2b-256 5ef0d1122d8377bffc7872ca699a6cd4f3e71f9a228d2935cc579286efcb2a5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0-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.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for numnom-0.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2a7987167776ce34a3da5a6c6ad0042fd863e0fb6131c91e51722b85d5b60648
MD5 967661c0351f1907c78559580b57b893
BLAKE2b-256 91ed8d77d3c7639c72e7efc589c7674938a59ea081cd641397049f3bb006f2fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0-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.0-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: numnom-0.4.0-cp38-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 326.1 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.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3fefbfdf4da6c9d2cff41fce054643658a9de494b85dbce0a00afbceeb4d72a4
MD5 eb6dd9ae3bd3857e34b26ec5ca6cf8e4
BLAKE2b-256 e7e7448863727a9904e07086837482b66982a6ef6753c7f8d3ce34228669d352

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0-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.0-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for numnom-0.4.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f6fde782d76f6cfeb6e9f9aeef51739a5c9abd26bc814fc1124baad682c67a19
MD5 3d6a903958848d5a049eadafaf12fba0
BLAKE2b-256 a3ff7764df1ec8faf7453fdfdd2e9e8044112cbe2b99c27a88b5feb67dbc16fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for numnom-0.4.0-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