numnom
A fast MPS file parser written in Rust.
Features
- Fast: 745 MB/s throughput on raw MPS text
- Zero-copy parsing: borrows from input buffer — minimal allocations during parsing
- Direct CSC output: builds sparse column-wise matrix during parsing with no intermediate storage
- Compressed files: reads
.mps.gzwith SIMD-accelerated decompression (zlib-rs) - Well-tested: 0 failures across all 1065 MIPLIB 2017 instances
Installation
# As a library
# As a CLI tool
Usage
CLI
# Parse and display summary
# Parse gzipped file
# Quiet mode (validate only, no output)
Example output:
Loading s82.mps.gz (decompressing)... done in 1.35s
s82 (min)
Statistics
----------
Rows 87.9K Cols 1.7M
Nonzeros 7.0M Density 0.0047%
Continuous 54
Binary 1.7M
Timing
------
Decompress 49.5MB -> 884.8MB in 299.8ms
Parse 884.8MB in 1.05s
Rows 6.9ms (1%)
Columns 580.9ms (56%)
RHS 0.1ms (0%)
Bounds 398.7ms (38%)
Finalize 43.0ms (4%)
Library
use ;
// Parse from file (supports .mps and .mps.gz)
let model = parse_mps_file.unwrap;
// Parse from string
let model = parse_mps_str.unwrap;
// Access model data
println!;
println!;
// Sparse matrix in CSC format
let col = 0;
let start = model.a_matrix.start as usize;
let end = model.a_matrix.start as usize;
for i in start..end
// Variable info
for in model.col_names.iter.enumerate
Model structure
MPS sections supported
| Section | Status |
|---|---|
| NAME | supported |
| OBJSENSE | supported |
| ROWS | supported |
| COLUMNS | supported |
| RHS | supported |
| BOUNDS (LO/UP/FX/FR/MI/PL/BV/LI/UI/SC/SI) | supported |
| RANGES | supported |
| INDICATORS, SOS, QUADOBJ, etc. | skipped |
Benchmarks
Tested on Apple M-series, single-threaded. All times include gzip decompression.
MIPLIB 2017 benchmark set (240 instances):
| Metric | numnom | SCIP |
|---|---|---|
| Shifted geomean (s=10ms) | 19ms | 82ms |
| Median | 10ms | 38ms |
| P90 | 118ms | 243ms |
| Max | 930ms | 2.9s |
| Speedup (shifted geomean) | 4.2x |
Correctness validated against SCIP via russcip on all 1065 MIPLIB 2017 instances (0 failures).
Per-instance results: benchmarks.csv
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.