High Performance Optimization Software for solving linear programming (LP), mixed integer linear programming (MILP), and quadratic programming (QP) problems
Comprehensive assistance with HiGHS development, generated from official documentation.
HiGHS is open-source software for defining, modifying, and solving large-scale sparse linear optimization models. It's freely available under MIT license with no third-party dependencies.
Use this skill when:
HiGHS can solve problems of the form:
Linear Programming (LP):
minimize c^T x
subject to L ≤ Ax ≤ U
l ≤ x ≤ u
Mixed Integer Linear Programming (MILP): Same as LP, but some variables must take integer values.
Quadratic Programming (QP):
LP with additional objective term ½x^T Q x where Q is positive semi-definite.
(Note: Cannot solve integer QP problems)
Initialize HiGHS and solve a model from file:
import highspy
import numpy as np
h = highspy.Highs()
# Read a model from MPS file
filename = 'model.mps'
status = h.readModel(filename)
print('Reading model file', filename, 'returns a status of', status)
# Solve the model
h.run()
# Get solution
solution = h.getSolution()
info = h.getInfo()
Build an optimization model programmatically:
# Problem:
# minimize f = x0 + x1
# subject to x1 <= 7
# 5 <= x0 + 2x1 <= 15
# 6 <= 3x0 + 2x1
# 0 <= x0 <= 4; 1 <= x1
import highspy
h = highspy.Highs()
x0 = h.addVariable(lb = 0, ub = 4)
x1 = h.addVariable(lb = 1, ub = 7)
h.addConstr(5 <= x0 + 2*x1 <= 15)
h.addConstr(6 <= 3*x0 + 2*x1)
h.minimize(x0 + x1)
Complete MILP example using Julia's C API wrapper:
using HiGHS
highs = Highs_create()
ret = Highs_setBoolOptionValue(highs, "log_to_console", false)
@assert ret == 0 # If ret != 0, something went wrong
# Add columns (variables)
Highs_addCol(highs, 1.0, 0.0, 4.0, 0, C_NULL, C_NULL) # x is column 0
Highs_addCol(highs, 1.0, 1.0, Inf, 0, C_NULL, C_NULL) # y is column 1
# Set y as integer variable
Highs_changeColIntegrality(highs, 1, kHighsVarTypeInteger)
# Set objective to minimize
Highs_changeObjectiveSense(highs, kHighsObjSenseMinimize)
# Solve
Highs_run(highs)
using JuMP
import HiGHS
model = Model(HiGHS.Optimizer)
set_optimizer_attribute(model, "presolve", "on")
set_optimizer_attribute(model, "time_limit", 60.0)
# Define your optimization model...
@variable(model, x >= 0)
@variable(model, y >= 0)
@objective(model, Min, x + y)
@constraint(model, 5 <= x + 2*y <= 15)
optimize!(model)
Important: Direct array access is slow in Python. Convert to list first!
import highspy
h = highspy.Highs()
h.readModel('model.mps')
h.run()
# Get solution object
solution = h.getSolution()
# SLOW: Accessing directly from solution.col_value
# for i in range(num_cols):
# val = solution.col_value[i] # Takes 0.04s
# FAST: Convert to list first
col_value = list(solution.col_value)
for i in range(num_cols):
val = col_value[i] # Takes 0.0001s (400x faster!)
import highspy
h = highspy.Highs()
# Set common options
h.setOptionValue("presolve", "on")
h.setOptionValue("time_limit", 100.0)
h.setOptionValue("mip_rel_gap", 0.01)
# Choose specific solver
h.setOptionValue("solver", "simplex") # or "ipm", "pdlp", "hipo"
# For GPU acceleration with PDLP
h.setOptionValue("solver", "pdlp")
h.setOptionValue("kkt_tolerance", 1e-4) # Recommended for PDLP
# Basic solve
$ bin/highs model.mps
# With options file
$ bin/highs --options_file=my_options.txt model.mps
# Write solution to file
$ bin/highs --solution_file=solution.txt model.mps
# See all command line options
$ bin/highs --help
Example options file (my_options.txt):
solver = pdlp
kkt_tolerance = 1e-4
presolve = on
time_limit = 300
// Add a single column (variable)
Highs_addCol(highs, cost, lower, upper, num_new_nz, index, value)
// Add multiple columns
Highs_addCols(highs, num_new_col, costs, lower, upper, num_new_nz,
starts, index, value)
// Change coefficient in constraint matrix
Highs_changeCoeff(highs, row, col, new_value)
// Change variable bounds
Highs_changeColBounds(highs, col, new_lower, new_upper)
// Change objective coefficient
Highs_changeColCost(highs, col, new_cost)
// Set variable as integer
Highs_changeColIntegrality(highs, col, kHighsVarTypeInteger)
# Clone repository
git clone https://github.com/ERGO-Code/HiGHS.git
# Build with CMake
cd HiGHS
cmake -S. -B build
cmake --build build --parallel
# For C# support
cmake -S. -Bbuild -DCSHARP=ON
# Python
$ pip install highspy
# Julia
julia> using Pkg
julia> Pkg.add("HiGHS")
# C# (NuGet)
$ dotnet add package Highs.Native --version 1.12.0
# Linux (install dependencies for HiPO)
$ sudo apt update
$ sudo apt install libopenblas-dev
This skill includes comprehensive documentation in references/:
Complete API reference for all language interfaces:
Advanced features and usage patterns:
Use view to read specific reference files when detailed information is needed.
Via Package Managers:
pip install highspy or conda install highsusing Pkg; Pkg.add("HiGHS")From Source:
git clone https://github.com/ERGO-Code/HiGHS.git
cd HiGHS
cmake -S. -B build
cmake --build build --parallel
.mps - MPS format (industry standard).lp - CPLEX LP format.gz - Compressed files (gzip)Key Classes:
HighsLp - Linear programming model dataHighsModel - General optimization model (includes QP)HighsSparseMatrix - Sparse matrix representationHighsHessian - Quadratic objective HessianHighsSolution - Solution data (primal/dual values)HighsBasis - Basis status informationHighsInfo - Solver statistics and convergence infoImportant Enums:
HighsModelStatus - Model status (optimal, infeasible, unbounded, etc.)HighsVarType - Variable types (continuous, integer, semi-continuous, etc.)ObjSense - Objective sense (minimize, maximize)HighsStatus - Return status from API callsHiGHS uses absolute tolerances by default (default: 1e-7):
Important: PDLP uses relative tolerances. For PDLP, increase kkt_tolerance to 1e-4 for faster convergence with acceptable accuracy.
PDLP solver can run on NVIDIA GPUs (Linux/Windows only):
nvcc --versionHealth Warning: PDLP may not achieve same accuracy as simplex/IPM. Check HighsInfo for actual feasibility values.
HiGHS supports callbacks for:
references/getting_started.md for installation and basic conceptsreferences/terminology.mdreferences/api.md (Python section)references/options.md for tuningreferences/guide.md (Further features)references/api.md for language-specific detailsreferences/solvers.md - choose optimal solverreferences/guide.md (GPU section)references/guide.md (Feasibility and optimality)references/api.md (Python section) - Complete highspy examplesreferences/api.md (Julia section) - JuMP and C APIreferences/api.md (C++ section) - Native libraryreferences/api.md (C section) - Low-level interfaceHiGHS is competitive with commercial solvers. See:
Organized documentation extracted from official sources. These files contain:
Add helper scripts here for common automation tasks (e.g., batch solving, result analysis).
Add templates, boilerplate, or example projects here.
If you use HiGHS in an academic context, please cite:
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
HighsInfo for infeasibility/unboundedness indicatorskkt_tolerance to 1e-4 (recommended)HighsInfo for actual infeasibility valuessetOptionValue("presolve", "on")passModel() rather than building incrementallyTo refresh this skill with updated documentation:
python3 cli/doc_scraper.py --config configs/highs.json