Skip to content

[FEATURE] Add HiGHS LP solver as alternative to COIN-OR and GLPK - #9246

Merged
timosachsenberg merged 2 commits into
developfrom
copilot/add-highs-lp-solver
Apr 30, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
copilot/add-highs-lp-solver

Conversation

Copilot AI commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds HiGHS (https://github.com/ERGO-Code/HiGHS) as a third LP/MIP solver option in OpenMS alongside COIN-OR and GLPK.

Changes

CMake Configuration (cmake/cmake_findExternalLibs.cmake)

  • Added LP_SOLVER cache variable (values: AUTO, COIN, GLPK, HIGHS)
  • AUTO (default) tries COIN-OR first, then GLPK, then HiGHS
  • HiGHS is first looked for via find_package, then fetched via FetchContent (v1.10.0) if not found
  • Default GLPK version variables set when GLPK is not the selected solver

Config Header (src/openms/include/OpenMS/config.h.in)

  • Added OPENMS_HAS_HIGHS cmake define

LPWrapper Header (src/openms/include/OpenMS/DATASTRUCTURES/LPWrapper.h)

  • Forward declaration of Highs class
  • SOLVER_HIGHS added to SOLVER enum
  • HiGHS member variables (std::unique_ptr<Highs>, solution vector) in protected section
  • Updated GLPK forward declaration guard to #if !defined(OPENMS_HAS_COINOR) && !defined(OPENMS_HAS_HIGHS)

LPWrapper Implementation (src/openms/source/DATASTRUCTURES/LPWrapper.cpp)

Full HiGHS implementation for all LPWrapper methods:

  • Problem construction (addRow, addColumn, setBounds, setObjective)
  • Problem modification (deleteRow, setElement, setColumnType)
  • Problem I/O (readProblem via readModel, writeProblem via writeModel)
  • Solving (MIP via HiGHS's built-in branch-and-bound)
  • Solution access (getStatus, getObjectiveValue, getColumnValue)
  • Matrix introspection (getElement, getMatrixRow, getNonZeroEntries)

Tests (src/tests/class_tests/openms/source/LPWrapper_test.cpp)

  • Added HiGHS-specific test paths mirroring the COIN-OR test coverage
  • Tests verify: problem reading (MPS), solving, status, objective value, column values, write/read roundtrip

Other

  • src/tests/class_tests/openms/CMakeLists.txt: Link LPWrapper_test against ${LPTARGET} instead of hardcoded CoinOR::CoinOR
  • src/topp/OpenMSInfo.cpp: Report "HiGHS" as LP solver when selected

How to Use

# Use HiGHS explicitly (fetches from GitHub if not installed)
cmake -DLP_SOLVER=HIGHS ...

# Auto-detect (tries COIN-OR → GLPK → HiGHS)
cmake -DLP_SOLVER=AUTO ...

# Or install HiGHS system-wide and it will be found via find_package

Testing

The LPWrapper_test covers the same functionality as the COIN-OR tests:

  • Problem construction and manipulation
  • Reading MPS files
  • Solving LP and MIP problems
  • Verifying optimal solutions

Integrate HiGHS as a third LP solver option via CMake's FetchContent.
The LP_SOLVER CMake cache variable allows choosing: AUTO, COIN, GLPK, or HIGHS.
AUTO tries COIN-OR first, then GLPK, then HiGHS (fetched if not found).

Agent-Logs-Url: https://github.com/OpenMS/OpenMS/sessions/ebacca47-3574-40b7-8b84-bba9fe9bc5ac

Co-authored-by: jpfeuffer <[email protected]>
@timosachsenberg

Copy link
Copy Markdown
Contributor

I think moving to HiGHS as standard solver would be a good way forward. Do you know what the package situation on conda etc. and platforms is?

@jpfeuffer

jpfeuffer commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Basically non-existent. That's why I used fetch content.

@jpfeuffer

Copy link
Copy Markdown
Contributor

We need to check how long it builds and which dependencies it has to see if this is a viable solution.

@jpfeuffer

Copy link
Copy Markdown
Contributor

takes 15 seconds here. looks like no dependencies.

@timosachsenberg

Copy link
Copy Markdown
Contributor

sounds great. if we get a student for vcpkg / build system we might be able to create ports or recipes for it. what do you think?

@timosachsenberg
timosachsenberg requested a review from pjones April 30, 2026 09:05
@pjones

pjones commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

sounds great. if we get a student for vcpkg / build system we might be able to create ports or recipes for it. what do you think?

It depends on how much time it takes to get everything else into vcpkgs. OpenMS now has a lot of dependencies where we clone Git repos and build them (three new such dependencies were added yesterday). All of those need to be turned into vcpkg ports.

Going forward we are going to have to require that anyone adding a dependency first add that dependency to our vcpkg overlay.

@pjones
pjones removed their request for review April 30, 2026 09:32
@timosachsenberg

Copy link
Copy Markdown
Contributor

sounds great. if we get a student for vcpkg / build system we might be able to create ports or recipes for it. what do you think?

It depends on how much time it takes to get everything else into vcpkgs. OpenMS now has a lot of dependencies where we clone Git repos and build them (three new such dependencies were added yesterday). All of those need to be turned into vcpkg ports.

Going forward we are going to have to require that anyone adding a dependency first add that dependency to our vcpkg overlay.

And conda recipes I guess.

Let's see how this flies in practice e.g. if we can just generate those. That could really clean things up but at the same time mean that we need to maintain the ports.
I guess our external contributors (like Michael) would otherwise need a hand here.

@jpfeuffer
jpfeuffer marked this pull request as ready for review April 30, 2026 11:54

@jpfeuffer jpfeuffer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ready to merge

@timosachsenberg
timosachsenberg requested a review from pjones April 30, 2026 12:20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the way this is implemented. I'm currently building this branch to see if there are any issues.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything builds and looks good to me.

@timosachsenberg
timosachsenberg merged commit 9cc2dfb into develop Apr 30, 2026
41 checks passed
@timosachsenberg
timosachsenberg deleted the copilot/add-highs-lp-solver branch April 30, 2026 13:33
timosachsenberg pushed a commit that referenced this pull request May 1, 2026
Add missing entries for:
- HiGHS LP solver as third LP backend alternative (#9246)
- Fix: FeatureFinderAlgorithmPicked mz_tolerance parameter swap (#9247, #9250)

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request May 4, 2026
…9260)

The HiGHS LP solver was added in #9246 as a third supported backend
(alongside GLPK and COIN-OR), selected via LP_SOLVER=AUTO/COIN/GLPK/HIGHS.
AGENTS.md and the developer FAQ were updated in #9253, but the Doxygen
class description and constructor docstring in LPWrapper.h still referred
only to GLPK and COIN-OR.

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
timosachsenberg pushed a commit that referenced this pull request May 5, 2026
…ference (#9265)

The LP_SOLVER option (AUTO/COIN/GLPK/HIGHS) was introduced with HiGHS
support (#9246) and the WITH_WNETALIGN option was added with the WNet
feature alignment feature (#8992). Both are user-configurable CMake cache
variables but were missing from the common-cmake-parameters.doxygen
reference table included in all platform install guides.

Co-authored-by: GitHub Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants