HiGHS is a high performance serial and parallel solver for large-scale sparse linear programming (LP) and mixed-integer programming (MIP) models developed in C++11, with interfaces to C, C#, FORTRAN, Julia and Python.
HiGHS is freely available under the MIT licence, and is downloaded from Github. Installing HiGHS from source code requires CMake minimum version 3.15, but no other third-party utilities. HiGHS can be used as a standalone executable on Windows, Linux and MacOS. There is a C++11 library which can be used within a C++ project or, via one of the interfaces, to a project written in other languages.
Information on how to install and use HiGHS is given in the guide below, and full documentation can be built using doxygen. Your comments or specific questions on HiGHS would be greatly appreciated, so please send an email to firstname.lastname@example.org to get in touch with the team.
HiGHS is downloaded from https://github.com/ERGO-Code/HiGHS . A simple cloned copy is obtained by the command
git clone email@example.com:ERGO-Code/HiGHS.git
The latest revision
(version 1.0.0) is
master. In the instructions below on
building HiGHS, running it as an executable and installing its
library, HiGHS is assumed to have been downloaded to a folder
HiGHS can load LP and MIP models from data files or via data provided by another application. It can solve LP models using implementations of the dual revised simplex method and an interior point method, and MIP models using branch-and-bound. The solution can be written to a file or retrieved directly for use within an application. Within an application, HiGHS can be used to modify the current model and re-solve it efficiently.
HiGHS uses CMake as a build system. The simplest setup is to create
a build folder (within the folder into which HiGHS has been
downloaded) and then build HiGHS within it. The name of the build
folder is arbitrary but, assuming it is
full sequence of commands required is as follows
mkdir build cd build cmake .. make
This creates the executable
build/bin/highs. To perform a
quick test to see whether the compilation was successful,
ctest from within the build folder.
Note that HiGHS requires (at least) version 4.9 of the GNU gcc/g++ compiler.
Running HiGHS from the command line
In the following discussion, the name of the executable file
build/bin when building HiGHS is assumed to
highs. HiGHS can read plain text MPS files and LP
files (but not compressed files), and the following command solves the
HiGHS is controlled by means of options.
Running HiGHS from within an application
To run HiGHS from an application, the key requirements are to load a model, solve it and extract the results. Many users will want to get and set option values to control the way HiGHS runs. It is also possible to extract model data, modify a model and load a basis. HiGHS can perform other operations for specialist applications. HiGHS is linked into another application via a library.
Although HiGHS is written in C++, interfaces exist for C, C#, FORTRAN, Julia and Python. To within the limits of the language, they offer the same functionality that is available from C++, with method names that are either identical or distinguished by a consistent name extension. The discussion below refers to the C++ methods, followed by an account of the language-specific characteristics of the interfaces.
Example programs calling HiGHS from C, C#, FORTRAN, Julia and
Python are in
Before the C++ methods can be used, an instance of
Highs class must be created. Some methods are used
to return data, and the others return an indication of success. In
some cases this is a value of
HighsStatus, and in
others it is simply a boolean.
For full information on the detailed use of the HiGHS methods
discussed below, consult the documentation built
doxygen. This is created by
HiGHS/docs and viewed
HiGHS/docs/index.html into any web
Loading a model
The simplest way to use HiGHS to solve a model is to load a model
from a file using the method
readModel. Different file
formats are recognised from the filename extension. HiGHS can read
plain text MPS files and LP, but not compressed files. Alternatively,
in C++, data generated by an application can be passed to HiGHS via an
instance of the
HighsLp class populated by the user and
passed using the method
passModel. An overloading
passModel permits the data constituting an LP model to
be passed via individual parameters, and this is also possible in
languages where the
HighsLp structure cannot be used.
Solving a model
HiGHS is used to solve a model by calling the
run. By default, HiGHS minimizes the model's
objective function, but this can be switched.
Extracting the results
After solving a model, its status is the value returned by the
getModelStatus. This value is of
HighsModelStatus, and may be interpreted via the
names in the corresponding
enum. The solution and basis
are returned by the methods
getBasis respectively. Note that these
const references to internal data. HiGHS can also be
used to write the solution to a file using the
writeSolution, with the output going
stdout if the filename is blank.
Other items of scalar information relating to the solver outcome
are available by calling
getHighsInfo to obtain a const
reference to the internal
HighsInfo structure. This gives
access to the iteration counts (simplex, interior point and
crossover), the status of any primal and dual solution, the objective
function value, and information on any infeasibilities. Specifically,
for both primal and dual, it gives the number of infeasibilities
exceeding the tolerance, as well as the maximum and sum of all
infeasibilities. The objective function value and simplex iteration
count may also be obtained directly using the
getSimplexIterationCount, and this is also possible
via non-C++ interfaces.
Extracting model data
The numbers of column, rows and nonzeros in the model are returned
by the methods
getNumEntries respectively. A const reference to the
current model as an LP (in general a MIP) is returned by
getLp. Data for
subsets of columns and rows from the model may be extracted using the
getRows, and specific
matrix coefficients obtained using the
Modifying a model
The most immediate model modification is to change the sense of the
objective. By default, HiGHS minimizes the model's objective
function. The objective sense can be set to minimize (maximize) by
passing the value 1 (-1) to the
changeObjectiveSense. The cost coefficient or
bounds of a column are changed by passing its index and new value(s)
corresponding method for a row is
For the convenience of application developers, data for multiple
columns and rows can be changed in three different ways in HiGHS. This
is introduced in the case of column costs. The columns can be defined
by the first and last indices of the interval of columns whose costs
will be changed, together with the corresponding values. When costs
for a non-contiguous set of columns are changed, they may be specified
as a set of indices (which need not be ordered), the number of entries
in the set and the corresponding values. Alternatively, the columns to
be changed (not changed) may be specified by setting values of +1 (0)
in an integer mask of dimension equal to the number of columns,
together with a full-length vector of values. In all three cases, the
method used is called
changeColsCosts. The bounds of
multiple columns or rows are changed using the
An individual matrix coefficient is changed by passing its row
index, column index and new value to
To add a column or row to the model, pass the necessary data to the
respectively. Multiple columns and rows can be added using the
Columns or rows can be deleted from the model using the
deleteRows. As above,
the columns or rows to be deleted may be specified as a contiguous
interval, a set or via a mask. In the case of the latter, the new
indices of any remaining columns or rows are returned in place of the
entries of 0.
Loading a basis or solution
Any internal basis can be over-written by
setBasis. If no argument is given then an
"all-slack" basis is set up internally. Otherwise, if a
HighsBasis structire is passed, this will be used
as the internal basis.
HiGHS may be run from a user-defined solution by passing it to
HiGHS using the method
HiGHS has a suite of methods for operations with the invertible
representation of the current basis matrix . To use
these requires knowledge of the corresponding (ordered) basic
variables. This is obtained using the
getBasicVariables, with non-negative values being
columns and negative values corresponding to row indices plus one [so
-1 indicates row 0]. Methods
getBasisInverseCol yield a specific row or column
of . Methods
getBasisTransposeSolve yield the solution
of and respectively. Finally, the
yield a specific row or column of . In all cases,
HiGHS can return the number and indices of the nonzeros in the result.
The incumbent model in HiGHS can be cleared by
clearModel. This allows models to be built by
adding variables and constraints to an empty model. It is not
necessary to do this if a new model is passed to HiGHS.
The value used as infinity within HiGHS is returned
getHighsInfinity. The current (elapsed) run time (in
seconds) of HiGHS is returned by
HiGHS may be used to create a shared library. Running
from the build folder attempts to install the executable
/usr/local/bin, the library
/usr/local/lib, and the header files
/usr/local/include. For a custom installation based
cmake .. -DCMAKE_INSTALL_PREFIX=install_folder
Using HiGHS in a CMake project
To use the library from a CMake project
find_package(HiGHS) and add the correct path
Compiling and linking without CMake
An executable defined in the file
linked with the HiGHS library as follows. Assuming that the custom
installation is based in
install_folder, compile and run
g++ -o use_highs use_highs.cpp -I install_folder/include/ -L install_folder/lib/ -lhighs LD_LIBRARY_PATH=install_folder/lib/ ./use_highs
From an application written in C#, HiGHS is run by creating
HighsLpSolver instance thus
HighsLpSolver solver = new HighsLpSolver;
An LP model may then be read in from a
solver.readModel, or communicated to HiGHS by
passing its component arrays of data to
returns an object that can then be passed to
solver.passLp. The LP is solved
solver.run, and data extracted as described above
for the C++ interface.
The option values that control HiGHS are of
double. Options are referred to by
string identical to the name of their identifier. A
full specification of the options is given here.
Option values for the command line
When HiGHS is run from the command line, some fundamental option values may be specified directly. Many more may be specified via a file. Formally, the usage is
highs [OPTION...] [file]
using the following options.
File of model to solve.
Presolve: "choose" by default - "on"/"off" are alternatives.
Solver: "choose" by default - "simplex"/"ipm" are alternatives.
Parallel solve: "choose" by default - "on"/"off" are alternatives.
Run time limit (double).
File containing HiGHS options.
Note that if the
solver options is set
"ipm" then a MIP that is
read into HiGHS, or passed via
passModel, will be solved
as an LP.
Within an options file, values are specified line-by-line
option_name = value. An example file containing
default settings of all options is here.
Note that by setting the values of
write_solution_pretty appropriately, it is possible
to write the solution to
solution_file = "") or to a file in either a
pretty (human-readable) or simple (computer-readable) format.
Option values in applications
When HiGHS is run from an application, options values can be read
from a file using the method
modified values in an instance of
HighsOptions can be
passed to HiGHS via the method
value of an individual option can be changed by passing its name and
value to the method
setHighsOptionValue. These methods
HighsStatus error if an option name is
unrecognised or the value is illegal. The current value of an option
is obtained by passing its name to the
HiGHS is based on the high performance dual revised simplex implementation (HSOL) and its parallel variant (PAMI) developed by Qi Huangfu. Features such as presolve, crash and advanced basis start have been added by Julian Hall and Ivet Galabova. Other features and the interfaces have been written by Michael Feldmeier.
In the absence of a release paper, academic users of HiGHS are kindly requested to cite the following article
Parallelizing the dual revised simplex method, Q. Huangfu and J. A. J. Hall, Mathematical Programming Computation, 10 (1), 119-142, 2018. DOI: 10.1007/s12532-017-0130-5
Your comments or specific questions on HiGHS would be greatly appreciated, so please send an email to firstname.lastname@example.org to get in touch with the team.