@ohtaman/washi 0.1.1 → 0.1.2
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 +49 -21
- package/README.md +49 -21
- package/README.zh-CN.md +49 -21
- package/dist/browser/_washi-optional-engine-282Ug7Gw.js +7 -0
- package/dist/browser/highs-browser-runtime-D13gHOT5.js +4189 -0
- package/dist/browser/highs-loader-T47YOyos.js +58 -0
- package/dist/browser/highs-worker.js +21 -0
- package/dist/{lib/demo → browser}/highs.wasm +0 -0
- package/dist/browser/highs.wasm.LICENSE +22 -0
- package/dist/browser/washi.js +1547 -0
- package/dist/browser/washi.min.js +5 -0
- package/dist/lib/{glpk-BC32ZaPG.js → glpk-5cUpjyb9.js} +14 -5
- package/dist/lib/highs-assets.js +1 -0
- package/dist/lib/highs-browser-runtime.js +4189 -0
- package/dist/lib/highs-loader-Blb99785.js +50 -0
- package/dist/lib/highs-node-runtime.js +1 -0
- package/dist/lib/highs-worker-factory.js +1 -0
- package/dist/lib/highs-worker.js +21 -0
- package/dist/lib/highs.wasm +0 -0
- package/dist/lib/solvers/glpk.js +1 -1
- package/dist/lib/solvers/z3.js +2 -2
- package/dist/lib/washi.js +34 -33
- package/dist/lib/z3-C6GeIicJ.js +509 -0
- package/dist/types/glpk-loader.d.ts.map +1 -1
- package/dist/types/highs-assets.d.ts +3 -0
- package/dist/types/highs-assets.d.ts.map +1 -0
- package/dist/types/highs-browser-runtime.d.ts +2 -0
- package/dist/types/highs-browser-runtime.d.ts.map +1 -0
- package/dist/types/highs-loader.d.ts +1 -1
- package/dist/types/highs-loader.d.ts.map +1 -1
- package/dist/types/highs-node-runtime.d.ts +2 -0
- package/dist/types/highs-node-runtime.d.ts.map +1 -0
- package/dist/types/highs-worker-client.d.ts.map +1 -1
- package/dist/types/highs-worker-factory.d.ts +3 -0
- package/dist/types/highs-worker-factory.d.ts.map +1 -0
- package/dist/types/modeler/solvers/highs.d.ts +6 -0
- package/dist/types/modeler/solvers/highs.d.ts.map +1 -1
- package/dist/types/modeler/solvers/types.d.ts +1 -1
- package/dist/types/modeler/solvers/types.d.ts.map +1 -1
- package/dist/types/modeler/solvers/z3.d.ts +4 -5
- package/dist/types/modeler/solvers/z3.d.ts.map +1 -1
- package/package.json +18 -6
- package/dist/lib/assets/highs-worker-DeDWU6KI.js +0 -3
- package/dist/lib/washi-logo.png +0 -0
- package/dist/lib/washi-logo.svg +0 -70
- package/dist/lib/z3-C8g-PtmP.js +0 -582
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { c as e, o as t } from "./highs-loader-Blb99785.js";
|
|
2
|
+
import { t as n } from "./glpk-5cUpjyb9.js";
|
|
3
|
+
import { createHighsWorker as r } from "./highs-worker-factory.js";
|
|
4
|
+
//#region src/modeler/boolean-expr.ts
|
|
5
|
+
var i = 0, a = class {
|
|
6
|
+
and(e) {
|
|
7
|
+
return new s("and", [this, e]);
|
|
8
|
+
}
|
|
9
|
+
or(e) {
|
|
10
|
+
return new s("or", [this, e]);
|
|
11
|
+
}
|
|
12
|
+
implies(e) {
|
|
13
|
+
return new s("implies", [this, e]);
|
|
14
|
+
}
|
|
15
|
+
xor(e) {
|
|
16
|
+
return new s("xor", [this, e]);
|
|
17
|
+
}
|
|
18
|
+
not() {
|
|
19
|
+
return new s("not", [this]);
|
|
20
|
+
}
|
|
21
|
+
}, o = class extends a {
|
|
22
|
+
id;
|
|
23
|
+
name;
|
|
24
|
+
value = null;
|
|
25
|
+
constructor(e) {
|
|
26
|
+
super(), this.id = ++i, this.name = e || `p_${this.id}`;
|
|
27
|
+
}
|
|
28
|
+
toString() {
|
|
29
|
+
return this.name;
|
|
30
|
+
}
|
|
31
|
+
}, s = class extends a {
|
|
32
|
+
op;
|
|
33
|
+
children;
|
|
34
|
+
constructor(e, t) {
|
|
35
|
+
super(), this.op = e, this.children = t;
|
|
36
|
+
}
|
|
37
|
+
toString() {
|
|
38
|
+
return this.op === "not" ? `not(${this.children[0].toString()})` : `(${this.children.map((e) => e.toString()).join(` ${this.op} `)})`;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function c(...e) {
|
|
42
|
+
if (e.length === 0) throw Error("and() requires at least one expression");
|
|
43
|
+
return new s("and", e);
|
|
44
|
+
}
|
|
45
|
+
function l(...e) {
|
|
46
|
+
if (e.length === 0) throw Error("or() requires at least one expression");
|
|
47
|
+
return new s("or", e);
|
|
48
|
+
}
|
|
49
|
+
function u(e) {
|
|
50
|
+
return new s("not", [e]);
|
|
51
|
+
}
|
|
52
|
+
function d(e, t) {
|
|
53
|
+
return new s("implies", [e, t]);
|
|
54
|
+
}
|
|
55
|
+
function f(...e) {
|
|
56
|
+
if (e.length === 0) throw Error("xor() requires at least one expression");
|
|
57
|
+
return new s("xor", e);
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/modeler/constraint.ts
|
|
61
|
+
var p = 0, m = class {
|
|
62
|
+
id;
|
|
63
|
+
lhs;
|
|
64
|
+
sense;
|
|
65
|
+
rhs;
|
|
66
|
+
name;
|
|
67
|
+
slack = null;
|
|
68
|
+
dual = null;
|
|
69
|
+
constructor(e, t, n, r) {
|
|
70
|
+
this.id = ++p, this.lhs = e, this.sense = t, this.rhs = n, this.name = r || `c_${this.id}`;
|
|
71
|
+
}
|
|
72
|
+
get pi() {
|
|
73
|
+
return this.dual;
|
|
74
|
+
}
|
|
75
|
+
and(e) {
|
|
76
|
+
return new s("and", [this, e]);
|
|
77
|
+
}
|
|
78
|
+
or(e) {
|
|
79
|
+
return new s("or", [this, e]);
|
|
80
|
+
}
|
|
81
|
+
implies(e) {
|
|
82
|
+
return new s("implies", [this, e]);
|
|
83
|
+
}
|
|
84
|
+
xor(e) {
|
|
85
|
+
return new s("xor", [this, e]);
|
|
86
|
+
}
|
|
87
|
+
not() {
|
|
88
|
+
return new s("not", [this]);
|
|
89
|
+
}
|
|
90
|
+
toString() {
|
|
91
|
+
let e = this.sense === "==" ? "=" : this.sense;
|
|
92
|
+
return `${this.name}: ${this.lhs.toString()} ${e} ${this.rhs}`;
|
|
93
|
+
}
|
|
94
|
+
}, h = null, g = 0, _ = /* @__PURE__ */ new Map();
|
|
95
|
+
function v() {
|
|
96
|
+
if (typeof window > "u" || typeof Worker > "u") return null;
|
|
97
|
+
if (!h) try {
|
|
98
|
+
h = r();
|
|
99
|
+
let e = h;
|
|
100
|
+
h.onmessage = (e) => {
|
|
101
|
+
let { type: t, id: n, result: r, runTime: i, error: a } = e.data, o = _.get(n);
|
|
102
|
+
o && (_.delete(n), t === "SOLVE_SUCCESS" ? o.resolve({
|
|
103
|
+
result: r,
|
|
104
|
+
runTime: i
|
|
105
|
+
}) : o.reject(Error(a || "Worker solve failed")));
|
|
106
|
+
};
|
|
107
|
+
let t = (t) => {
|
|
108
|
+
if (h === e) {
|
|
109
|
+
h = null, e.terminate();
|
|
110
|
+
for (let e of _.values()) e.reject(t);
|
|
111
|
+
_.clear();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
h.onerror = (e) => t(/* @__PURE__ */ Error(`[WaSHI] HiGHS Worker failed to load or execute. Check Worker assets, CORS and CSP. ${e.message || ""}`)), h.onmessageerror = () => t(/* @__PURE__ */ Error("[WaSHI] Could not deserialize the HiGHS Worker response."));
|
|
115
|
+
} catch (e) {
|
|
116
|
+
console.warn("Could not instantiate Web Worker, falling back to main thread:", e), h = null;
|
|
117
|
+
}
|
|
118
|
+
return h;
|
|
119
|
+
}
|
|
120
|
+
async function y(n, r = {}) {
|
|
121
|
+
let i = await t(r.wasmUrl), a = r.useWorker ?? typeof window < "u" ? v() : null;
|
|
122
|
+
if (!a) return e(n, r);
|
|
123
|
+
let o = {
|
|
124
|
+
...r,
|
|
125
|
+
wasmUrl: i
|
|
126
|
+
}, s = `req_${++g}`;
|
|
127
|
+
return new Promise((e, t) => {
|
|
128
|
+
_.set(s, {
|
|
129
|
+
resolve: e,
|
|
130
|
+
reject: t
|
|
131
|
+
});
|
|
132
|
+
try {
|
|
133
|
+
a.postMessage({
|
|
134
|
+
type: "SOLVE",
|
|
135
|
+
id: s,
|
|
136
|
+
lpString: n,
|
|
137
|
+
options: o
|
|
138
|
+
});
|
|
139
|
+
} catch (e) {
|
|
140
|
+
_.delete(s), t(e);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/modeler/solvers/highs.ts
|
|
146
|
+
function b(e) {
|
|
147
|
+
if (typeof e != "string") return "Unknown";
|
|
148
|
+
let t = e.trim();
|
|
149
|
+
if (!t) return "Unknown";
|
|
150
|
+
switch (t) {
|
|
151
|
+
case "Optimal": return "Optimal";
|
|
152
|
+
case "Infeasible": return "Infeasible";
|
|
153
|
+
case "Unbounded": return "Unbounded";
|
|
154
|
+
case "Primal infeasible or unbounded": return "Unknown";
|
|
155
|
+
case "Time limit reached":
|
|
156
|
+
case "TimeLimit": return "TimeLimit";
|
|
157
|
+
case "Iteration limit reached":
|
|
158
|
+
case "IterationLimit": return "IterationLimit";
|
|
159
|
+
case "Bound on objective reached":
|
|
160
|
+
case "Target for objective reached":
|
|
161
|
+
case "Feasible": return "Feasible";
|
|
162
|
+
case "Not Set": return "NotSolved";
|
|
163
|
+
case "Load error":
|
|
164
|
+
case "Model error":
|
|
165
|
+
case "Presolve error":
|
|
166
|
+
case "Solve error":
|
|
167
|
+
case "Postsolve error":
|
|
168
|
+
case "Error": return "Error";
|
|
169
|
+
case "Empty":
|
|
170
|
+
case "Unknown": return "Unknown";
|
|
171
|
+
}
|
|
172
|
+
let n = t.toLowerCase();
|
|
173
|
+
return n.includes("infeasible") && n.includes("unbounded") ? "Unknown" : n.includes("infeasible") ? "Infeasible" : n.includes("unbounded") ? "Unbounded" : n.includes("time limit") || n.includes("timelimit") ? "TimeLimit" : n.includes("iteration limit") || n.includes("iterationlimit") ? "IterationLimit" : n.includes("error") ? "Error" : n === "optimal" ? "Optimal" : "Unknown";
|
|
174
|
+
}
|
|
175
|
+
var x = class e {
|
|
176
|
+
static capabilities = {
|
|
177
|
+
supportsMIP: !0,
|
|
178
|
+
supportsQP: !0
|
|
179
|
+
};
|
|
180
|
+
name = "HiGHS";
|
|
181
|
+
version = "1.15.3";
|
|
182
|
+
capabilities = e.capabilities;
|
|
183
|
+
options;
|
|
184
|
+
constructor(e = {}) {
|
|
185
|
+
this.options = e;
|
|
186
|
+
}
|
|
187
|
+
async solve(e, t, n = {}) {
|
|
188
|
+
let r = {
|
|
189
|
+
...this.options,
|
|
190
|
+
...n
|
|
191
|
+
}, { lpString: i, nameToVar: a, nameToConstraint: o } = t, { result: s, runTime: c } = await y(i, r), l = b(s?.Status), u = s.ObjectiveValue, d = typeof u == "number" ? u + e.objective.constant : null, f = {}, p = {}, m = {}, h = {};
|
|
192
|
+
if (s.Columns) for (let [e, t] of Object.entries(s.Columns)) {
|
|
193
|
+
let n = a.get(e);
|
|
194
|
+
if (n) {
|
|
195
|
+
let e = Math.abs(t.Primal) < 1e-9 ? 0 : t.Primal;
|
|
196
|
+
f[n.name] = e, t.Dual !== void 0 && (m[n.name] = Math.abs(t.Dual) < 1e-9 ? 0 : t.Dual);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (s.Rows) {
|
|
200
|
+
let e = Array.isArray(s.Rows) ? s.Rows : Object.values(s.Rows);
|
|
201
|
+
for (let t of e) {
|
|
202
|
+
let e = t.Name, n = o.get(e);
|
|
203
|
+
if (n && (t.Dual !== void 0 && (p[n.name] = Math.abs(t.Dual) < 1e-9 ? 0 : t.Dual), t.Primal !== void 0)) {
|
|
204
|
+
let e = n.rhs - t.Primal;
|
|
205
|
+
h[n.name] = Math.abs(e) < 1e-9 ? 0 : e;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
status: l,
|
|
211
|
+
objectiveValue: d,
|
|
212
|
+
values: f,
|
|
213
|
+
reducedCosts: m,
|
|
214
|
+
duals: p,
|
|
215
|
+
slacks: h,
|
|
216
|
+
runTime: c,
|
|
217
|
+
raw: s
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
}, S = x, C = class {
|
|
221
|
+
name;
|
|
222
|
+
capabilities;
|
|
223
|
+
options;
|
|
224
|
+
constructor(e = {}) {
|
|
225
|
+
this.name = e.name || "MockSolver", this.capabilities = e.capabilities || {
|
|
226
|
+
supportsMIP: !0,
|
|
227
|
+
supportsQP: !0
|
|
228
|
+
}, this.options = e;
|
|
229
|
+
}
|
|
230
|
+
async solve(e, t, n = {}) {
|
|
231
|
+
let r = {
|
|
232
|
+
...this.options,
|
|
233
|
+
...n
|
|
234
|
+
};
|
|
235
|
+
return r.delayMs && r.delayMs > 0 && await new Promise((e) => setTimeout(e, r.delayMs)), {
|
|
236
|
+
status: r.status || "Optimal",
|
|
237
|
+
objectiveValue: r.objectiveValue ?? 0,
|
|
238
|
+
values: r.values || {},
|
|
239
|
+
reducedCosts: r.reducedCosts,
|
|
240
|
+
duals: r.duals,
|
|
241
|
+
slacks: r.slacks,
|
|
242
|
+
runTime: .001,
|
|
243
|
+
raw: { mock: !0 }
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}, w = /* @__PURE__ */ new Map();
|
|
247
|
+
w.set("highs", (e) => new x(e)), w.set("glpk", (e) => new n(e)), w.set("mock", (e) => new C(e));
|
|
248
|
+
var T = (e) => new x(e);
|
|
249
|
+
function E(e, t) {
|
|
250
|
+
w.set(e.toLowerCase(), t);
|
|
251
|
+
}
|
|
252
|
+
function D(e) {
|
|
253
|
+
if (typeof e == "string") {
|
|
254
|
+
let t = w.get(e.toLowerCase());
|
|
255
|
+
if (!t) throw Error(`Solver '${e}' is not registered.`);
|
|
256
|
+
T = t;
|
|
257
|
+
} else T = typeof e == "function" ? e : () => e;
|
|
258
|
+
}
|
|
259
|
+
function O(e, t) {
|
|
260
|
+
if (!e) return T(t);
|
|
261
|
+
if (typeof e == "string") {
|
|
262
|
+
let n = w.get(e.toLowerCase());
|
|
263
|
+
if (!n) throw Error(`Solver '${e}' not found. Available solvers: ${k().join(", ")}`);
|
|
264
|
+
return n(t);
|
|
265
|
+
}
|
|
266
|
+
return e;
|
|
267
|
+
}
|
|
268
|
+
function k() {
|
|
269
|
+
return Array.from(w.keys());
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/modeler/solvers/z3.ts
|
|
273
|
+
var A = null;
|
|
274
|
+
async function j() {
|
|
275
|
+
if (!A) {
|
|
276
|
+
let e = (async () => {
|
|
277
|
+
try {
|
|
278
|
+
return await (await import("z3-solver")).init();
|
|
279
|
+
} catch (e) {
|
|
280
|
+
throw Error(`[WaSHI] Failed to load z3-solver. Ensure the optional dependency is installed (npm install z3-solver) and supported in this environment. Error: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
281
|
+
}
|
|
282
|
+
})();
|
|
283
|
+
e.catch(() => {
|
|
284
|
+
A === e && (A = null);
|
|
285
|
+
}), A = e;
|
|
286
|
+
}
|
|
287
|
+
return A;
|
|
288
|
+
}
|
|
289
|
+
function M() {
|
|
290
|
+
A = null;
|
|
291
|
+
}
|
|
292
|
+
var N = class {
|
|
293
|
+
name = "z3";
|
|
294
|
+
capabilities = {
|
|
295
|
+
supportsMIP: !0,
|
|
296
|
+
supportsQP: !1,
|
|
297
|
+
supportsSMT: !0,
|
|
298
|
+
supportsUnsatCore: !0
|
|
299
|
+
};
|
|
300
|
+
createContextTranslator(e) {
|
|
301
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
302
|
+
function r(n) {
|
|
303
|
+
if (!t.has(n.name)) {
|
|
304
|
+
let r = n.type === "Continuous" || n.type === "CONTINUOUS" ? e.Real.const(n.name) : e.Int.const(n.name);
|
|
305
|
+
t.set(n.name, r);
|
|
306
|
+
}
|
|
307
|
+
return t.get(n.name);
|
|
308
|
+
}
|
|
309
|
+
function i(t) {
|
|
310
|
+
if (!n.has(t.name)) {
|
|
311
|
+
let r = e.Bool.const(t.name);
|
|
312
|
+
n.set(t.name, r);
|
|
313
|
+
}
|
|
314
|
+
return n.get(t.name);
|
|
315
|
+
}
|
|
316
|
+
function a(t) {
|
|
317
|
+
return typeof e.isInt == "function" && e.isInt(t) ? e.ToReal(t) : t;
|
|
318
|
+
}
|
|
319
|
+
function c(t, n) {
|
|
320
|
+
let r = typeof e.isInt == "function" && e.isInt(t), i = typeof e.isInt == "function" && e.isInt(n);
|
|
321
|
+
return r && i ? t.add(n) : a(t).add(a(n));
|
|
322
|
+
}
|
|
323
|
+
function l(t, n) {
|
|
324
|
+
return typeof e.isInt == "function" && e.isInt(t) && Number.isInteger(n) ? t.mul(e.Int.val(n)) : a(t).mul(e.Real.val(n));
|
|
325
|
+
}
|
|
326
|
+
function u(t, n) {
|
|
327
|
+
let r = typeof e.isInt == "function" && e.isInt(t), i = typeof e.isInt == "function" && e.isInt(n);
|
|
328
|
+
return r && i ? t.mul(n) : a(t).mul(a(n));
|
|
329
|
+
}
|
|
330
|
+
function d(t, n) {
|
|
331
|
+
return n && Number.isInteger(t) ? e.Int.val(t) : e.Real.val(t);
|
|
332
|
+
}
|
|
333
|
+
function f(t, n, r) {
|
|
334
|
+
let i = typeof e.isInt == "function" && e.isInt(t) && Number.isInteger(r), o = i ? t : a(t), s = i ? e.Int.val(r) : e.Real.val(r);
|
|
335
|
+
return n === "<=" ? o.le(s) : n === ">=" ? o.ge(s) : o.eq(s);
|
|
336
|
+
}
|
|
337
|
+
function p(t) {
|
|
338
|
+
let n = null;
|
|
339
|
+
if (t && t.terms) for (let [e, i] of t.terms.entries()) {
|
|
340
|
+
let t = l(r(e), i);
|
|
341
|
+
n = n === null ? t : c(n, t);
|
|
342
|
+
}
|
|
343
|
+
let i = t && typeof t.constant == "number" ? t.constant : 0;
|
|
344
|
+
if (i !== 0 || n === null) {
|
|
345
|
+
let t = d(i, n === null || typeof e.isInt == "function" && e.isInt(n));
|
|
346
|
+
n = n === null ? t : c(n, t);
|
|
347
|
+
}
|
|
348
|
+
return n;
|
|
349
|
+
}
|
|
350
|
+
function h(t) {
|
|
351
|
+
let n = null;
|
|
352
|
+
if (t.linearTerms) for (let [e, i] of t.linearTerms.entries()) {
|
|
353
|
+
let t = l(r(e), i);
|
|
354
|
+
n = n === null ? t : c(n, t);
|
|
355
|
+
}
|
|
356
|
+
if (t.quadTerms) for (let e of t.quadTerms.values()) {
|
|
357
|
+
let t = l(u(r(e.var1), r(e.var2)), e.coeff);
|
|
358
|
+
n = n === null ? t : c(n, t);
|
|
359
|
+
}
|
|
360
|
+
let i = t && typeof t.constant == "number" ? t.constant : 0;
|
|
361
|
+
if (i !== 0 || n === null) {
|
|
362
|
+
let t = d(i, n === null || typeof e.isInt == "function" && e.isInt(n));
|
|
363
|
+
n = n === null ? t : c(n, t);
|
|
364
|
+
}
|
|
365
|
+
return n;
|
|
366
|
+
}
|
|
367
|
+
function g(e) {
|
|
368
|
+
let t = e.lhs instanceof Object && "quadTerms" in e.lhs ? h(e.lhs) : p(e.lhs), n = typeof e.rhs == "number" ? e.rhs : 0;
|
|
369
|
+
return f(t, e.sense, n);
|
|
370
|
+
}
|
|
371
|
+
function _(t) {
|
|
372
|
+
if (t instanceof o) return i(t);
|
|
373
|
+
if (t instanceof m) return g(t);
|
|
374
|
+
if (t instanceof s) switch (t.op) {
|
|
375
|
+
case "and": return e.And(...t.children.map(_));
|
|
376
|
+
case "or": return e.Or(...t.children.map(_));
|
|
377
|
+
case "not": return e.Not(_(t.children[0]));
|
|
378
|
+
case "implies": return e.Implies(_(t.children[0]), _(t.children[1]));
|
|
379
|
+
case "xor": return e.Xor(_(t.children[0]), _(t.children[1]));
|
|
380
|
+
default: throw Error(`Unsupported boolean operation: ${t.op}`);
|
|
381
|
+
}
|
|
382
|
+
throw Error(`Unknown logic element: ${String(t)}`);
|
|
383
|
+
}
|
|
384
|
+
function v(e) {
|
|
385
|
+
if (!e) return 0;
|
|
386
|
+
if (typeof e.asNumber == "function") return e.asNumber();
|
|
387
|
+
let t = e.toString();
|
|
388
|
+
if (t.startsWith("(/ ")) {
|
|
389
|
+
let e = t.slice(3, -1).trim().split(/\s+/);
|
|
390
|
+
if (e.length === 2) return Number(e[0]) / Number(e[1]);
|
|
391
|
+
}
|
|
392
|
+
return Number(t);
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
getVarAst: r,
|
|
396
|
+
getBoolVarAst: i,
|
|
397
|
+
compareAstWithNumber: f,
|
|
398
|
+
translateLinExpr: p,
|
|
399
|
+
translateQuadExpr: h,
|
|
400
|
+
translateConstraint: g,
|
|
401
|
+
translateBoolExpr: _,
|
|
402
|
+
parseAstValue: v,
|
|
403
|
+
varAstMap: t,
|
|
404
|
+
boolVarAstMap: n
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
async check(e, t = {}) {
|
|
408
|
+
let { Context: n } = await j(), r = new n(`check_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`), i = new r.Solver(), a = this.createContextTranslator(r), o = e.variables || e.vars || [], s = e.boolVars || [], c = e.constraints || [], l = e.logicalConstraints || [];
|
|
409
|
+
for (let e of o) {
|
|
410
|
+
let t = a.getVarAst(e);
|
|
411
|
+
e.lb !== -Infinity && i.add(a.compareAstWithNumber(t, ">=", e.lb)), e.ub !== Infinity && i.add(a.compareAstWithNumber(t, "<=", e.ub)), (e.type === "Binary" || e.type === "BINARY") && (i.add(a.compareAstWithNumber(t, ">=", 0)), i.add(a.compareAstWithNumber(t, "<=", 1)));
|
|
412
|
+
}
|
|
413
|
+
for (let e of c) {
|
|
414
|
+
let t = a.translateConstraint(e), n = r.Bool.const(e.name);
|
|
415
|
+
i.addAndTrack(t, n);
|
|
416
|
+
}
|
|
417
|
+
for (let e = 0; e < l.length; e++) {
|
|
418
|
+
let t = l[e], n = t && t.name || `lc_${e + 1}`, o = t && t.expr || t, s = a.translateBoolExpr(o), c = r.Bool.const(n);
|
|
419
|
+
i.addAndTrack(s, c);
|
|
420
|
+
}
|
|
421
|
+
let u = (await i.check()).toString();
|
|
422
|
+
if (u === "sat") {
|
|
423
|
+
let e = i.model(), t = {};
|
|
424
|
+
for (let n of o) {
|
|
425
|
+
let r = a.getVarAst(n), i = e.eval(r);
|
|
426
|
+
t[n.name] = a.parseAstValue(i);
|
|
427
|
+
}
|
|
428
|
+
for (let n of s) {
|
|
429
|
+
let r = a.getBoolVarAst(n), i = e.eval(r);
|
|
430
|
+
t[n.name] = i.toString() === "true";
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
status: "Sat",
|
|
434
|
+
values: t
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
if (u === "unsat") {
|
|
438
|
+
let e = i.unsatCore(), t = [], n = typeof e.length == "function" ? e.length() : e.length;
|
|
439
|
+
for (let r = 0; r < n; r++) t.push(e.get(r).toString());
|
|
440
|
+
return {
|
|
441
|
+
status: "Unsat",
|
|
442
|
+
values: {},
|
|
443
|
+
unsatCore: t
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
status: "Unknown",
|
|
448
|
+
values: {}
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
async solve(e, t, n = {}) {
|
|
452
|
+
if (!(e.objective !== null && e.objective !== void 0 && ("terms" in e.objective && e.objective.terms.size > 0 || "quadTerms" in e.objective && e.objective.quadTerms.length > 0 || e.objective.offset && e.objective.offset !== 0))) {
|
|
453
|
+
let t = await this.check(e, n), r = {};
|
|
454
|
+
for (let [e, n] of Object.entries(t.values)) r[e] = typeof n == "boolean" ? +!!n : n;
|
|
455
|
+
return {
|
|
456
|
+
status: t.status === "Sat" ? "Optimal" : t.status === "Unsat" ? "Infeasible" : "Error",
|
|
457
|
+
objectiveValue: 0,
|
|
458
|
+
values: r
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
let { Context: r } = await j(), i = new r(`opt_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`), a = new i.Optimize(), o = this.createContextTranslator(i), s = e.variables || e.vars || [], c = e.boolVars || [], l = e.constraints || [], u = e.logicalConstraints || [];
|
|
462
|
+
for (let e of s) {
|
|
463
|
+
let t = o.getVarAst(e);
|
|
464
|
+
e.lb !== -Infinity && a.add(o.compareAstWithNumber(t, ">=", e.lb)), e.ub !== Infinity && a.add(o.compareAstWithNumber(t, "<=", e.ub)), (e.type === "Binary" || e.type === "BINARY") && (a.add(o.compareAstWithNumber(t, ">=", 0)), a.add(o.compareAstWithNumber(t, "<=", 1)));
|
|
465
|
+
}
|
|
466
|
+
for (let e of l) {
|
|
467
|
+
let t = o.translateConstraint(e);
|
|
468
|
+
a.add(t);
|
|
469
|
+
}
|
|
470
|
+
for (let e of u) {
|
|
471
|
+
let t = e && e.expr || e, n = o.translateBoolExpr(t);
|
|
472
|
+
a.add(n);
|
|
473
|
+
}
|
|
474
|
+
let d = e.objective instanceof Object && "quadTerms" in e.objective ? o.translateQuadExpr(e.objective) : o.translateLinExpr(e.objective);
|
|
475
|
+
(e.sense || "MINIMIZE").toUpperCase() === "MAXIMIZE" ? a.maximize(d) : a.minimize(d);
|
|
476
|
+
let f = (await a.check()).toString();
|
|
477
|
+
if (f === "sat") {
|
|
478
|
+
let e = a.model(), t = {};
|
|
479
|
+
for (let n of s) {
|
|
480
|
+
let r = o.getVarAst(n), i = e.eval(r);
|
|
481
|
+
t[n.name] = o.parseAstValue(i);
|
|
482
|
+
}
|
|
483
|
+
for (let n of c) {
|
|
484
|
+
let r = o.getBoolVarAst(n), i = e.eval(r);
|
|
485
|
+
t[n.name] = +(i.toString() === "true");
|
|
486
|
+
}
|
|
487
|
+
return {
|
|
488
|
+
status: "Optimal",
|
|
489
|
+
objectiveValue: o.parseAstValue(e.eval(d)),
|
|
490
|
+
values: t
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
return f === "unsat" ? {
|
|
494
|
+
status: "Infeasible",
|
|
495
|
+
objectiveValue: null,
|
|
496
|
+
values: {}
|
|
497
|
+
} : {
|
|
498
|
+
status: "Error",
|
|
499
|
+
objectiveValue: null,
|
|
500
|
+
values: {}
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
function P() {
|
|
505
|
+
E("z3", () => new N());
|
|
506
|
+
}
|
|
507
|
+
P();
|
|
508
|
+
//#endregion
|
|
509
|
+
export { u as _, k as a, C as c, m as d, a as f, d as g, c as h, O as i, S as l, o as m, P as n, E as o, s as p, M as r, D as s, N as t, x as u, l as v, f as y };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glpk-loader.d.ts","sourceRoot":"","sources":["../../src/glpk-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,YAAY,GAAG,GAAG,CAAC;AAIxB,wBAAsB,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"glpk-loader.d.ts","sourceRoot":"","sources":["../../src/glpk-loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,YAAY,GAAG,GAAG,CAAC;AAIxB,wBAAsB,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,CA8BrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highs-assets.d.ts","sourceRoot":"","sources":["../../src/highs-assets.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highs-browser-runtime.d.ts","sourceRoot":"","sources":["../../src/highs-browser-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -15,7 +15,7 @@ export declare function probeWasmUrl(url: string): Promise<boolean>;
|
|
|
15
15
|
/**
|
|
16
16
|
* Resolve the HiGHS WASM URL for browser / worker environments.
|
|
17
17
|
* - Explicit URLs (customWasmUrl or options.wasmUrl) are strictly used (no CDN fallback).
|
|
18
|
-
* - Default resolution
|
|
18
|
+
* - Default resolution uses the package asset, with no probe or external fallback.
|
|
19
19
|
*/
|
|
20
20
|
export declare function resolveBrowserWasmUrl(explicitUrl?: string): Promise<string>;
|
|
21
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highs-loader.d.ts","sourceRoot":"","sources":["../../src/highs-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"highs-loader.d.ts","sourceRoot":"","sources":["../../src/highs-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD,eAAO,MAAM,2BAA2B,+DACsB,CAAC;AAE/D,KAAK,aAAa,GAAG,GAAG,CAAC;AAMzB,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,QAKjD;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAQ5D;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAgChE;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASjF;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,CA8CjF;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC;IAAE,MAAM,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highs-node-runtime.d.ts","sourceRoot":"","sources":["../../src/highs-node-runtime.ts"],"names":[],"mappings":"AAAA,wBAAsB,aAAa,IAAI,OAAO,CAAC,GAAG,CAAC,CAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highs-worker-client.d.ts","sourceRoot":"","sources":["../../src/highs-worker-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"highs-worker-client.d.ts","sourceRoot":"","sources":["../../src/highs-worker-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,mBAAmB,CAAC;AAwD3B;;GAEG;AACH,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,YAAY,GAAG;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC;IAAE,MAAM,EAAE,mBAAmB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA0B3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highs-worker-factory.d.ts","sourceRoot":"","sources":["../../src/highs-worker-factory.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Solver, SolverOptions, SolverResult } from "./types.js";
|
|
2
2
|
import type { LpModelData, LpExportResult } from "../lp-writer.js";
|
|
3
|
+
import type { SolverStatus } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Map a raw HiGHS model status string to WaSHI's standardized SolverStatus.
|
|
6
|
+
* Only verified optimality maps to "Optimal"; missing or unrecognized statuses map to "Unknown".
|
|
7
|
+
*/
|
|
8
|
+
export declare function mapHighsStatus(rawStatus: unknown): SolverStatus;
|
|
3
9
|
/**
|
|
4
10
|
* HiGHS Solver adapter (WebAssembly in Browser / Node.js)
|
|
5
11
|
* High-performance simplex / interior point / branch-and-cut solver.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highs.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/highs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"highs.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/highs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY,CAkE/D;AAED;;;GAGG;AACH,qBAAa,WAAY,YAAW,MAAM;IACxC,gBAAuB,YAAY;QACjC,WAAW;QACX,UAAU;MACV;IACF,SAAgB,IAAI,WAAW;IAC/B,SAAgB,OAAO,YAAY;IACnC,SAAgB,YAAY;;;MAA4B;IACjD,OAAO,EAAE,aAAa,CAAC;IAE9B,YAAY,OAAO,GAAE,aAAkB,EAEtC;IAEK,KAAK,CACT,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAyDvB;CACF;AAED;;GAEG;AACH,eAAO,MAAM,KAAK,oBAAc,CAAC"}
|
|
@@ -51,7 +51,7 @@ export interface SolverCapabilities {
|
|
|
51
51
|
supportsQCQP?: boolean;
|
|
52
52
|
/** Supports satisfiability modulo theories / logical constraints */
|
|
53
53
|
supportsSMT?: boolean;
|
|
54
|
-
/** Supports extracting
|
|
54
|
+
/** Supports extracting an unsatisfiable core (conflicting constraint subset; minimality is not guaranteed) */
|
|
55
55
|
supportsUnsatCore?: boolean;
|
|
56
56
|
}
|
|
57
57
|
export interface SolverCheckResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yCAAyC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oEAAoE;IACpE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8GAA8G;IAC9G,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAC3C;;OAEG;IACH,KAAK,CACH,SAAS,EAAE,WAAW,EACtB,QAAQ,EAAE,cAAc,EACxB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC,CAAC;IACzB;;OAEG;IACH,KAAK,CAAC,CACJ,SAAS,EAAE,GAAG,EACd,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/B"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Solver, SolverCapabilities, SolverOptions, SolverResult, SolverCheckResult } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Reset cached Z3 initialization promise (primarily for testing).
|
|
4
|
+
*/
|
|
5
|
+
export declare function resetZ3LoaderCache(): void;
|
|
2
6
|
/**
|
|
3
7
|
* Z3 SMT / SAT / MIP Solver Adapter
|
|
4
8
|
*
|
|
@@ -20,11 +24,6 @@ export declare class Z3Solver implements Solver {
|
|
|
20
24
|
* Tracks constraints to return an unsatCore if infeasible.
|
|
21
25
|
*/
|
|
22
26
|
check(modelData: any, _options?: SolverOptions): Promise<SolverCheckResult>;
|
|
23
|
-
/**
|
|
24
|
-
* Lightweight in-memory SMT / SAT reasoning engine for browser environments
|
|
25
|
-
* or when z3-solver native WASM is not available.
|
|
26
|
-
*/
|
|
27
|
-
private fallbackCheck;
|
|
28
27
|
/**
|
|
29
28
|
* Solve optimization problem (MIP) or feasibility problem
|
|
30
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"z3.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/z3.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,iBAAiB,EAClB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"z3.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/z3.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AA8BpB;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;;;;;GAQG;AACH,qBAAa,QAAS,YAAW,MAAM;IACrC,QAAQ,CAAC,IAAI,QAAQ;IACrB,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAKvC;IAEF;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA+L/B;;;OAGG;IACG,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,QAAQ,GAAE,aAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAsFpF;IAED;;OAEG;IACG,KAAK,CACT,SAAS,EAAE,GAAG,EACd,SAAS,EAAE,GAAG,EACd,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAiHvB;CACF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|