Skip to content

opvious/highs.ts

Repository files navigation

HiGHS for Node.js CI codecov License

Native Node.js bindings for the HiGHS optimization solver.

import * as highs from 'highs-solver';

// Solves an LP model, outputting regular progress updates (gap, ...).
const solution = await highs.solve('model.lp', {
  monitor: highs.solveMonitor().on('progress', console.log),
  options: {time_limit: 600, mip_rel_gap: 0.05},
  style: highs.SolutionStyle.PRETTY,
});

Packages

The following packages are available:

  • highs-solver, high-level idiomatic TypeScript API
  • highs-addon, low-level API mirroring the underlying C++ solver's

Related projects

  • https://github.com/lovasoa/highs-js, WebAssembly solver port. Both projects are complementary: highs-js runs in browsers and is well-suited for Web Workers; highs-solver provides non-blocking native performance on Node.js (~3x faster).
  • https://github.com/ERGO-Code/HiGHS, the underlying C++ HiGHS optimization solver which both this repository and highs-js bind to.

Development

This project uses pnpm.

pnpm i # Install and build dependencies (see addon README for requirements)
pnpm dlx husky install # Set up linting git hooks, only needed once
pnpm t # Run tests