inst/HiGHS/highs/HighsRun.md

Highs::run()

Highs::run() has evolved a great deal since it was first created to "solve" the LP in the HighsLp instance Highs::lp_. As well as solving more problem classes, and using more solvers, features have been added inelegantly. The simplicity of having a single Highs::run() method, with different features obscured within it will be replaced by multiple, nested, "solve" methods which are explicit in their features and very much simpler.

The only refactoring came when the multiple objective code was added: Highs::optimizeModel() inherited the content of Highs::run() so that a single call toHighs::run() could perform multiple optimizations.

Other developments that have been implemented inelegantly are

Actioning executable run-time options via Highs::run()

As #2269 highlighted, users of cvxpy can only execute Highs::run(), so the following actions that were previously in app/RunHighs.cpp, are now performed in Highs::run()

There is still one action inapp/RunHighs.cpp that should be performed in Highs::run()

These "HiGHS files" actions must only be performed at the "top level" of Highs::run(), and this is acheived by caching the file options in the Highs class and clearing them from options_ so that they aren't applied at lower level calls to Highs::run(). They are then restored before returning from Highs::run().

Performing user scaling

User objective and/or bound scaling is performed before assessing whether there is excessive problem data and suggesting user objective and bound scaling. These user scaling actions must only be performed at the "top level" of Highs::run(), and this is acheived by caching the user scaling options in the Highs class and clearing them from options_ so that they aren't applied at lower level calls to Highs::run(). If user scaling has been applied in a call to Highs::run(), it is unapplied and the option values restored before returning from Highs::run().

Applying "mods"

The HighsLp class contains data values and structures that cannot be handled explicitly by the solvers.

These modifications are currently performed in Highs::run(), with very careful code to ensure that they are removed before returning from Highs::run().

With the plan to allow indicator constraints and SOS as generalised disjunctive forms that will be reformulated, the handling of "mods" needs to be refactored!

Refactoring

The inelegance of Highs::run() (and Highs::optimizeModel()) was exposed by #2635. Both methods need to be refactored. Firstly, Highs::run() must be refactored into the following set of nested methods. By calling the appropriate method, there is no need to "hide" option settings by caching and then clearing their value.

Refactoring Highs::optimizeModel() is trickier. There needs to be a method where any "mods" are made, so that at the level below the problem defined by the HighsModel class (without semi-variables) is solved.

Highs::run

This "outer" layer can contain the "HiGHS files" actions that were previously in app/RunHighs.cpp, and user scaling

Highs::optimizeHighs()

The next layer applies any "mods" to the HighsModel class, and calls Highs::optimizeModel() or Highs::multiobjectiveSolve() if there are multiple objectives.

Highs::optimizeModel()

The next layer should just optimize what's in the HighsModel (without semi-variables)

Observations

ToDo



Try the highs package in your browser

Any scripts or data that you put into this service are public.

highs documentation built on Feb. 8, 2026, 5:06 p.m.