![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
This is a javascript linear programming library. It is built by compiling HiGHS to WebAssembly using emscripten.
This is a javascript linear programming library. It is built by compiling HiGHS to WebAssembly using emscripten.
const highs = await require("highs")();
const PROBLEM = `Maximize
obj: x1 + 2 x2 + 3 x3 + x4
Subject To
c1: - x1 + x2 + x3 + 10 x4 <= 20
c2: x1 - 3 x2 + x3 <= 30
c3: x2 - 3.5 x4 = 0
Bounds
0 <= x1 <= 40
2 <= x4 <= 3
End`;
const sol = Module.solve(PROBLEM);
assert.deepEqual(sol, {
Columns: {
x1: {
Index: 0,
Status: 'UB',
Lower: 0,
Upper: 40,
Primal: 40,
Dual: 1.29167,
Name: 'x1'
},
x2: {
Index: 1,
Status: 'BS',
Lower: 0,
Upper: Infinity,
Primal: 10.2083,
Dual: -0,
Name: 'x2'
},
x3: {
Index: 2,
Status: 'BS',
Lower: 0,
Upper: Infinity,
Primal: 20.625,
Dual: -0,
Name: 'x3'
},
x4: {
Index: 3,
Status: 'BS',
Lower: 2,
Upper: 3,
Primal: 2.91667,
Dual: -0,
Name: 'x4'
}
},
Rows: [
{
Index: 0,
Status: 'UB',
Lower: -Infinity,
Upper: 20,
Primal: 20,
Dual: -1.64583
},
{
Index: 1,
Status: 'UB',
Lower: -Infinity,
Upper: 30,
Primal: 30,
Dual: -1.35417
},
{
Index: 2,
Status: 'FX',
Lower: 0,
Upper: 0,
Primal: 0,
Dual: -4.41667
}
]
});
This package requires a wasm file.
You can find it in node_modules/highs/build/highs.wasm
inside the NPM package,
or download it from the release page.
By default, it will be loaded from the same path as the javascript file,
which mean you have to add the wasm file to your assets.
Alternatively, if you don't want to bother with that, you can load the file directly from github:
const highs_loader = require("highs");
const highs = await highs_loader({
locateFile: (file) => "https://lovasoa.github.io/highs-js/" + file
});
See the online demo at: https://lovasoa.github.io/highs-js/
FAQs
Mixed integer linear programming library, built by compiling a high-performance C++ solver developed by the University of Edinburgh (HiGHS) to WebAssembly.
The npm package highs receives a total of 1,535 weekly downloads. As such, highs popularity was classified as popular.
We found that highs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.