@ohtaman/washi 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +60 -23
- package/README.md +59 -22
- package/README.zh-CN.md +62 -25
- package/THIRD_PARTY_LICENSES.md +34 -1
- package/dist/browser/solvers/glpk.js +289 -238
- package/dist/browser/solvers/glpk.min.js +1 -1
- package/dist/browser/solvers/highs-__vite-browser-external-Dn-83hnF.js +7 -0
- package/dist/browser/solvers/highs-browser-runtime-0Bgq5ksG.js +2021 -0
- package/dist/browser/{loader-DewlSho8.js → solvers/highs-loader-BLY3wzDH.js} +190 -149
- package/dist/browser/solvers/highs-worker.js +54 -0
- package/dist/browser/solvers/highs.js +1414 -0
- package/dist/browser/solvers/highs.wasm +0 -0
- package/dist/browser/solvers/pumpkin-_washi-pumpkin-node-runtime-CEKUDK6d.js +9 -0
- package/dist/browser/solvers/pumpkin-loader-CvdaKxf4.js +320 -0
- package/dist/browser/solvers/pumpkin-worker.js +45 -0
- package/dist/browser/solvers/pumpkin.js +1777 -0
- package/dist/browser/solvers/pumpkin.wasm +0 -0
- package/dist/browser/solvers/pumpkin.wasm.LICENSE +21 -0
- package/dist/browser/solvers/z3.js +1600 -1335
- package/dist/browser/solvers/z3.min.js +2 -2
- package/dist/browser/washi.js +3313 -1699
- package/dist/browser/washi.min.js +5 -3
- package/dist/lib/solvers/__vite-browser-external-oLchLuMx.js +7 -0
- package/dist/lib/solvers/glpk.js +174 -132
- package/dist/lib/solvers/highs-browser-runtime.js +2413 -0
- package/dist/lib/{highs-node-runtime.js → solvers/highs-node-runtime.js} +1 -1
- package/dist/lib/solvers/highs-runtime.js +16 -0
- package/dist/lib/solvers/highs-worker.js +54 -0
- package/dist/lib/solvers/highs.js +410 -0
- package/dist/lib/solvers/highs.wasm +0 -0
- package/dist/lib/{loader-BZUQNvh4.js → solvers/loader-CDpPXN_F.js} +138 -116
- package/dist/lib/solvers/loader-Ow74Fa1B.js +311 -0
- package/dist/lib/solvers/lp-writer-CLScMFbS.js +115 -0
- package/dist/lib/solvers/pumpkin-assets.js +1 -0
- package/dist/lib/solvers/pumpkin-node-runtime.js +15 -0
- package/dist/lib/solvers/pumpkin-worker-factory.js +1 -0
- package/dist/lib/solvers/pumpkin-worker.js +45 -0
- package/dist/lib/solvers/pumpkin.js +868 -0
- package/dist/lib/solvers/pumpkin.wasm +0 -0
- package/dist/lib/solvers/pumpkin.wasm.LICENSE +21 -0
- package/dist/lib/solvers/registry-CrYRRk9q.js +907 -0
- package/dist/lib/solvers/rolldown-runtime-DtPi1Y-2.js +13 -0
- package/dist/lib/solvers/types-BGqPkxwu.js +12 -0
- package/dist/lib/solvers/z3.js +489 -307
- package/dist/lib/washi.js +3905 -1410
- package/dist/types/decomposition/benders.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modeler/boolean-expr.d.ts +137 -29
- package/dist/types/modeler/boolean-expr.d.ts.map +1 -1
- package/dist/types/modeler/constraint.d.ts +40 -4
- package/dist/types/modeler/constraint.d.ts.map +1 -1
- package/dist/types/modeler/expression.d.ts +129 -2
- package/dist/types/modeler/expression.d.ts.map +1 -1
- package/dist/types/modeler/index.d.ts +4 -6
- package/dist/types/modeler/index.d.ts.map +1 -1
- package/dist/types/modeler/linearizer.d.ts +11 -2
- package/dist/types/modeler/linearizer.d.ts.map +1 -1
- package/dist/types/modeler/lp-writer.d.ts.map +1 -1
- package/dist/types/modeler/model.d.ts +86 -126
- package/dist/types/modeler/model.d.ts.map +1 -1
- package/dist/types/modeler/parser.d.ts.map +1 -1
- package/dist/types/modeler/quad-expr.d.ts +8 -2
- package/dist/types/modeler/quad-expr.d.ts.map +1 -1
- package/dist/types/modeler/solution-validator.d.ts +12 -12
- package/dist/types/modeler/solution-validator.d.ts.map +1 -1
- package/dist/types/modeler/solvers/glpk/loader.d.ts +4 -0
- package/dist/types/modeler/solvers/glpk/loader.d.ts.map +1 -1
- package/dist/types/modeler/solvers/glpk/solver.d.ts +2 -2
- package/dist/types/modeler/solvers/glpk/solver.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/driver.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/loader.d.ts +8 -6
- package/dist/types/modeler/solvers/highs/loader.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/solver.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/worker-client.d.ts +16 -0
- package/dist/types/modeler/solvers/highs/worker-client.d.ts.map +1 -1
- package/dist/types/modeler/solvers/index.d.ts +2 -1
- package/dist/types/modeler/solvers/index.d.ts.map +1 -1
- package/dist/types/modeler/solvers/mock.d.ts +2 -3
- package/dist/types/modeler/solvers/mock.d.ts.map +1 -1
- package/dist/types/modeler/solvers/pumpkin/assets.d.ts +2 -0
- package/dist/types/modeler/solvers/pumpkin/assets.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin/index.d.ts +6 -0
- package/dist/types/modeler/solvers/pumpkin/index.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin/loader.d.ts +40 -0
- package/dist/types/modeler/solvers/pumpkin/loader.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin/node-runtime.d.ts +3 -0
- package/dist/types/modeler/solvers/pumpkin/node-runtime.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin/solver.d.ts +23 -0
- package/dist/types/modeler/solvers/pumpkin/solver.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts +74 -0
- package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin/worker-factory.d.ts +3 -0
- package/dist/types/modeler/solvers/pumpkin/worker-factory.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin/worker.d.ts +7 -0
- package/dist/types/modeler/solvers/pumpkin/worker.d.ts.map +1 -0
- package/dist/types/modeler/solvers/pumpkin.d.ts +2 -0
- package/dist/types/modeler/solvers/pumpkin.d.ts.map +1 -0
- package/dist/types/modeler/solvers/types.d.ts +7 -9
- package/dist/types/modeler/solvers/types.d.ts.map +1 -1
- package/dist/types/modeler/solvers/z3/loader.d.ts +4 -0
- package/dist/types/modeler/solvers/z3/loader.d.ts.map +1 -1
- package/dist/types/modeler/solvers/z3/solver.d.ts +2 -15
- package/dist/types/modeler/solvers/z3/solver.d.ts.map +1 -1
- package/dist/types/modeler/types.d.ts +12 -15
- package/dist/types/modeler/types.d.ts.map +1 -1
- package/dist/types/modeler/validation.d.ts +26 -2
- package/dist/types/modeler/validation.d.ts.map +1 -1
- package/dist/types/modeler/variable.d.ts +9 -5
- package/dist/types/modeler/variable.d.ts.map +1 -1
- package/docs/examples/diet-sensitivity.md +33 -14
- package/docs/examples/ecommerce-coupons.md +17 -9
- package/docs/examples/index.md +36 -27
- package/docs/examples/knapsack.md +11 -5
- package/docs/examples/portfolio-qp.md +21 -8
- package/docs/examples/production.md +10 -5
- package/docs/examples/project-scheduling.md +119 -0
- package/docs/examples/shift-scheduling.md +29 -18
- package/docs/examples/smt-security.md +27 -11
- package/docs/examples/transportation.md +23 -13
- package/docs/examples/traveling-salesperson.md +34 -22
- package/docs/examples/unsat-core.md +27 -14
- package/docs/examples/vehicle-routing.md +74 -28
- package/docs/getting-started/ai-agents.md +190 -82
- package/docs/getting-started/coding-agents.md +177 -0
- package/docs/getting-started/cross-origin.md +27 -14
- package/docs/getting-started/index.md +49 -43
- package/docs/getting-started/runtimes.md +94 -40
- package/docs/guide/constraint-programming.md +171 -0
- package/docs/guide/constraints.md +115 -33
- package/docs/guide/decomposition.md +118 -88
- package/docs/guide/expressions.md +106 -43
- package/docs/guide/formulation-tips.md +47 -28
- package/docs/guide/objectives.md +102 -75
- package/docs/guide/unsat-core.md +62 -50
- package/docs/guide/variables.md +81 -35
- package/docs/solvers/custom-solver.md +163 -122
- package/docs/solvers/glpk.md +58 -17
- package/docs/solvers/highs.md +124 -57
- package/docs/solvers/index.md +33 -20
- package/docs/solvers/pumpkin.md +171 -0
- package/docs/solvers/z3.md +63 -25
- package/llms-full.txt +2232 -932
- package/llms.txt +144 -91
- package/package.json +55 -19
- package/skills/washi/SKILL.md +107 -34
- package/dist/browser/_washi-node-only-BvRk9kiK.js +0 -0
- package/dist/browser/browser-runtime-TLCY0hkc.js +0 -1793
- package/dist/browser/highs-worker.js +0 -39
- package/dist/browser/highs.wasm +0 -0
- package/dist/lib/_washi-node-only-BvRk9kiK.js +0 -0
- package/dist/lib/highs-browser-runtime.js +0 -2185
- package/dist/lib/highs-runtime.js +0 -2
- package/dist/lib/highs-worker.js +0 -39
- package/dist/lib/highs.wasm +0 -0
- package/dist/lib/registry-D7TZ3Wh_.js +0 -1034
- package/docs/ja/getting-started/ai-agents.md +0 -280
- package/docs/zh/getting-started/ai-agents.md +0 -280
- /package/dist/browser/{highs.wasm.LICENSE → solvers/highs.wasm.LICENSE} +0 -0
- /package/dist/lib/{highs-assets.js → solvers/highs-assets.js} +0 -0
- /package/dist/lib/{highs-worker-factory.js → solvers/highs-worker-factory.js} +0 -0
- /package/dist/lib/{highs.wasm.LICENSE → solvers/highs.wasm.LICENSE} +0 -0
|
@@ -8,8 +8,13 @@ function n() {
|
|
|
8
8
|
return t("highs.wasm");
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
11
|
+
//#region \0washi-node-runtime
|
|
12
|
+
function r() {
|
|
13
|
+
throw Error("This distribution is for browsers. Use the npm entry in Node.js.");
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
11
16
|
//#region src/modeler/solvers/highs/driver.ts
|
|
12
|
-
function
|
|
17
|
+
function i(e, t, n) {
|
|
13
18
|
if (n <= 0 || !t) return /* @__PURE__ */ new Float64Array();
|
|
14
19
|
let r = e.wasmMemory ? e.wasmMemory.buffer : e.HEAPF64 ? e.HEAPF64.buffer : e.HEAP8?.buffer;
|
|
15
20
|
if (r) return new Float64Array(r, t, n).slice();
|
|
@@ -17,15 +22,15 @@ function r(e, t, n) {
|
|
|
17
22
|
for (let r = 0; r < n; r++) i[r] = e.getValue(t + r * 8, "double");
|
|
18
23
|
return i;
|
|
19
24
|
}
|
|
20
|
-
var
|
|
25
|
+
var a = class extends Error {
|
|
21
26
|
constructor(e) {
|
|
22
27
|
super(e), this.name = "HighsError";
|
|
23
28
|
}
|
|
24
|
-
},
|
|
29
|
+
}, o = class extends a {
|
|
25
30
|
constructor(e) {
|
|
26
31
|
super(e), this.name = "HighsUnsupportedOptionError";
|
|
27
32
|
}
|
|
28
|
-
},
|
|
33
|
+
}, s = {
|
|
29
34
|
0: "Not Set",
|
|
30
35
|
1: "Load error",
|
|
31
36
|
2: "Model error",
|
|
@@ -45,7 +50,7 @@ var i = class extends Error {
|
|
|
45
50
|
16: "Solution limit reached",
|
|
46
51
|
17: "Interrupted",
|
|
47
52
|
18: "Memory limit reached"
|
|
48
|
-
},
|
|
53
|
+
}, c = {
|
|
49
54
|
callbackType: {
|
|
50
55
|
logging: 0,
|
|
51
56
|
simplexInterrupt: 1,
|
|
@@ -84,7 +89,7 @@ var i = class extends Error {
|
|
|
84
89
|
interrupt: 17
|
|
85
90
|
}
|
|
86
91
|
};
|
|
87
|
-
function
|
|
92
|
+
function l(e) {
|
|
88
93
|
return {
|
|
89
94
|
create: e.cwrap("Highs_create", "number", []),
|
|
90
95
|
destroy: e.cwrap("Highs_destroy", "void", ["number"]),
|
|
@@ -178,7 +183,7 @@ function c(e) {
|
|
|
178
183
|
stopCallback: e.cwrap("Highs_stopCallback", "number", ["number", "number"])
|
|
179
184
|
};
|
|
180
185
|
}
|
|
181
|
-
var
|
|
186
|
+
var u = 0, d = class {
|
|
182
187
|
highs;
|
|
183
188
|
module;
|
|
184
189
|
bindings;
|
|
@@ -189,7 +194,7 @@ var l = 0, u = class {
|
|
|
189
194
|
}
|
|
190
195
|
changeObjectiveOffset(e) {
|
|
191
196
|
let t = this.bindings.changeObjectiveOffset(this.highs, e);
|
|
192
|
-
if (t !== 0) throw new
|
|
197
|
+
if (t !== 0) throw new a(`Highs_changeObjectiveOffset failed with status ${t}`);
|
|
193
198
|
}
|
|
194
199
|
getObjectiveOffset() {
|
|
195
200
|
let e = this.module._malloc(8);
|
|
@@ -201,7 +206,7 @@ var l = 0, u = class {
|
|
|
201
206
|
}
|
|
202
207
|
options = { set: (e, t) => {
|
|
203
208
|
let n = -1;
|
|
204
|
-
if (typeof t == "boolean" ? n = this.bindings.setBoolOptionValue(this.highs, e, +!!t) : typeof t == "number" ? Number.isInteger(t) ? (n = this.bindings.setIntOptionValue(this.highs, e, t), n !== 0 && (n = this.bindings.setDoubleOptionValue(this.highs, e, t))) : n = this.bindings.setDoubleOptionValue(this.highs, e, t) : typeof t == "string" && (n = this.bindings.setStringOptionValue(this.highs, e, t)), n !== 0) throw new
|
|
209
|
+
if (typeof t == "boolean" ? n = this.bindings.setBoolOptionValue(this.highs, e, +!!t) : typeof t == "number" ? Number.isInteger(t) ? (n = this.bindings.setIntOptionValue(this.highs, e, t), n !== 0 && (n = this.bindings.setDoubleOptionValue(this.highs, e, t))) : n = this.bindings.setDoubleOptionValue(this.highs, e, t) : typeof t == "string" && (n = this.bindings.setStringOptionValue(this.highs, e, t)), n !== 0) throw new o(`Option "${e}" with value ${JSON.stringify(t)} is not supported or invalid in HiGHS`);
|
|
205
210
|
} };
|
|
206
211
|
getDimensions() {
|
|
207
212
|
return {
|
|
@@ -229,7 +234,7 @@ var l = 0, u = class {
|
|
|
229
234
|
try {
|
|
230
235
|
for (let r = 0; r < t; r++) this.module.setValue(n + r * 8, e.colValue[r], "double");
|
|
231
236
|
let r = this.bindings.setSolution(this.highs, n, 0, 0, 0);
|
|
232
|
-
if (r !== 0) throw new
|
|
237
|
+
if (r !== 0) throw new a(`Highs_setSolution failed with status ${r}`);
|
|
233
238
|
} finally {
|
|
234
239
|
this.module._free(n);
|
|
235
240
|
}
|
|
@@ -239,25 +244,26 @@ var l = 0, u = class {
|
|
|
239
244
|
let t = e.indices.length, n = this.module._malloc(t * 4), r = this.module._malloc(t * 8);
|
|
240
245
|
try {
|
|
241
246
|
for (let i = 0; i < t; i++) this.module.setValue(n + i * 4, e.indices[i], "i32"), this.module.setValue(r + i * 8, e.values[i], "double");
|
|
242
|
-
let
|
|
243
|
-
if (
|
|
247
|
+
let i = this.bindings.setSparseSolution(this.highs, t, n, r);
|
|
248
|
+
if (i !== 0) throw new a(`Highs_setSparseSolution failed with status ${i}`);
|
|
244
249
|
} finally {
|
|
245
250
|
this.module._free(n), this.module._free(r);
|
|
246
251
|
}
|
|
247
252
|
return;
|
|
248
253
|
}
|
|
249
|
-
throw new
|
|
254
|
+
throw new a("Invalid argument to setSolution (expected { colValue } or { indices, values })");
|
|
250
255
|
}
|
|
251
256
|
run(e) {
|
|
252
257
|
let t = 0, n = [];
|
|
253
|
-
if (e
|
|
254
|
-
|
|
258
|
+
if (e) {
|
|
259
|
+
if (typeof this.module.addFunction != "function") throw new a("HiGHS WebAssembly runtime does not support module.addFunction; progress and interrupt callbacks are unavailable.");
|
|
260
|
+
t = this.module.addFunction((t, n, r, a) => {
|
|
255
261
|
let o = e[t];
|
|
256
262
|
if (!o) return;
|
|
257
263
|
let s = {};
|
|
258
|
-
if (
|
|
259
|
-
let e = this.module.getValue(
|
|
260
|
-
p && m > 0 && (h =
|
|
264
|
+
if (r) {
|
|
265
|
+
let e = this.module.getValue(r + 8, "double"), t = this.module.getValue(r + 16, "i32"), n = this.module.getValue(r + 20, "i32"), a = this.module.getValue(r + 24, "i32"), o = this.module.getValue(r + 32, "double"), c = Number(this.module.getValue(r + 40, "i32")), l = Number(this.module.getValue(r + 48, "i32")), u = this.module.getValue(r + 56, "double"), d = this.module.getValue(r + 64, "double"), f = this.module.getValue(r + 72, "double"), p = this.module.getValue(r + 80, "i32"), m = this.module.getValue(r + 84, "i32"), h;
|
|
266
|
+
p && m > 0 && (h = i(this.module, p, m)), s = {
|
|
261
267
|
running_time: e,
|
|
262
268
|
simplex_iteration_count: t,
|
|
263
269
|
ipm_iteration_count: n,
|
|
@@ -314,19 +320,19 @@ var l = 0, u = class {
|
|
|
314
320
|
} finally {
|
|
315
321
|
this.module._free(n);
|
|
316
322
|
}
|
|
317
|
-
throw new
|
|
323
|
+
throw new a(`Info item "${e}" not available or unknown in HiGHS`);
|
|
318
324
|
} };
|
|
319
325
|
getSolution() {
|
|
320
|
-
let e = this.getDimensions(), t = e.numCols > 0 ? this.module._malloc(e.numCols * 8) : 0, n = e.numCols > 0 ? this.module._malloc(e.numCols * 8) : 0,
|
|
326
|
+
let e = this.getDimensions(), t = e.numCols > 0 ? this.module._malloc(e.numCols * 8) : 0, n = e.numCols > 0 ? this.module._malloc(e.numCols * 8) : 0, r = e.numRows > 0 ? this.module._malloc(e.numRows * 8) : 0, a = e.numRows > 0 ? this.module._malloc(e.numRows * 8) : 0;
|
|
321
327
|
try {
|
|
322
|
-
return this.bindings.getSolution(this.highs, t, n,
|
|
323
|
-
colValue:
|
|
324
|
-
colDual:
|
|
325
|
-
rowValue:
|
|
326
|
-
rowDual:
|
|
328
|
+
return this.bindings.getSolution(this.highs, t, n, r, a), {
|
|
329
|
+
colValue: i(this.module, t, e.numCols),
|
|
330
|
+
colDual: i(this.module, n, e.numCols),
|
|
331
|
+
rowValue: i(this.module, r, e.numRows),
|
|
332
|
+
rowDual: i(this.module, a, e.numRows)
|
|
327
333
|
};
|
|
328
334
|
} finally {
|
|
329
|
-
t && this.module._free(t), n && this.module._free(n),
|
|
335
|
+
t && this.module._free(t), n && this.module._free(n), r && this.module._free(r), a && this.module._free(a);
|
|
330
336
|
}
|
|
331
337
|
}
|
|
332
338
|
getObjectiveValue() {
|
|
@@ -346,29 +352,29 @@ var l = 0, u = class {
|
|
|
346
352
|
[Symbol.dispose]() {
|
|
347
353
|
this.destroy();
|
|
348
354
|
}
|
|
349
|
-
},
|
|
355
|
+
}, f = class {
|
|
350
356
|
module;
|
|
351
357
|
bindings;
|
|
352
|
-
constants =
|
|
358
|
+
constants = c;
|
|
353
359
|
errors = {
|
|
354
|
-
HighsError:
|
|
355
|
-
HighsUnsupportedOptionError:
|
|
360
|
+
HighsError: a,
|
|
361
|
+
HighsUnsupportedOptionError: o
|
|
356
362
|
};
|
|
357
363
|
constructor(e) {
|
|
358
|
-
this.module = e, this.bindings =
|
|
364
|
+
this.module = e, this.bindings = l(e);
|
|
359
365
|
}
|
|
360
366
|
withModel(e, t) {
|
|
361
|
-
let n = this.bindings.create(), r = new
|
|
362
|
-
if (!this.module.FS) throw new
|
|
367
|
+
let n = this.bindings.create(), r = new d(this.module, this.bindings, n), i = `/model_${++u}.${e.format}`;
|
|
368
|
+
if (!this.module.FS) throw new a("Emscripten FS is not initialized on this HiGHS module instance");
|
|
363
369
|
let o = this.module.FS;
|
|
364
370
|
try {
|
|
365
|
-
o.writeFile(
|
|
366
|
-
let s = this.bindings.readModel(n,
|
|
367
|
-
if (s !== 0) throw new
|
|
371
|
+
o.writeFile(i, e.data);
|
|
372
|
+
let s = this.bindings.readModel(n, i);
|
|
373
|
+
if (s !== 0) throw new a(`Failed to load ${e.format.toUpperCase()} model into HiGHS (status ${s})`);
|
|
368
374
|
return t(r);
|
|
369
375
|
} finally {
|
|
370
376
|
try {
|
|
371
|
-
o.unlink(
|
|
377
|
+
o.unlink(i);
|
|
372
378
|
} catch {}
|
|
373
379
|
r.destroy();
|
|
374
380
|
}
|
|
@@ -378,9 +384,7 @@ var l = 0, u = class {
|
|
|
378
384
|
format: "lp",
|
|
379
385
|
data: e
|
|
380
386
|
}, (e) => {
|
|
381
|
-
for (let [n, r] of Object.entries(t))
|
|
382
|
-
e.options.set(n, r);
|
|
383
|
-
} catch {}
|
|
387
|
+
for (let [n, r] of Object.entries(t)) e.options.set(n, r);
|
|
384
388
|
e.run();
|
|
385
389
|
let n = e.getModelStatus(), r = e.getDimensions(), i = e.getSolution(), a = {};
|
|
386
390
|
for (let t = 0; t < r.numCols; t++) {
|
|
@@ -393,39 +397,91 @@ var l = 0, u = class {
|
|
|
393
397
|
};
|
|
394
398
|
}
|
|
395
399
|
return {
|
|
396
|
-
Status:
|
|
400
|
+
Status: s[n] ?? "Unknown",
|
|
397
401
|
StatusCode: n,
|
|
398
402
|
ObjectiveValue: e.getObjectiveValue(),
|
|
399
403
|
Columns: a
|
|
400
404
|
};
|
|
401
405
|
});
|
|
402
406
|
}
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
|
|
407
|
+
}, p = [
|
|
408
|
+
"mip_max_nodes",
|
|
409
|
+
"mip_max_improving_sols",
|
|
410
|
+
"mip_max_leaves",
|
|
411
|
+
"simplex_iteration_limit",
|
|
412
|
+
"ipm_iteration_limit"
|
|
413
|
+
], m = /* @__PURE__ */ new Set([
|
|
414
|
+
"timeLimit",
|
|
415
|
+
"outputFlag",
|
|
416
|
+
"presolve",
|
|
417
|
+
"solver",
|
|
418
|
+
"relativeGap",
|
|
419
|
+
"absoluteGap",
|
|
420
|
+
"wasmUrl",
|
|
421
|
+
"signal",
|
|
422
|
+
"onProgress",
|
|
423
|
+
"onIncumbent",
|
|
424
|
+
"relax",
|
|
425
|
+
"useWorker",
|
|
426
|
+
"objectiveOffset",
|
|
427
|
+
"initialValues",
|
|
428
|
+
...p
|
|
429
|
+
]);
|
|
430
|
+
function h(e = {}) {
|
|
431
|
+
if (e.threads !== void 0) throw Error("Solver \"HiGHS\" does not support option \"threads\" (HiGHS WebAssembly runs single-threaded).");
|
|
432
|
+
if (e.verbose !== void 0) throw Error("Solver \"HiGHS\" does not support option \"verbose\"; use \"outputFlag\" instead.");
|
|
433
|
+
for (let [t, n] of Object.entries(e)) if (n !== void 0 && !m.has(t)) throw Error(`Solver "HiGHS" does not support option "${t}".`);
|
|
434
|
+
if (e.useWorker !== void 0 && typeof e.useWorker != "boolean") throw Error(`Invalid HiGHS option "useWorker": expected boolean, got ${typeof e.useWorker}.`);
|
|
435
|
+
if (e.outputFlag !== void 0 && typeof e.outputFlag != "boolean") throw Error(`Invalid HiGHS option "outputFlag": expected boolean, got ${typeof e.outputFlag}.`);
|
|
436
|
+
if (e.relax !== void 0 && typeof e.relax != "boolean") throw Error(`Invalid HiGHS option "relax": expected boolean, got ${typeof e.relax}.`);
|
|
437
|
+
if (e.presolve !== void 0 && e.presolve !== "on" && e.presolve !== "off" && e.presolve !== "choose") throw Error(`Invalid HiGHS option "presolve" (${String(e.presolve)}): expected "on", "off", or "choose".`);
|
|
438
|
+
if (e.timeLimit !== void 0 && (typeof e.timeLimit != "number" || !Number.isFinite(e.timeLimit) || e.timeLimit < 0)) throw Error(`Invalid HiGHS option "timeLimit" (${String(e.timeLimit)}): expected a finite non-negative number of seconds.`);
|
|
439
|
+
if (e.relativeGap !== void 0 && (typeof e.relativeGap != "number" || !Number.isFinite(e.relativeGap) || e.relativeGap < 0)) throw Error(`Invalid HiGHS option "relativeGap" (${String(e.relativeGap)}): expected a finite non-negative number.`);
|
|
440
|
+
if (e.absoluteGap !== void 0 && (typeof e.absoluteGap != "number" || !Number.isFinite(e.absoluteGap) || e.absoluteGap < 0)) throw Error(`Invalid HiGHS option "absoluteGap" (${String(e.absoluteGap)}): expected a finite non-negative number.`);
|
|
441
|
+
if (e.objectiveOffset !== void 0 && (typeof e.objectiveOffset != "number" || !Number.isFinite(e.objectiveOffset))) throw Error(`Invalid HiGHS option "objectiveOffset" (${String(e.objectiveOffset)}): expected a finite number.`);
|
|
442
|
+
if (e.wasmUrl !== void 0 && e.wasmUrl !== null && (typeof e.wasmUrl != "string" || e.wasmUrl === "")) throw Error("Invalid HiGHS option \"wasmUrl\": expected a non-empty string or null.");
|
|
406
443
|
}
|
|
407
|
-
|
|
408
|
-
|
|
444
|
+
var g = null, _ = null, v = null, y = null;
|
|
445
|
+
function b(e) {
|
|
446
|
+
y = e, g = null, _ = null, v = null;
|
|
409
447
|
}
|
|
410
|
-
|
|
411
|
-
return
|
|
448
|
+
function x() {
|
|
449
|
+
return y;
|
|
412
450
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
if (f && p === n) return f;
|
|
416
|
-
p = n;
|
|
417
|
-
let r = (async () => {
|
|
418
|
-
let e = (await import("./browser-runtime-TLCY0hkc.js")).default;
|
|
419
|
-
return await e({ locateFile: (e) => e.endsWith(".wasm") ? t : e });
|
|
420
|
-
})().catch((e) => {
|
|
421
|
-
f === r && (f = null, p = null);
|
|
422
|
-
let n = e instanceof Error ? e.message : String(e);
|
|
423
|
-
throw Error(`[WaSHI] Failed to initialize HiGHS${t ? ` from "${t}"` : ""}. Deploy the package's WASM asset or explicitly set wasmUrl; no CDN fallback is attempted. ${n}`, { cause: e });
|
|
424
|
-
});
|
|
425
|
-
return f = r, r;
|
|
451
|
+
function S(e) {
|
|
452
|
+
return e.length >= 4 && e[0] === 0 && e[1] === 97 && e[2] === 115 && e[3] === 109;
|
|
426
453
|
}
|
|
427
|
-
async function
|
|
428
|
-
|
|
454
|
+
async function C(e) {
|
|
455
|
+
return e || y || n();
|
|
456
|
+
}
|
|
457
|
+
async function w(e = {}) {
|
|
458
|
+
let t = await C(e.wasmUrl);
|
|
459
|
+
return {
|
|
460
|
+
isNode: !1,
|
|
461
|
+
wasmUrl: t,
|
|
462
|
+
key: t ?? "node"
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
async function T(e = {}) {
|
|
466
|
+
let { key: t } = await w(e);
|
|
467
|
+
return v === t;
|
|
468
|
+
}
|
|
469
|
+
async function E(e = {}) {
|
|
470
|
+
let { isNode: t, wasmUrl: n, key: i } = await w(e);
|
|
471
|
+
if (g && _ === i) return g;
|
|
472
|
+
_ = i, v = null;
|
|
473
|
+
let a = null;
|
|
474
|
+
return a = (async () => {
|
|
475
|
+
let e = t ? await r() : (await import("./highs-browser-runtime-0Bgq5ksG.js")).default;
|
|
476
|
+
return t ? await e() : await e({ locateFile: (e) => e.endsWith(".wasm") ? n : e });
|
|
477
|
+
})().then((e) => (g === a && (v = i), e)).catch((e) => {
|
|
478
|
+
g === a && (g = null, _ = null, v = null);
|
|
479
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
480
|
+
throw Error(`[WaSHI] Failed to initialize HiGHS${n ? ` from "${n}"` : ""}. Deploy the package's WASM asset or explicitly set wasmUrl; no CDN fallback is attempted. ${t}`, { cause: e });
|
|
481
|
+
}), g = a, a;
|
|
482
|
+
}
|
|
483
|
+
async function D(e, t = {}) {
|
|
484
|
+
if (h(t), t.signal?.aborted) return {
|
|
429
485
|
result: {
|
|
430
486
|
Status: "Interrupted",
|
|
431
487
|
StatusCode: 17,
|
|
@@ -436,7 +492,7 @@ async function y(e, t = {}) {
|
|
|
436
492
|
},
|
|
437
493
|
runTime: 0
|
|
438
494
|
};
|
|
439
|
-
let n = await
|
|
495
|
+
let n = await E(t);
|
|
440
496
|
if (t.signal?.aborted) return {
|
|
441
497
|
result: {
|
|
442
498
|
Status: "Interrupted",
|
|
@@ -449,86 +505,76 @@ async function y(e, t = {}) {
|
|
|
449
505
|
runTime: 0
|
|
450
506
|
};
|
|
451
507
|
let r = performance.now(), i = { output_flag: t.outputFlag ?? !1 };
|
|
452
|
-
t.timeLimit !== void 0 && (i.time_limit = t.timeLimit), t.presolve !== void 0 && (i.presolve = t.presolve), t.solver !== void 0 && (i.solver = t.solver), t.
|
|
453
|
-
for (let e of [
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
"simplex_iteration_limit",
|
|
458
|
-
"ipm_iteration_limit"
|
|
459
|
-
]) t[e] !== void 0 && (i[e] = t[e]);
|
|
460
|
-
let a = typeof t.objectiveOffset == "number" && Number.isFinite(t.objectiveOffset) ? t.objectiveOffset : 0, s = t.initialValues, c = !1;
|
|
461
|
-
if (s) {
|
|
462
|
-
for (let [e, t] of Object.entries(s)) if (t !== void 0) {
|
|
508
|
+
t.timeLimit !== void 0 && (i.time_limit = t.timeLimit), t.presolve !== void 0 && (i.presolve = t.presolve), t.solver !== void 0 && (i.solver = t.solver), t.relativeGap !== void 0 && (i.mip_rel_gap = t.relativeGap), t.absoluteGap !== void 0 && (i.mip_abs_gap = t.absoluteGap);
|
|
509
|
+
for (let e of p) t[e] !== void 0 && (i[e] = t[e]);
|
|
510
|
+
let a = t.objectiveOffset ?? 0, o = t.initialValues, c = !1;
|
|
511
|
+
if (o) {
|
|
512
|
+
for (let [e, t] of Object.entries(o)) if (t !== void 0) {
|
|
463
513
|
if (typeof t != "number" || !Number.isFinite(t)) throw Error(`Invalid initial value for column "${e}": ${String(t)} (must be a finite number).`);
|
|
464
514
|
c = !0;
|
|
465
515
|
}
|
|
466
516
|
}
|
|
467
|
-
if (typeof n.withModel
|
|
517
|
+
if (typeof n.withModel != "function") throw Error("[WaSHI] HiGHS runtime is missing required withModel() API (legacy highs.solve fallback has been removed).");
|
|
518
|
+
return {
|
|
468
519
|
result: n.withModel({
|
|
469
520
|
format: "lp",
|
|
470
521
|
data: e
|
|
471
522
|
}, (e) => {
|
|
472
|
-
|
|
523
|
+
let l = !1;
|
|
524
|
+
if (a !== 0) {
|
|
525
|
+
if (typeof e.changeObjectiveOffset != "function") throw Error("[WaSHI] HiGHS runtime does not support changeObjectiveOffset() for non-zero objectiveOffset.");
|
|
473
526
|
let t = typeof e.getObjectiveOffset == "function" ? e.getObjectiveOffset() : 0;
|
|
474
|
-
e.changeObjectiveOffset(t + a);
|
|
527
|
+
e.changeObjectiveOffset(t + a), l = !0;
|
|
475
528
|
}
|
|
476
|
-
for (let [t,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
if (e?.name !== "HighsUnsupportedOptionError" && !(n.errors?.HighsUnsupportedOptionError && e instanceof n.errors.HighsUnsupportedOptionError)) throw e;
|
|
480
|
-
}
|
|
481
|
-
let l = e.getDimensions(), u = [], d = !1;
|
|
482
|
-
for (let t = 0; t < l.numCols; t++) {
|
|
529
|
+
for (let [t, n] of Object.entries(i)) e.options.set(t, n);
|
|
530
|
+
let u = e.getDimensions(), d = [], f = !1;
|
|
531
|
+
for (let t = 0; t < u.numCols; t++) {
|
|
483
532
|
let n = e.getColIntegrality(t);
|
|
484
|
-
n !== 0 && (
|
|
533
|
+
n !== 0 && (f = !0), d.push({
|
|
485
534
|
name: e.getColName(t),
|
|
486
535
|
type: n === 1 ? "Integer" : "Continuous"
|
|
487
536
|
});
|
|
488
537
|
}
|
|
489
|
-
if (c &&
|
|
538
|
+
if (c && o) {
|
|
490
539
|
if (typeof e.setSolution != "function") throw Error("HiGHS runtime does not support setting primal initial values (setSolution is unavailable).");
|
|
491
540
|
let t = /* @__PURE__ */ new Map();
|
|
492
|
-
for (let e = 0; e <
|
|
493
|
-
for (let [e, n] of Object.entries(
|
|
541
|
+
for (let e = 0; e < u.numCols; e++) t.set(d[e].name, e);
|
|
542
|
+
for (let [e, n] of Object.entries(o)) if (n !== void 0 && !t.has(e)) throw Error(`Unknown column "${e}" in initialValues (column does not exist in the HiGHS LP model).`);
|
|
494
543
|
let n = [], r = [];
|
|
495
|
-
for (let e = 0; e <
|
|
496
|
-
let t =
|
|
497
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
498
|
-
let i =
|
|
544
|
+
for (let e = 0; e < u.numCols; e++) {
|
|
545
|
+
let t = d[e].name;
|
|
546
|
+
if (Object.prototype.hasOwnProperty.call(o, t)) {
|
|
547
|
+
let i = o[t];
|
|
499
548
|
i !== void 0 && (n.push(e), r.push(i));
|
|
500
549
|
}
|
|
501
550
|
}
|
|
502
|
-
n.length > 0 && (n.length ===
|
|
551
|
+
n.length > 0 && (n.length === u.numCols ? e.setSolution({ colValue: r }) : e.setSolution({
|
|
503
552
|
indices: n,
|
|
504
553
|
values: r
|
|
505
554
|
}));
|
|
506
555
|
}
|
|
507
|
-
let
|
|
556
|
+
let p = null, m = null, h = 0, g = (e) => {
|
|
508
557
|
let t = e?.data ?? {}, n = typeof t.running_time == "number" && Number.isFinite(t.running_time) ? t.running_time : (performance.now() - r) / 1e3, i = typeof t.mip_primal_bound == "number" && Number.isFinite(t.mip_primal_bound) ? t.mip_primal_bound : typeof t.objective_function_value == "number" && Number.isFinite(t.objective_function_value) ? t.objective_function_value : void 0, a = typeof t.mip_dual_bound == "number" && Number.isFinite(t.mip_dual_bound) ? t.mip_dual_bound : void 0, o = typeof t.mip_gap == "number" && Number.isFinite(t.mip_gap) ? t.mip_gap : void 0, s = i !== void 0 && a !== void 0 ? Math.abs(i - a) : void 0, c = typeof t.mip_node_count == "bigint" ? Number(t.mip_node_count) : typeof t.mip_node_count == "number" && Number.isFinite(t.mip_node_count) ? t.mip_node_count : void 0, l = typeof t.mip_total_lp_iterations == "bigint" ? Number(t.mip_total_lp_iterations) : typeof t.simplex_iteration_count == "number" && Number.isFinite(t.simplex_iteration_count) ? t.simplex_iteration_count : typeof t.ipm_iteration_count == "number" && Number.isFinite(t.ipm_iteration_count) ? t.ipm_iteration_count : void 0, u = typeof e?.message == "string" && e.message.trim().length > 0 ? e.message.trim() : void 0, d = {
|
|
509
558
|
elapsedTime: n,
|
|
510
559
|
elapsedSeconds: n,
|
|
511
560
|
...i === void 0 ? {} : { objectiveValue: i },
|
|
512
561
|
...a === void 0 ? {} : { objectiveBound: a },
|
|
513
|
-
...o === void 0 ? {} : {
|
|
514
|
-
|
|
515
|
-
mipGap: o
|
|
516
|
-
},
|
|
517
|
-
...s === void 0 ? {} : { absGap: s },
|
|
562
|
+
...o === void 0 ? {} : { relativeGap: o },
|
|
563
|
+
...s === void 0 ? {} : { absoluteGap: s },
|
|
518
564
|
...c === void 0 ? {} : { nodes: c },
|
|
519
565
|
...l === void 0 ? {} : { iterations: l },
|
|
520
566
|
...u === void 0 ? {} : { message: u }
|
|
521
567
|
};
|
|
522
|
-
return
|
|
523
|
-
},
|
|
568
|
+
return m = d, d;
|
|
569
|
+
}, _ = (e) => {
|
|
524
570
|
let n = e?.data;
|
|
525
571
|
if (!n || !(n.mip_solution instanceof Float64Array)) return;
|
|
526
572
|
let r = n.mip_solution, i = {};
|
|
527
|
-
for (let e = 0; e <
|
|
573
|
+
for (let e = 0; e < d.length && e < r.length; e++) Object.defineProperty(i, d[e].name, {
|
|
528
574
|
value: {
|
|
529
575
|
Index: e,
|
|
530
|
-
Type:
|
|
531
|
-
Name:
|
|
576
|
+
Type: d[e].type,
|
|
577
|
+
Name: d[e].name,
|
|
532
578
|
Primal: r[e]
|
|
533
579
|
},
|
|
534
580
|
enumerable: !0,
|
|
@@ -536,13 +582,13 @@ async function y(e, t = {}) {
|
|
|
536
582
|
configurable: !0
|
|
537
583
|
});
|
|
538
584
|
let a = typeof n.objective_function_value == "number" && Number.isFinite(n.objective_function_value) ? n.objective_function_value : typeof n.mip_primal_bound == "number" && Number.isFinite(n.mip_primal_bound) ? n.mip_primal_bound : NaN;
|
|
539
|
-
Number.isFinite(a) && (
|
|
585
|
+
Number.isFinite(a) && (p = {
|
|
540
586
|
objectiveValue: a,
|
|
541
587
|
...typeof n.mip_dual_bound == "number" && Number.isFinite(n.mip_dual_bound) ? { mipDualBound: n.mip_dual_bound } : {},
|
|
542
588
|
...typeof n.mip_gap == "number" && Number.isFinite(n.mip_gap) ? { mipGap: n.mip_gap } : {},
|
|
543
589
|
columns: i
|
|
544
|
-
}, t.onIncumbent?.(
|
|
545
|
-
},
|
|
590
|
+
}, t.onIncumbent?.(p));
|
|
591
|
+
}, v = !1;
|
|
546
592
|
if (t.signal || t.onProgress || t.onIncumbent) {
|
|
547
593
|
let r = n.constants?.callbackType ?? {
|
|
548
594
|
logging: 0,
|
|
@@ -554,90 +600,85 @@ async function y(e, t = {}) {
|
|
|
554
600
|
mipInterrupt: 6
|
|
555
601
|
}, i = (e) => {
|
|
556
602
|
if (t.signal?.aborted) {
|
|
557
|
-
|
|
603
|
+
v = !0, e.interrupt();
|
|
558
604
|
return;
|
|
559
605
|
}
|
|
560
|
-
t.onProgress && (
|
|
606
|
+
t.onProgress && (h++, t.onProgress(g(e)), t.signal?.aborted && (v = !0, e.interrupt()));
|
|
561
607
|
}, a = {
|
|
562
608
|
[r.simplexInterrupt]: i,
|
|
563
609
|
[r.ipmInterrupt]: i,
|
|
564
610
|
[r.mipInterrupt]: i,
|
|
565
611
|
[r.mipImprovingSolution]: (e) => {
|
|
566
|
-
|
|
612
|
+
_(e), t.onProgress && !t.signal?.aborted && (h++, t.onProgress(g(e)));
|
|
567
613
|
},
|
|
568
614
|
[r.mipLogging]: (e) => {
|
|
569
|
-
t.onProgress && !t.signal?.aborted && (
|
|
615
|
+
t.onProgress && !t.signal?.aborted && (h++, t.onProgress(g(e)));
|
|
570
616
|
}
|
|
571
617
|
};
|
|
572
618
|
e.run(a);
|
|
573
619
|
} else e.run();
|
|
574
|
-
let
|
|
575
|
-
|
|
576
|
-
let
|
|
620
|
+
let y = e.getModelStatus();
|
|
621
|
+
v && (y = 17);
|
|
622
|
+
let b = s[y] ?? "Unknown", x = 0, S = 0;
|
|
577
623
|
try {
|
|
578
|
-
|
|
624
|
+
x = Number(e.info.get("primal_solution_status"));
|
|
579
625
|
} catch {}
|
|
580
626
|
try {
|
|
581
|
-
|
|
627
|
+
S = Number(e.info.get("dual_solution_status"));
|
|
582
628
|
} catch {}
|
|
583
|
-
let
|
|
584
|
-
if (!
|
|
585
|
-
else for (let e = 0; e <
|
|
586
|
-
let t =
|
|
629
|
+
let C = n.constants?.solutionStatus?.feasible ?? 2, w = x === C, T = S === C, E = w || T ? e.getSolution() : null, D = w, O = {};
|
|
630
|
+
if (!w && p !== null) D = !0, O = p.columns;
|
|
631
|
+
else for (let e = 0; e < u.numCols; e++) {
|
|
632
|
+
let t = d[e], n = {
|
|
587
633
|
Index: e,
|
|
588
634
|
Type: t.type,
|
|
589
635
|
Name: t.name
|
|
590
636
|
};
|
|
591
|
-
|
|
637
|
+
w && E && (n.Primal = E.colValue[e]), !f && T && E && (n.Dual = E.colDual[e]), Object.defineProperty(O, t.name, {
|
|
592
638
|
value: n,
|
|
593
639
|
enumerable: !0,
|
|
594
640
|
writable: !0,
|
|
595
641
|
configurable: !0
|
|
596
642
|
});
|
|
597
643
|
}
|
|
598
|
-
let
|
|
599
|
-
for (let t = 0; t <
|
|
644
|
+
let k = [];
|
|
645
|
+
for (let t = 0; t < u.numRows; t++) {
|
|
600
646
|
let n = e.getRowName(t), r = {
|
|
601
647
|
Index: t,
|
|
602
648
|
Name: n
|
|
603
649
|
};
|
|
604
|
-
|
|
650
|
+
w && E && (r.Primal = E.rowValue[t]), !f && T && E && (r.Dual = E.rowDual[t]), k.push(r);
|
|
605
651
|
}
|
|
606
|
-
let
|
|
607
|
-
if (
|
|
652
|
+
let A = w ? e.getObjectiveValue() : p === null ? NaN : p.objectiveValue, j, M;
|
|
653
|
+
if (f) {
|
|
608
654
|
try {
|
|
609
655
|
let t = Number(e.info.get("mip_dual_bound"));
|
|
610
|
-
Number.isFinite(t) && (
|
|
656
|
+
Number.isFinite(t) && (j = t);
|
|
611
657
|
} catch {}
|
|
612
|
-
|
|
658
|
+
j === void 0 && m && m.objectiveBound !== void 0 && (j = m.objectiveBound);
|
|
613
659
|
try {
|
|
614
660
|
let t = Number(e.info.get("mip_gap"));
|
|
615
|
-
Number.isFinite(t) && (
|
|
661
|
+
Number.isFinite(t) && (M = t);
|
|
616
662
|
} catch {}
|
|
617
|
-
|
|
663
|
+
M === void 0 && m && m.relativeGap !== void 0 && (M = m.relativeGap);
|
|
618
664
|
}
|
|
619
665
|
return {
|
|
620
|
-
Status:
|
|
621
|
-
StatusCode:
|
|
622
|
-
PrimalSolutionStatus:
|
|
623
|
-
DualSolutionStatus:
|
|
624
|
-
HasPrimalSolution:
|
|
625
|
-
IsMip:
|
|
626
|
-
ObjectiveValue:
|
|
627
|
-
ObjectiveOffsetApplied:
|
|
628
|
-
MipDualBound:
|
|
629
|
-
MipGap:
|
|
630
|
-
Columns:
|
|
631
|
-
Rows:
|
|
666
|
+
Status: s[y] ?? b,
|
|
667
|
+
StatusCode: y,
|
|
668
|
+
PrimalSolutionStatus: x,
|
|
669
|
+
DualSolutionStatus: S,
|
|
670
|
+
HasPrimalSolution: D,
|
|
671
|
+
IsMip: f,
|
|
672
|
+
ObjectiveValue: A,
|
|
673
|
+
ObjectiveOffsetApplied: l,
|
|
674
|
+
MipDualBound: j,
|
|
675
|
+
MipGap: M,
|
|
676
|
+
Columns: O,
|
|
677
|
+
Rows: k
|
|
632
678
|
};
|
|
633
679
|
}),
|
|
634
680
|
runTime: (performance.now() - r) / 1e3
|
|
635
681
|
};
|
|
636
|
-
if (c) throw Error("HiGHS runtime does not support setting primal initial values (withModel/setSolution is unavailable).");
|
|
637
|
-
return {
|
|
638
|
-
result: n.solve(e, i),
|
|
639
|
-
runTime: (performance.now() - r) / 1e3
|
|
640
|
-
};
|
|
641
682
|
}
|
|
642
683
|
//#endregion
|
|
643
|
-
export {
|
|
684
|
+
export { n as _, C as a, h as c, f as d, a as f, t as g, l as h, S as i, c as l, o as m, x as n, b as o, d as p, T as r, D as s, E as t, s as u };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { s as e, t } from "./highs-loader-BLY3wzDH.js";
|
|
2
|
+
//#region src/modeler/solvers/highs/worker.ts
|
|
3
|
+
self.onmessage = async (n) => {
|
|
4
|
+
let { type: r, id: i, lpString: a, options: o, reportProgress: s } = n.data;
|
|
5
|
+
if (r === "WARMUP") {
|
|
6
|
+
try {
|
|
7
|
+
await t(o), self.postMessage({
|
|
8
|
+
type: "WARMUP_SUCCESS",
|
|
9
|
+
id: i
|
|
10
|
+
});
|
|
11
|
+
} catch (e) {
|
|
12
|
+
self.postMessage({
|
|
13
|
+
type: "WARMUP_ERROR",
|
|
14
|
+
id: i,
|
|
15
|
+
error: e?.message || String(e)
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (r === "SOLVE") try {
|
|
21
|
+
let { result: t, runTime: n } = await e(a, {
|
|
22
|
+
...o,
|
|
23
|
+
...s ? {
|
|
24
|
+
onProgress: (e) => {
|
|
25
|
+
self.postMessage({
|
|
26
|
+
type: "SOLVE_PROGRESS",
|
|
27
|
+
id: i,
|
|
28
|
+
progress: e
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
onIncumbent: (e) => {
|
|
32
|
+
self.postMessage({
|
|
33
|
+
type: "SOLVE_INCUMBENT",
|
|
34
|
+
id: i,
|
|
35
|
+
incumbent: e
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
} : {}
|
|
39
|
+
});
|
|
40
|
+
self.postMessage({
|
|
41
|
+
type: "SOLVE_SUCCESS",
|
|
42
|
+
id: i,
|
|
43
|
+
result: t,
|
|
44
|
+
runTime: n
|
|
45
|
+
});
|
|
46
|
+
} catch (e) {
|
|
47
|
+
self.postMessage({
|
|
48
|
+
type: "SOLVE_ERROR",
|
|
49
|
+
id: i,
|
|
50
|
+
error: e?.message || String(e)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|