highs-solver

0.6.0 • Public • Published

HiGHS solver NPM version

Node.js binding for the HiGHS optimization solver.

Features

  • Native solver performance, equivalent to running the C++ HiGHS executable directly
  • Non-blocking solves, optionally emitting progress updates (optimality gap, LP iterations, ...)
  • Performance boosters: warm start, live objective and constraint updates, ...

Installation

npm i highs-solver

If your system's architecture doesn't match one of the prebuilt addons, the addon will be built automatically during installation. This requires a compatible toolchain, refer to the corresponding installation steps for details.

Examples

import * as highs from 'highs-solver';

Solve LP file

const solution = await highs.solve('my-model.lp', {
  options: {time_limit: 30, mip_rel_gap: 0.05, /* ... */},
  style: highs.SolutionStyle.PRETTY,
});

All file formats (.lp, .mps, ...) and options supported by HiGHS may be passed in.

Monitor solving progress

const solution = await highs.solve('my-large-model.mps', {
  monitor: highs.solveMonitor().on('progress', (prog) => {
    // Called each time the solver emits a progress notification.
    console.log(prog);
  }),
  // Other options...
});

The monitor's 'progress' event includes information such as optimality gap, number of LP iterations, ...

Warm start

const solver = highs.Solver.create();
solver.setModel(/* Model instance */);
solver.warmStart({primalColumns: new Float64Array(/* Starting point */)});
await solver.solve();
const solution = solver.getSolution();

Models set from a file can be warmstarted similarly.

Package Sidebar

Install

npm i highs-solver

Weekly Downloads

7

Version

0.6.0

License

Apache-2.0

Unpacked Size

42.5 kB

Total Files

13

Last publish

Collaborators

  • opvious-eng