Replace mwpf's HiGHS LP backend with a pure-Rust simplex shim (no more cmake) - #461
Merged
Conversation
…ng the cmake requirement
… pecos-highs-shim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The optional
mwpfdecoder feature was the only reason PECOS builds needed cmake: mwpf's vendoredhighswrapper pullshighs-sys, which builds the HiGHS C++ LP solver via cmake. This PR replaces that wrapper with two dependency-free pure-Rust crates, wired in through[patch."https://github.com/yuewuo/mwpf"]— no fork of mwpf, no upstream changes, same pinned revision:crates/pecos-lp— the solver itself, named for what it does: a small dense two-phase tableau simplex with Bland's rule, sized for decoder-relaxation LPs. Owned PECOS primitive, reusable by future work (e.g. LP-relaxation distance bounds).crates/pecos-highs-shim— a thin facade (package namehighs, forced by cargo's patch mechanics) exposing exactly the API subset mwpf'sfloat_lppath uses, delegating to pecos-lp.cmake,
highs-sys, and the C++ toolchain requirement are gone from the dependency graph (cargo tree -p pecos-mwpfshows only the path-patched shim; Cargo.lock dropscmakeandhighs-sys).pecos rust check/clippy/testno longer refuse to run without cmake, andpecos python buildenables mwpf unconditionally (opt out withPECOS_BUILD_MWPF=0).New
crates/pecos-mwpf/tests/differential.rs: an explicitly-invoked (ignored-by-default) oracle harness that decodes a deterministic 800-shot stream on hyperedge-rich DEMs and dumps/compares per-shot observable masks, for comparing LP backends shot-for-shot.Solver design
Preprocessing (bound shifts, negations, free-variable splits, equality rows as inequality pairs) feeds a two-phase dense tableau simplex. Numerical safeguards, each adversarially motivated:
SolveErrorinstead ofOptimal, so numerical trouble is loud (mwpf panics) rather than a silently corrupted decode.Verification
JointSingleHairwithcluster_node_limit, not solver error. 1611 LP solves exercised, up to 116 columns x 133 rows.Optimalon mwpf-shaped LPs at the 58-pair scale, worst constraint violation 2.78). Fixed as above; the reviewer's own reproducer now matches HiGHS to 12 significant digits, and re-running the reviewer's census harnesses gives 0 wrong answers in 2000 cases at the failing scale plus 2000 more at mid scale. At double mwpf's observed LP size (100 pairs), 1 case in 500 trips the feasibility audit and fails loudly — documented headroom limit, not silent corruption.just lintclean across the repo;cargo clippy -p highs -p pecos-mwpf --all-targetszero warnings; full workspace clippy is exercised by CI's--all-featuresgate, which previously compiled HiGHS via cmake on every run and now builds the shim instead.Out of scope (follow-ups)
python-release.yml); that machinery, thepecos install cmakevendoring path, anddocs/user-guide/cmake-setup.mdare now vestigial and can be retired in a dedicated PR.mwpffeature remains opt-in on pecos-rslib for localcargouse; whether to flip it on by default is a separate decision.