Skip to content
 
 

Latest commit

 

History

14,432 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HiGHS - Linear optimization software

Build Status Build Status Build Status Build Status
Conan Center
PyPi PyPi
NuGet version NuGet download

About HiGHS

HiGHS is a high performance serial and parallel solver for large scale sparse linear optimization problems of the form

$$ \min \quad \dfrac{1}{2}x^TQx + c^Tx \qquad \textrm{s.t.}~ \quad L \leq Ax \leq U; \quad l \leq x \leq u $$

where $Q$ must be positive semi-definite and, if $Q$ is zero, there may be a requirement that some of the variables take integer values. Thus HiGHS can solve linear programming (LP) problems, convex quadratic programming (QP) problems, and mixed integer programming (MIP) problems. It is mainly written in C++, but also has some C. It has been developed and tested on various Linux, MacOS and Windows installations. No third-party dependencies are required.

HiGHS has primal and dual revised simplex solvers, originally written by Qi Huangfu and further developed by Julian Hall. It also has an interior point solver for LP written by Lukas Schork, an active set solver for QP written by Michael Feldmeier, and a MIP solver written by Leona Gottwald. Other features have been added by Julian Hall and Ivet Galabova, who manages the software engineering of HiGHS and interfaces to C, C#, FORTRAN, Julia and Python.

Find out more about HiGHS at https://www.highs.dev.

Although HiGHS is freely available under the MIT license, we would be pleased to learn about users' experience and give advice via email sent to highsopt@gmail.com.

Capabilities at a glance

flowchart TB
  highs["HiGHS<br/>large-scale sparse optimization"]
  highs --> lp["LP"]
  highs --> qp["convex QP"]
  highs --> mip["MIP"]

  lp --> simplex["revised simplex<br/>(dual / primal)"]
  lp --> ipm["interior point<br/>(IPX, HiPO)"]
  lp --> pdlp["first-order PDLP<br/>(cuPDLP, optional GPU)"]
  qp --> ipm
  qp --> qpasm["active-set QP<br/>(qpasm)"]
  mip --> bnc["branch-and-cut<br/>+ heuristics"]
  bnc -. "binary subMIP" .-> quantum["quantum / SBM<br/>heuristic"]

  highs -. interfaces .-> ifaces["C++ · C · C# · Fortran<br/>Julia · Python · Rust"]
Loading
  • Problem classes — linear (LP), convex quadratic (QP, Q positive semidefinite), and mixed-integer (MIP).
  • Solver engines — dual/primal revised simplex, two interior-point solvers (IPX and HiPO; HiPO also solves convex QP), a first-order PDLP solver (CPU and optional NVIDIA GPU via cuPDLP), an active-set QP solver (qpasm), and a branch-and-cut MIP solver with a portfolio of primal heuristics.
  • Performance machinery — presolve/postsolve, a dependency-free in-house parallel task scheduler, warm starting, ranging, and IIS (irreducible infeasible subsystem) detection.
  • Interfaces — the highs executable; the C++ Highs class; C, C#, Fortran, and Julia APIs; the highspy Python package; and the Rust highs / highs-sys crates.
  • Fork additions — a quantum / Simulated-Bifurcation oscillator-Ising MIP heuristic, plus acceleration features (cuPDLP+ first-order algorithmics, mixed-precision interior point with an analog inner-solve bridge, a CPU tensor-core Ozaki-scheme GEMM, an ADMM/OSQP-style QP path, two-column presolve probing, and vectorized ratio-test kernels). See the documentation's Capabilities & use cases, Acceleration, and Quantum heuristic pages.

Documentation

Documentation is available at https://ergo-code.github.io/HiGHS/.

Installation

Build from source using CMake

HiGHS uses CMake as build system, and requires at least version 3.15. To generate build files in a new subdirectory called 'build', run:

    cmake -S . -B build
    cmake --build build

This installs the executable bin/highs and the library lib/highs.

To test whether the compilation was successful, change into the build directory and run

    ctest

More details on building with CMake can be found in HiGHS/cmake/README.md.

HiGHS is a C++17 project (the installed CMake target exports cxx_std_17, so a consumer using find_package(HiGHS) is compiled as C++17).

Clang and sanitizer builds

To build with a modern Clang/LLVM toolchain:

    cmake -S . -B build-clang -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
    cmake --build build-clang

Optional ergonomics: -DHIGHS_USE_LLD=ON (link with lld), -DHIGHS_USE_LIBCXX=ON (Clang + libc++), -DHIGHS_COLOR_DIAGNOSTICS=ON (default).

Sanitizers are selected with the combinable HIGHS_SANITIZER option (address, undefined, thread, leak, memory; address/thread/memory are mutually exclusive). It instruments both C and C++ and links the shared library accordingly:

    cmake -S . -B build-asan -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
      -DHIGHS_SANITIZER="address;undefined" -DALL_TESTS=ON \
      -DHIGHS_SANITIZE_IGNORELIST=$PWD/sanitize-ignorelist.txt
    cmake --build build-asan
    ASAN_OPTIONS=detect_leaks=1 UBSAN_OPTIONS=print_stacktrace=1 ctest --test-dir build-asan

Runtime suppression files for vendored code and the in-house task scheduler live in tools/ (tsan_suppressions.txt, lsan_suppressions.txt, …) and sanitize-ignorelist.txt. MemorySanitizer (memory) is Clang-only and needs an MSan-instrumented libc++. The deprecated DEBUG_MEMORY option still works as an alias for HIGHS_SANITIZER. Meson exposes the same via -Db_sanitize=... and Bazel via --config=asan|tsan|lsan|ubsan|asan_ubsan.

Build with Meson

As an alternative, HiGHS can be installed using the meson build interface:

meson setup bbdir -Dwith_tests=True
meson test -C bbdir

The meson build files are provided by the community and are not officially supported by the HiGHS development team. If you use this method and encounter issues, please consider contributing fixes or updates by checking the HiGHS Contribution Guide.

Build with Nix

There is a nix flake that provides the highs binary:

nix run .

You can even run without installing anything, supposing you have installed nix:

nix run github:ERGO-Code/HiGHS

The nix flake also provides the python package:

nix build .#highspy
tree result/

And a devShell for testing it:

nix develop .#highspy
python
>>> import highspy
>>> highspy.Highs()

The nix build files are provided by the community and are not officially supported by the HiGHS development team.

Precompiled binaries

Precompiled static binaries are available at https://github.com/ERGO-Code/HiGHS/releases.

Additionally, there is one package containing shared libraries for Windows x64.

The *-mit binary packages contain HiGHS and are MIT-licenced. The *-apache binary packages contain HiGHS with HiPO and are Apache-licenced, due to the licensing of the dependencies of HiPO. For more information, see THIRD_PARTY_NOTICES.md.

If you have any questions or requests for more platforms and binaries, please get in touch with us at hello@highs.dev.

Running HiGHS

HiGHS can read MPS files and (CPLEX) LP files, and the following command solves the model in ml.mps

    highs ml.mps

Command line options

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:

$ bin/highs --help
usage:
      ./bin/highs [options] [file]

options:
      --model_file file          File of model to solve.
      --options_file file        File containing HiGHS options.
      --read_solution_file file  File of solution to read.
      --read_basis_file text     File of initial basis to read.
      --write_model_file text    File for writing out model.
      --solution_file text       File for writing out solution.
      --write_basis_file text    File for writing out final basis.
      --presolve text            Set presolve option to:
                                   "choose" * default
                                   "on"
                                   "off"
      --solver text              Set solver option to:
                                   "choose" * default
                                   "simplex"
                                   "ipm"
      --parallel text            Set parallel option to:
                                   "choose" * default
                                   "on"
                                   "off"
      --run_crossover text       Set run_crossover option to:
                                   "choose"
                                   "on" * default
                                   "off"
      --time_limit float         Run time limit (seconds - double).
      --random_seed int          Seed to initialize random number
                                 generation.
      --ranging text             Compute cost, bound, RHS and basic
                                 solution ranging:
                                   "on"
                                   "off" * default
  -v, --version                  Print version.
  -h, --help                     Print help.

For a full list of options, see the options page of the documentation website.

Common workflows and use cases

By default HiGHS chooses a solver from the model; you can also set --solver explicitly. The decision, at a glance:

flowchart TB
  start["model"] --> q_int{"integer<br/>variables?"}
  q_int -- yes --> mip["MIP: branch-and-cut + heuristics<br/>(Feasibility-Jump, sbm / quantum)"]
  q_int -- no --> q_hess{"quadratic<br/>objective?"}
  q_hess -- yes --> qp["QP: HiPO or qpasm"]
  q_hess -- "no (LP)" --> q_size{"very large &<br/>moderate accuracy ok?"}
  q_size -- yes --> pdlp["PDLP first-order<br/>(optional GPU)"]
  q_size -- no --> q_warm{"warm start /<br/>re-solve?"}
  q_warm -- yes --> splx["revised simplex"]
  q_warm -- no --> ipm["interior point<br/>(IPX / HiPO)"]
Loading

Worked, runnable models live in examples/. A few starting points:

Workflow Try Problem type
Command line highs model.mps (--solver=pdlp, --parallel=on, --time_limit=…) any LP/QP/MIP
Python (highspy) examples/minimal.py, call_highs_from_python_highspy.py build & solve in code
0/1 knapsack examples/knapsack.py binary MIP
Min-cost network flow examples/network_flow.py LP with duals
N-queens examples/nqueens.py binary feasibility
Blending / distillation examples/distillation.py continuous LP
Production planning examples/chip.py MIP
Column generation examples/branch-and-price.py branch-and-price
Multi-objective examples/multi_objective.py lexicographic / blended
MIP with live callbacks examples/callback_gap.py watching the gap
C++ library examples/call_highs_from_cpp.cpp native Highs class
Rust crate highs/interfaces/rust/ safe highs wrapper
MIP + physical-analogue heuristic highs-quantum solve model.mps --backend sbm oscillator-Ising incumbents

Interfaces

There are HiGHS interfaces for C, C#, FORTRAN, and Python in HiGHS/highs/interfaces, with example driver files in HiGHS/examples/. More on language and modelling interfaces can be found at https://ergo-code.github.io/HiGHS/stable/interfaces/other/.

We are happy to give a reasonable level of support via email sent to highsopt@gmail.com.

Python

The python package highspy is a thin wrapper around HiGHS and is available on PyPi. It can be easily installed via pip by running

$ pip install highspy

Alternatively, highspy can be built from source. Download the HiGHS source code and run

pip install .

from the root directory.

The HiGHS C++ library no longer needs to be separately installed. The python package highspy depends on the numpy package and numpy will be installed as well, if it is not already present.

The installation can be tested using the small example HiGHS/examples/call_highs_from_python_highspy.py.

The Google Colab Example Notebook also demonstrates how to call highspy.

C

The C API is in HiGHS/highs/interfaces/highs_c_api.h. It is included in the default build. For more details, check out the documentation website https://ergo-code.github.io/HiGHS/.

CSharp

The nuget package Highs.Native is on https://www.nuget.org, at https://www.nuget.org/packages/Highs.Native/.

It can be added to your C# project with dotnet

dotnet add package Highs.Native --version 1.14.0

The nuget package contains runtime libraries for

  • win-x64
  • win-x32
  • linux-x64
  • linux-arm64
  • macos-x64
  • macos-arm64

Details for building locally can be found in nuget/README.md.

Fortran

The Fortran API is in HiGHS/highs/interfaces/highs_fortran_api.f90. It is not included in the default build. For more details, check out the documentation website https://ergo-code.github.io/HiGHS/.

Rust

Rust bindings live in highs/interfaces/rust/ as a two-crate Cargo workspace: highs-sys (raw bindgen FFI over the C API) and highs (a safe, idiomatic wrapper with an expression DSL, typed errors, and a GIL-free parallel runtime for solving many models concurrently). The default build compiles HiGHS from source via CMake; cargo test --no-default-features links a prebuilt tree for a fast loop.

use highs::{Highs, ModelStatus};

// max 2x + 3y  s.t.  x + y <= 4,  x + 3y <= 6,  x, y >= 0
let mut h = Highs::new().silenced();
let x = h.add_var(0.0, f64::INFINITY)?;
let y = h.add_var(0.0, f64::INFINITY)?;
h.add_constr((x + y).le(4.0))?;
h.add_constr((x + 3.0 * y).le(6.0))?;
h.maximize(2.0 * x + 3.0 * y)?;
assert_eq!(h.run()?, ModelStatus::Optimal);
println!("objective = {}", h.objective_value()); // 9

See highs/interfaces/rust/README.md for build options, feature flags, and the parallel runtime.

Reference

If you use HiGHS in an academic context, please acknowledge this and 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

About

Optimized linear, quadratic, and physical analogue pathways

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages