Add shell-based HiGHS solver interface#3922
Open
KasimVali2207 wants to merge 1 commit intoPyomo:mainfrom
Open
Conversation
Adds HIGHSSHELL, a SystemCallSolver that writes LP/MPS files and invokes the HiGHS command-line executable, bypassing the per-variable Python loop overhead that makes the highspy-based persistent interface slow on large models (issue Pyomo#3894). SolverFactory('highs') now defaults to the shell interface. solver_io='mps' selects MPS file format. solver_io='direct' routes to the highspy persistent backend. The persistent highspy interface is re-registered as 'highs_persistent' to free the 'highs' name for the shell interface, consistent with how Pyomo names cplex/cplex_persistent and gurobi/gurobi_persistent. Also adds tests covering factory dispatch, command-line construction, log-file and solution-file parsing, and full round-trip integration.
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.
Fixes #3894
Summary
The existing
highspy-based HiGHS interface builds the problem in memory by iterating over variables and constraints in Python, which becomes a bottleneck for large models. This PR adds a file-based shell interface that avoids this overhead entirely.Changes
New:
pyomo/solvers/plugins/solvers/HIGHS.pyHIGHS: factory entry point registered asSolverFactory('highs'). Dispatches to the shell interface by default, or to the persistenthighspybackend whensolver_io='direct'.HIGHSSHELL: aSystemCallSolverthat writes an LP or MPS file, invokes thehighsexecutable, and parses the solution and log files. Supports LP, MPS, duals, reduced costs, and all standard termination statuses (optimal, infeasible, unbounded, time limit, iteration limit).Modified:
pyomo/contrib/solver/plugins.pyhighspyinterface is now registered ashighs_persistent(legacy namehighs_persistent_v2), consistent with how Pyomo handlescplex/cplex_persistentandgurobi/gurobi_persistent.New:
pyomo/solvers/plugins/solvers/tests/test_highs_shell.pyUsage
Testing