#linear-programming-solver #linear-programming #optimization-solver

highs

Safe rust bindings for the HiGHS linear programming solver. See http://highs.dev.

28 releases (11 stable)

new 2.0.0 Nov 12, 2025
1.12.0 Jul 25, 2025
1.11.0 Jun 7, 2025
1.8.0 Mar 1, 2025
0.4.0 Mar 19, 2021

#146 in Algorithms

Download history 1417/week @ 2025-07-22 1203/week @ 2025-07-29 1328/week @ 2025-08-05 1357/week @ 2025-08-12 1878/week @ 2025-08-19 1399/week @ 2025-08-26 1664/week @ 2025-09-02 783/week @ 2025-09-09 621/week @ 2025-09-16 898/week @ 2025-09-23 877/week @ 2025-09-30 639/week @ 2025-10-07 777/week @ 2025-10-14 582/week @ 2025-10-21 842/week @ 2025-10-28 874/week @ 2025-11-04

3,224 downloads per month
Used in 7 crates (4 directly)

MIT license

50KB
914 lines

highs

highs docs badge

Safe rust bindings to the Highs MILP Solver. Best used from the good_lp linear programming modeler.

Usage examples

Building a problem variable by variable

use highs::{ColProblem, Sense};

fn main() {
    let mut pb = ColProblem::new();
    // We cannot use more then 5 units of sugar in total.
    let sugar = pb.add_row(..=5);
    // We cannot use more then 3 units of milk in total.
    let milk = pb.add_row(..=3);
    // We have a first cake that we can sell for 2€. Baking it requires 1 unit of milk and 2 of sugar.
    pb.add_integer_column(2., 0.., &[(sugar, 2.), (milk, 1.)]);
    // We have a second cake that we can sell for 8€. Baking it requires 2 units of milk and 3 of sugar.
    pb.add_integer_column(8., 0.., &[(sugar, 3.), (milk, 2.)]);
    // Find the maximal possible profit
    let solution = pb.optimise(Sense::Maximise).solve().get_solution();
    // The solution is to bake one cake of each sort
    assert_eq!(solution.columns(), vec![1., 1.]);
}

Building a problem constraint by constraint

use highs::*;

fn main() {
    let mut pb = RowProblem::new();
    // Optimize 3x - 2y with x<=6 and y>=5
    let x = pb.add_column(3., ..6);
    let y = pb.add_column(-2., 5..);
    pb.add_row(2.., &[(x, 3.), (y, 8.)]); // 2 <= x*3 + y*8
}

Dependencies

~5.5–7.5MB
~157K SLoC