@ohtaman/washi 0.3.0 → 0.5.0
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 +111 -118
- package/README.md +109 -116
- package/README.zh-CN.md +112 -119
- package/dist/browser/highs-worker.js +21 -3
- package/dist/browser/loader-CtaDHef_.js +273 -0
- package/dist/browser/solvers/glpk.js +433 -286
- package/dist/browser/solvers/glpk.min.js +1 -1
- package/dist/browser/solvers/z3.js +1002 -981
- package/dist/browser/solvers/z3.min.js +2 -2
- package/dist/browser/washi.js +2178 -622
- package/dist/browser/washi.min.js +4 -4
- package/dist/lib/highs-worker.js +21 -3
- package/dist/lib/loader-DmNC_UNk.js +279 -0
- package/dist/lib/registry-BEfvpZW3.js +951 -0
- package/dist/lib/solvers/glpk.js +201 -90
- package/dist/lib/solvers/z3.js +399 -259
- package/dist/lib/washi.js +1674 -932
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modeler/big-m.d.ts +75 -0
- package/dist/types/modeler/big-m.d.ts.map +1 -0
- package/dist/types/modeler/boolean-expr.d.ts +103 -14
- package/dist/types/modeler/boolean-expr.d.ts.map +1 -1
- package/dist/types/modeler/constraint.d.ts +36 -9
- package/dist/types/modeler/constraint.d.ts.map +1 -1
- package/dist/types/modeler/expression.d.ts +117 -27
- package/dist/types/modeler/expression.d.ts.map +1 -1
- package/dist/types/modeler/index.d.ts +10 -6
- package/dist/types/modeler/index.d.ts.map +1 -1
- package/dist/types/modeler/lp-writer.d.ts +27 -2
- package/dist/types/modeler/lp-writer.d.ts.map +1 -1
- package/dist/types/modeler/model.d.ts +491 -140
- package/dist/types/modeler/model.d.ts.map +1 -1
- package/dist/types/modeler/objective.d.ts +59 -0
- package/dist/types/modeler/objective.d.ts.map +1 -0
- package/dist/types/modeler/parser.d.ts +39 -14
- package/dist/types/modeler/parser.d.ts.map +1 -1
- package/dist/types/modeler/quad-expr.d.ts +28 -7
- package/dist/types/modeler/quad-expr.d.ts.map +1 -1
- package/dist/types/modeler/solution-validator.d.ts +93 -0
- package/dist/types/modeler/solution-validator.d.ts.map +1 -0
- package/dist/types/modeler/solvers/glpk/solver.d.ts +26 -2
- package/dist/types/modeler/solvers/glpk/solver.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/loader.d.ts +36 -11
- package/dist/types/modeler/solvers/highs/loader.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/solver.d.ts +11 -4
- package/dist/types/modeler/solvers/highs/solver.d.ts.map +1 -1
- package/dist/types/modeler/solvers/highs/worker-client.d.ts.map +1 -1
- package/dist/types/modeler/solvers/mock.d.ts +14 -5
- package/dist/types/modeler/solvers/mock.d.ts.map +1 -1
- package/dist/types/modeler/solvers/types.d.ts +71 -11
- package/dist/types/modeler/solvers/types.d.ts.map +1 -1
- package/dist/types/modeler/solvers/z3/loader.d.ts +2 -3
- package/dist/types/modeler/solvers/z3/loader.d.ts.map +1 -1
- package/dist/types/modeler/solvers/z3/solver.d.ts +15 -5
- package/dist/types/modeler/solvers/z3/solver.d.ts.map +1 -1
- package/dist/types/modeler/types.d.ts +60 -2
- package/dist/types/modeler/types.d.ts.map +1 -1
- package/dist/types/modeler/validation.d.ts +56 -0
- package/dist/types/modeler/validation.d.ts.map +1 -0
- package/dist/types/modeler/variable.d.ts +53 -13
- package/dist/types/modeler/variable.d.ts.map +1 -1
- package/docs/examples/diet-sensitivity.md +90 -0
- package/docs/examples/ecommerce-coupons.md +106 -0
- package/docs/examples/index.md +53 -0
- package/docs/examples/knapsack.md +60 -0
- package/docs/examples/portfolio-qp.md +83 -0
- package/docs/examples/production.md +51 -0
- package/docs/examples/shift-scheduling.md +175 -0
- package/docs/examples/smt-security.md +74 -0
- package/docs/examples/transportation.md +90 -0
- package/docs/examples/unsat-core.md +64 -0
- package/docs/getting-started/ai-agents.md +267 -0
- package/docs/getting-started/cross-origin.md +87 -0
- package/docs/getting-started/index.md +116 -0
- package/docs/getting-started/runtimes.md +227 -0
- package/docs/guide/constraints.md +177 -0
- package/docs/guide/expressions.md +204 -0
- package/docs/guide/objectives.md +170 -0
- package/docs/guide/unsat-core.md +147 -0
- package/docs/guide/variables.md +188 -0
- package/docs/ja/getting-started/ai-agents.md +266 -0
- package/docs/solvers/custom-solver.md +525 -0
- package/docs/solvers/glpk.md +66 -0
- package/docs/solvers/highs.md +93 -0
- package/docs/solvers/index.md +42 -0
- package/docs/solvers/z3.md +78 -0
- package/docs/zh/getting-started/ai-agents.md +266 -0
- package/llms-full.txt +3249 -0
- package/llms.txt +197 -0
- package/package.json +19 -6
- package/skills/washi/SKILL.md +197 -0
- package/dist/browser/loader-CVt4CloI.js +0 -58
- package/dist/lib/async-mutex-Duo4jwzn.js +0 -195
- package/dist/lib/constraint-BRuB3ooC.js +0 -90
- package/dist/lib/loader-Dti0v9yC.js +0 -50
- package/dist/lib/registry-DksqCSjI.js +0 -32
|
@@ -0,0 +1,951 @@
|
|
|
1
|
+
//#region src/modeler/boolean-expr.ts
|
|
2
|
+
var e = 0;
|
|
3
|
+
function t(e, t) {
|
|
4
|
+
if (e instanceof n || e instanceof d) return e;
|
|
5
|
+
throw typeof e == "object" && e && ("terms" in e || "quadTerms" in e) ? Error(`Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical operator "${t}". Use a comparison constraint such as expr\`\${x} <= 10\` or a BoolVar/BoolExpr.`) : Error(`Invalid operand passed to logical operator "${t}": expected a BoolVar, BoolExpr, or Constraint.`);
|
|
6
|
+
}
|
|
7
|
+
var n = class {
|
|
8
|
+
and(e) {
|
|
9
|
+
return new i("and", [this, t(e, "and")]);
|
|
10
|
+
}
|
|
11
|
+
or(e) {
|
|
12
|
+
return new i("or", [this, t(e, "or")]);
|
|
13
|
+
}
|
|
14
|
+
implies(e) {
|
|
15
|
+
return new i("implies", [this, t(e, "implies")]);
|
|
16
|
+
}
|
|
17
|
+
xor(e) {
|
|
18
|
+
return new i("xor", [this, t(e, "xor")]);
|
|
19
|
+
}
|
|
20
|
+
not() {
|
|
21
|
+
return new i("not", [this]);
|
|
22
|
+
}
|
|
23
|
+
}, r = class extends n {
|
|
24
|
+
id;
|
|
25
|
+
name;
|
|
26
|
+
value = null;
|
|
27
|
+
constructor(t) {
|
|
28
|
+
super(), this.id = ++e, this.name = t || `p_${this.id}`;
|
|
29
|
+
}
|
|
30
|
+
toString() {
|
|
31
|
+
return this.name;
|
|
32
|
+
}
|
|
33
|
+
}, i = class extends n {
|
|
34
|
+
op;
|
|
35
|
+
children;
|
|
36
|
+
constructor(e, n) {
|
|
37
|
+
super(), this.op = e, this.children = n.map((n) => t(n, e));
|
|
38
|
+
}
|
|
39
|
+
toString() {
|
|
40
|
+
return this.op === "not" ? `not(${this.children[0].toString()})` : `(${this.children.map((e) => e.toString()).join(` ${this.op} `)})`;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
function a(...e) {
|
|
44
|
+
if (e.length === 0) throw Error("and() requires at least one expression");
|
|
45
|
+
return new i("and", e);
|
|
46
|
+
}
|
|
47
|
+
function o(...e) {
|
|
48
|
+
if (e.length === 0) throw Error("or() requires at least one expression");
|
|
49
|
+
return new i("or", e);
|
|
50
|
+
}
|
|
51
|
+
function s(e) {
|
|
52
|
+
return new i("not", [e]);
|
|
53
|
+
}
|
|
54
|
+
function c(e, t) {
|
|
55
|
+
return new i("implies", [e, t]);
|
|
56
|
+
}
|
|
57
|
+
function l(...e) {
|
|
58
|
+
if (e.length === 0) throw Error("xor() requires at least one expression");
|
|
59
|
+
return new i("xor", e);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/modeler/constraint.ts
|
|
63
|
+
var u = 0, d = class e {
|
|
64
|
+
kind = "constraint";
|
|
65
|
+
id;
|
|
66
|
+
_lhs;
|
|
67
|
+
_sense;
|
|
68
|
+
_rhs;
|
|
69
|
+
_name;
|
|
70
|
+
hasExplicitName;
|
|
71
|
+
ownerModel = null;
|
|
72
|
+
slack = null;
|
|
73
|
+
dual = null;
|
|
74
|
+
constructor(e, t, n, r) {
|
|
75
|
+
this.id = ++u, this._lhs = e, this._sense = t, this._rhs = n;
|
|
76
|
+
let i = typeof r == "string" ? r.trim() : void 0;
|
|
77
|
+
i && i.length > 0 ? (this._name = i, this.hasExplicitName = !0) : (this._name = `c_${this.id}`, this.hasExplicitName = !1);
|
|
78
|
+
}
|
|
79
|
+
get lhs() {
|
|
80
|
+
return this._lhs;
|
|
81
|
+
}
|
|
82
|
+
set lhs(e) {
|
|
83
|
+
this._lhs !== e && (this._lhs = e, this.ownerModel?.notifyMutation?.());
|
|
84
|
+
}
|
|
85
|
+
get sense() {
|
|
86
|
+
return this._sense;
|
|
87
|
+
}
|
|
88
|
+
set sense(e) {
|
|
89
|
+
this._sense !== e && (this._sense = e, this.ownerModel?.notifyMutation?.());
|
|
90
|
+
}
|
|
91
|
+
get rhs() {
|
|
92
|
+
return this._rhs;
|
|
93
|
+
}
|
|
94
|
+
set rhs(e) {
|
|
95
|
+
Object.is(this._rhs, e) || (this._rhs = e, this.ownerModel?.notifyMutation?.());
|
|
96
|
+
}
|
|
97
|
+
get name() {
|
|
98
|
+
return this._name;
|
|
99
|
+
}
|
|
100
|
+
set name(e) {
|
|
101
|
+
this._name !== e && (this._name = e, this.ownerModel?.notifyMutation?.()), this.hasExplicitName = !0;
|
|
102
|
+
}
|
|
103
|
+
_assignModelName(e, t) {
|
|
104
|
+
this._name = e, this.hasExplicitName = t;
|
|
105
|
+
}
|
|
106
|
+
and(e) {
|
|
107
|
+
return new i("and", [this, e]);
|
|
108
|
+
}
|
|
109
|
+
or(e) {
|
|
110
|
+
return new i("or", [this, e]);
|
|
111
|
+
}
|
|
112
|
+
implies(e) {
|
|
113
|
+
return new i("implies", [this, e]);
|
|
114
|
+
}
|
|
115
|
+
xor(e) {
|
|
116
|
+
return new i("xor", [this, e]);
|
|
117
|
+
}
|
|
118
|
+
not() {
|
|
119
|
+
return new i("not", [this]);
|
|
120
|
+
}
|
|
121
|
+
add(e) {
|
|
122
|
+
throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
123
|
+
}
|
|
124
|
+
sub(e) {
|
|
125
|
+
throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
126
|
+
}
|
|
127
|
+
mul(e) {
|
|
128
|
+
throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
129
|
+
}
|
|
130
|
+
div(e) {
|
|
131
|
+
throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
132
|
+
}
|
|
133
|
+
neg() {
|
|
134
|
+
throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
135
|
+
}
|
|
136
|
+
le(e, t) {
|
|
137
|
+
throw Error("Cannot compare a Constraint in (<=): expected a number, Var, or LinExpr.");
|
|
138
|
+
}
|
|
139
|
+
ge(e, t) {
|
|
140
|
+
throw Error("Cannot compare a Constraint in (>=): expected a number, Var, or LinExpr.");
|
|
141
|
+
}
|
|
142
|
+
eq(e, t) {
|
|
143
|
+
throw Error("Cannot compare a Constraint in (==): expected a number, Var, or LinExpr.");
|
|
144
|
+
}
|
|
145
|
+
get value() {
|
|
146
|
+
throw Error("Cannot read numeric value of a Constraint: expected a Var, LinExpr, or QuadExpr.");
|
|
147
|
+
}
|
|
148
|
+
get constant() {
|
|
149
|
+
throw Error("Cannot read numeric constant of a Constraint: expected a LinExpr or QuadExpr.");
|
|
150
|
+
}
|
|
151
|
+
clone() {
|
|
152
|
+
return new e(this._lhs.clone(), this._sense, this._rhs, this.hasExplicitName ? this._name : void 0);
|
|
153
|
+
}
|
|
154
|
+
toString() {
|
|
155
|
+
let e = this.sense === "==" ? "=" : this.sense;
|
|
156
|
+
return `${this.name}: ${this.lhs.toString()} ${e} ${this.rhs}`;
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
function f(e) {
|
|
160
|
+
return e instanceof d || typeof e == "object" && !!e && "sense" in e && "lhs" in e && "rhs" in e;
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/modeler/quad-expr.ts
|
|
164
|
+
function p(e, t) {
|
|
165
|
+
let n = e.id, r = t.id;
|
|
166
|
+
return n <= r ? `${n}:${r}` : `${r}:${n}`;
|
|
167
|
+
}
|
|
168
|
+
var m = class e {
|
|
169
|
+
kind = "quadratic";
|
|
170
|
+
linearTerms;
|
|
171
|
+
quadTerms;
|
|
172
|
+
constant;
|
|
173
|
+
constructor(e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = 0) {
|
|
174
|
+
this.linearTerms = new Map(e), this.quadTerms = /* @__PURE__ */ new Map();
|
|
175
|
+
for (let [e, n] of t) this.quadTerms.set(e, { ...n });
|
|
176
|
+
this.constant = n;
|
|
177
|
+
}
|
|
178
|
+
clone() {
|
|
179
|
+
return new e(this.linearTerms, this.quadTerms, this.constant);
|
|
180
|
+
}
|
|
181
|
+
getQuadCoeff(e, t) {
|
|
182
|
+
let n = p(e, t), r = this.quadTerms.get(n);
|
|
183
|
+
return r ? r.coeff : 0;
|
|
184
|
+
}
|
|
185
|
+
add(t) {
|
|
186
|
+
if (f(t)) throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
187
|
+
let n = this.clone();
|
|
188
|
+
if (typeof t == "number") return n.constant += t, n;
|
|
189
|
+
if (t instanceof e) {
|
|
190
|
+
for (let [e, r] of t.quadTerms) {
|
|
191
|
+
let t = n.quadTerms.get(e), i = (t ? t.coeff : 0) + r.coeff;
|
|
192
|
+
i === 0 ? n.quadTerms.delete(e) : n.quadTerms.set(e, {
|
|
193
|
+
var1: r.var1,
|
|
194
|
+
var2: r.var2,
|
|
195
|
+
coeff: i
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
for (let [e, r] of t.linearTerms) {
|
|
199
|
+
let t = (n.linearTerms.get(e) ?? 0) + r;
|
|
200
|
+
t === 0 ? n.linearTerms.delete(e) : n.linearTerms.set(e, t);
|
|
201
|
+
}
|
|
202
|
+
return n.constant += t.constant, n;
|
|
203
|
+
}
|
|
204
|
+
if ("terms" in t && t.terms instanceof Map) {
|
|
205
|
+
for (let [e, r] of t.terms) {
|
|
206
|
+
let t = (n.linearTerms.get(e) ?? 0) + r;
|
|
207
|
+
t === 0 ? n.linearTerms.delete(e) : n.linearTerms.set(e, t);
|
|
208
|
+
}
|
|
209
|
+
return n.constant += t.constant, n;
|
|
210
|
+
}
|
|
211
|
+
let r = t, i = (n.linearTerms.get(r) ?? 0) + 1;
|
|
212
|
+
return i === 0 ? n.linearTerms.delete(r) : n.linearTerms.set(r, i), n;
|
|
213
|
+
}
|
|
214
|
+
sub(e) {
|
|
215
|
+
if (f(e)) throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
216
|
+
return typeof e == "number" ? this.add(-e) : this.add(e.mul(-1));
|
|
217
|
+
}
|
|
218
|
+
mul(t) {
|
|
219
|
+
if (f(t)) throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
220
|
+
if (typeof t == "number") {
|
|
221
|
+
let n = this.linearTerms.size > 0 || this.quadTerms.size > 0, r = this.constant === 0 && n ? 0 : this.constant * t;
|
|
222
|
+
if (this.constant !== 0 && t !== 0 && r === 0) throw Error("Constant multiplication underflows to zero.");
|
|
223
|
+
let i = new e(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), r);
|
|
224
|
+
for (let [e, n] of this.linearTerms) {
|
|
225
|
+
let r = n * t;
|
|
226
|
+
if (n !== 0 && t !== 0 && r === 0) throw Error("Coefficient multiplication underflows to zero.");
|
|
227
|
+
r !== 0 && i.linearTerms.set(e, r);
|
|
228
|
+
}
|
|
229
|
+
for (let [e, n] of this.quadTerms) {
|
|
230
|
+
let r = n.coeff * t;
|
|
231
|
+
if (n.coeff !== 0 && t !== 0 && r === 0) throw Error("Coefficient multiplication underflows to zero.");
|
|
232
|
+
r !== 0 && i.quadTerms.set(e, {
|
|
233
|
+
var1: n.var1,
|
|
234
|
+
var2: n.var2,
|
|
235
|
+
coeff: r
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return i;
|
|
239
|
+
}
|
|
240
|
+
let n = "id" in t && "name" in t && !("terms" in t) && !("quadTerms" in t), r = "quadTerms" in t ? t.quadTerms.size : 0, i = n ? /* @__PURE__ */ new Map([[t, 1]]) : "quadTerms" in t ? t.linearTerms : t.terms, a = n ? 0 : t.constant;
|
|
241
|
+
if (this.quadTerms.size > 0 && (r > 0 || i.size > 0) || r > 0 && this.linearTerms.size > 0) throw Error("Multiplication creates a non-linear term of degree > 2 (not allowed in MILP/LP/QP)");
|
|
242
|
+
if (r === 0 && i.size === 0) return this.mul(a);
|
|
243
|
+
if (this.quadTerms.size === 0 && this.linearTerms.size === 0 && !n) {
|
|
244
|
+
let n = t.mul(this.constant);
|
|
245
|
+
return "quadTerms" in n ? n : new e(n.terms, /* @__PURE__ */ new Map(), n.constant);
|
|
246
|
+
}
|
|
247
|
+
return e.multiplyLinearTerms(this.constant, this.linearTerms, a, i);
|
|
248
|
+
}
|
|
249
|
+
div(t) {
|
|
250
|
+
let n = e.extractScalarDivisor(t, "QuadExpr.div()");
|
|
251
|
+
return this.mul(1 / n);
|
|
252
|
+
}
|
|
253
|
+
neg() {
|
|
254
|
+
return this.mul(-1);
|
|
255
|
+
}
|
|
256
|
+
get value() {
|
|
257
|
+
let e = this.constant;
|
|
258
|
+
for (let [t, n] of this.linearTerms) {
|
|
259
|
+
if (t.value === null) return null;
|
|
260
|
+
e += n * t.value;
|
|
261
|
+
}
|
|
262
|
+
for (let t of this.quadTerms.values()) {
|
|
263
|
+
if (t.var1.value === null || t.var2.value === null) return null;
|
|
264
|
+
e += t.coeff * t.var1.value * t.var2.value;
|
|
265
|
+
}
|
|
266
|
+
return e;
|
|
267
|
+
}
|
|
268
|
+
le(e, t) {
|
|
269
|
+
return this.toConstraint("<=", e, t);
|
|
270
|
+
}
|
|
271
|
+
ge(e, t) {
|
|
272
|
+
return this.toConstraint(">=", e, t);
|
|
273
|
+
}
|
|
274
|
+
eq(e, t) {
|
|
275
|
+
return this.toConstraint("==", e, t);
|
|
276
|
+
}
|
|
277
|
+
toConstraint(e, t, n) {
|
|
278
|
+
if (this.quadTerms.size > 0) throw Error(`Quadratic expressions are not supported in linear constraints (${e}): quadratic terms are only allowed in objectives.`);
|
|
279
|
+
let r = new h(this.linearTerms, this.constant);
|
|
280
|
+
return e === "<=" ? r.le(t, n) : e === ">=" ? r.ge(t, n) : r.eq(t, n);
|
|
281
|
+
}
|
|
282
|
+
and(e) {
|
|
283
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'and': expected a BoolVar, Constraint, or BoolOp.");
|
|
284
|
+
}
|
|
285
|
+
or(e) {
|
|
286
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'or': expected a BoolVar, Constraint, or BoolOp.");
|
|
287
|
+
}
|
|
288
|
+
implies(e) {
|
|
289
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'implies': expected a BoolVar, Constraint, or BoolOp.");
|
|
290
|
+
}
|
|
291
|
+
xor(e) {
|
|
292
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'xor': expected a BoolVar, Constraint, or BoolOp.");
|
|
293
|
+
}
|
|
294
|
+
not() {
|
|
295
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'not': expected a BoolVar, Constraint, or BoolOp.");
|
|
296
|
+
}
|
|
297
|
+
toString() {
|
|
298
|
+
let e = [], t = !0;
|
|
299
|
+
for (let n of this.quadTerms.values()) {
|
|
300
|
+
let r = n.coeff, i = r >= 0 ? t ? "" : "+ " : "- ", a = Math.abs(r), o = a === 1 ? "" : `${a} `;
|
|
301
|
+
n.var1 === n.var2 ? e.push(`${i}${o}${n.var1.name}^2`) : e.push(`${i}${o}${n.var1.name} * ${n.var2.name}`), t = !1;
|
|
302
|
+
}
|
|
303
|
+
for (let [n, r] of this.linearTerms) {
|
|
304
|
+
let i = r >= 0 ? t ? "" : "+ " : "- ", a = Math.abs(r), o = a === 1 ? "" : `${a} `;
|
|
305
|
+
e.push(`${i}${o}${n.name}`), t = !1;
|
|
306
|
+
}
|
|
307
|
+
if (this.constant !== 0 || e.length === 0) {
|
|
308
|
+
let n = this.constant >= 0 ? t ? "" : "+ " : "- ";
|
|
309
|
+
e.push(`${n}${Math.abs(this.constant)}`);
|
|
310
|
+
}
|
|
311
|
+
return e.join(" ") || "0";
|
|
312
|
+
}
|
|
313
|
+
static fromProduct(t, n, r = 1) {
|
|
314
|
+
let i = new e();
|
|
315
|
+
if (r === 0) return i;
|
|
316
|
+
let a = p(t, n);
|
|
317
|
+
return i.quadTerms.set(a, {
|
|
318
|
+
var1: t.id <= n.id ? t : n,
|
|
319
|
+
var2: t.id <= n.id ? n : t,
|
|
320
|
+
coeff: r
|
|
321
|
+
}), i;
|
|
322
|
+
}
|
|
323
|
+
static multiplyLinearTerms(t, n, r, i) {
|
|
324
|
+
let a = n.size > 0 || i.size > 0, o = (t === 0 || r === 0) && a ? 0 : t * r;
|
|
325
|
+
if (t !== 0 && r !== 0 && o === 0) throw Error("Constant multiplication underflows to zero.");
|
|
326
|
+
let s = new e(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), o === 0 ? 0 : o);
|
|
327
|
+
if (r !== 0) for (let [e, t] of n) {
|
|
328
|
+
let n = t * r;
|
|
329
|
+
if (t !== 0 && n === 0) throw Error("Coefficient multiplication underflows to zero.");
|
|
330
|
+
n !== 0 && s.linearTerms.set(e, n);
|
|
331
|
+
}
|
|
332
|
+
if (t !== 0) for (let [e, n] of i) {
|
|
333
|
+
let r = s.linearTerms.get(e) ?? 0, i = n * t;
|
|
334
|
+
if (n !== 0 && i === 0) throw Error("Coefficient multiplication underflows to zero.");
|
|
335
|
+
let a = r + i;
|
|
336
|
+
a === 0 ? s.linearTerms.delete(e) : s.linearTerms.set(e, a);
|
|
337
|
+
}
|
|
338
|
+
for (let [t, r] of n) for (let [n, a] of i) {
|
|
339
|
+
let i = r * a;
|
|
340
|
+
if (r !== 0 && a !== 0 && i === 0) throw Error("Coefficient multiplication underflows to zero.");
|
|
341
|
+
s = s.add(e.fromProduct(t, n, i));
|
|
342
|
+
}
|
|
343
|
+
return s;
|
|
344
|
+
}
|
|
345
|
+
static extractScalarDivisor(e, t) {
|
|
346
|
+
if (f(e)) throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
347
|
+
if (typeof e == "number") {
|
|
348
|
+
if (e === 0) throw Error(`Division by zero in ${t}`);
|
|
349
|
+
return e;
|
|
350
|
+
}
|
|
351
|
+
let n = "quadTerms" in e ? e.linearTerms.size : e.terms.size, r = "quadTerms" in e ? e.quadTerms.size : 0;
|
|
352
|
+
if (n > 0 || r > 0) throw Error("Cannot divide by variable in expression");
|
|
353
|
+
if (e.constant === 0) throw Error(`Division by zero in ${t}`);
|
|
354
|
+
return e.constant;
|
|
355
|
+
}
|
|
356
|
+
}, h = class e {
|
|
357
|
+
kind = "linear";
|
|
358
|
+
terms;
|
|
359
|
+
constant;
|
|
360
|
+
constructor(e = /* @__PURE__ */ new Map(), t = 0) {
|
|
361
|
+
this.terms = new Map(e), this.constant = t;
|
|
362
|
+
}
|
|
363
|
+
clone() {
|
|
364
|
+
return new e(this.terms, this.constant);
|
|
365
|
+
}
|
|
366
|
+
add(e) {
|
|
367
|
+
if (f(e)) throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
368
|
+
if (e instanceof m) return e.add(this);
|
|
369
|
+
let t = this.clone();
|
|
370
|
+
if (typeof e == "number") t.constant += e;
|
|
371
|
+
else if ("terms" in e) {
|
|
372
|
+
for (let [n, r] of e.terms) {
|
|
373
|
+
let e = (t.terms.get(n) ?? 0) + r;
|
|
374
|
+
e === 0 ? t.terms.delete(n) : t.terms.set(n, e);
|
|
375
|
+
}
|
|
376
|
+
t.constant += e.constant;
|
|
377
|
+
} else {
|
|
378
|
+
let n = (t.terms.get(e) ?? 0) + 1;
|
|
379
|
+
n === 0 ? t.terms.delete(e) : t.terms.set(e, n);
|
|
380
|
+
}
|
|
381
|
+
return t;
|
|
382
|
+
}
|
|
383
|
+
sub(e) {
|
|
384
|
+
if (f(e)) throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
385
|
+
return e instanceof m ? e.neg().add(this) : typeof e == "number" ? this.add(-e) : this.add(e.mul(-1));
|
|
386
|
+
}
|
|
387
|
+
mul(t) {
|
|
388
|
+
if (f(t)) throw Error("Cannot perform arithmetic on a Constraint: expected a number, Var, LinExpr, or QuadExpr.");
|
|
389
|
+
if (typeof t == "number") {
|
|
390
|
+
let n = this.constant === 0 && this.terms.size > 0 ? 0 : this.constant * t;
|
|
391
|
+
if (this.constant !== 0 && t !== 0 && n === 0) throw Error("Constant multiplication underflows to zero.");
|
|
392
|
+
let r = new e(/* @__PURE__ */ new Map(), n);
|
|
393
|
+
for (let [e, n] of this.terms) {
|
|
394
|
+
let i = n * t;
|
|
395
|
+
if (n !== 0 && t !== 0 && i === 0) throw Error("Coefficient multiplication underflows to zero.");
|
|
396
|
+
i !== 0 && r.terms.set(e, i);
|
|
397
|
+
}
|
|
398
|
+
return r;
|
|
399
|
+
}
|
|
400
|
+
return t instanceof F || typeof t == "object" && t && "id" in t && !("terms" in t) && !("quadTerms" in t) ? m.multiplyLinearTerms(this.constant, this.terms, 0, /* @__PURE__ */ new Map([[t, 1]])) : t instanceof m ? this.terms.size === 0 ? t.mul(this.constant) : new m(this.terms, /* @__PURE__ */ new Map(), this.constant).mul(t) : this.terms.size === 0 ? t.mul(this.constant) : t.terms.size === 0 ? this.mul(t.constant) : m.multiplyLinearTerms(this.constant, this.terms, t.constant, t.terms);
|
|
401
|
+
}
|
|
402
|
+
div(e) {
|
|
403
|
+
let t = m.extractScalarDivisor(e, "LinExpr.div()");
|
|
404
|
+
return this.mul(1 / t);
|
|
405
|
+
}
|
|
406
|
+
neg() {
|
|
407
|
+
return this.mul(-1);
|
|
408
|
+
}
|
|
409
|
+
get value() {
|
|
410
|
+
let e = this.constant;
|
|
411
|
+
for (let [t, n] of this.terms) {
|
|
412
|
+
if (t.value === null) return null;
|
|
413
|
+
e += n * t.value;
|
|
414
|
+
}
|
|
415
|
+
return e;
|
|
416
|
+
}
|
|
417
|
+
le(e, t) {
|
|
418
|
+
return this.toConstraint("<=", e, t);
|
|
419
|
+
}
|
|
420
|
+
ge(e, t) {
|
|
421
|
+
return this.toConstraint(">=", e, t);
|
|
422
|
+
}
|
|
423
|
+
eq(e, t) {
|
|
424
|
+
return this.toConstraint("==", e, t);
|
|
425
|
+
}
|
|
426
|
+
toConstraint(t, n, r) {
|
|
427
|
+
let i = this.clone(), a = 0;
|
|
428
|
+
if (typeof n == "number") a = n;
|
|
429
|
+
else if (n instanceof d || typeof n == "object" && n && "sense" in n && "lhs" in n) throw Error(`Cannot compare against a Constraint in (${t}): expected a number, Var, or LinExpr.`);
|
|
430
|
+
else if (n instanceof m || typeof n == "object" && n && "quadTerms" in n) {
|
|
431
|
+
let r = n;
|
|
432
|
+
if (r.quadTerms.size > 0) throw Error(`Quadratic expressions are not supported in linear constraints (${t}): quadratic terms are only allowed in objectives.`);
|
|
433
|
+
i = i.sub(new e(r.linearTerms, 0)), a = r.constant;
|
|
434
|
+
} else "terms" in n ? (i = i.sub(new e(n.terms, 0)), a = n.constant) : i = i.sub(n);
|
|
435
|
+
let o = a - i.constant;
|
|
436
|
+
return i.constant = 0, new d(i, t, o, r);
|
|
437
|
+
}
|
|
438
|
+
and(e) {
|
|
439
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'and': expected a BoolVar, Constraint, or BoolOp.");
|
|
440
|
+
}
|
|
441
|
+
or(e) {
|
|
442
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'or': expected a BoolVar, Constraint, or BoolOp.");
|
|
443
|
+
}
|
|
444
|
+
implies(e) {
|
|
445
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'implies': expected a BoolVar, Constraint, or BoolOp.");
|
|
446
|
+
}
|
|
447
|
+
xor(e) {
|
|
448
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'xor': expected a BoolVar, Constraint, or BoolOp.");
|
|
449
|
+
}
|
|
450
|
+
not() {
|
|
451
|
+
throw Error("Cannot use an arithmetic expression without a comparison operator (<=, >=, ==) in logical 'not': expected a BoolVar, Constraint, or BoolOp.");
|
|
452
|
+
}
|
|
453
|
+
toString() {
|
|
454
|
+
let e = [], t = !0;
|
|
455
|
+
for (let [n, r] of this.terms) {
|
|
456
|
+
let i = r >= 0 ? t ? "" : "+ " : "- ", a = Math.abs(r), o = a === 1 ? "" : `${a} `;
|
|
457
|
+
e.push(`${i}${o}${n.name}`), t = !1;
|
|
458
|
+
}
|
|
459
|
+
if (this.constant !== 0 || e.length === 0) {
|
|
460
|
+
let n = this.constant >= 0 ? t ? "" : "+ " : "- ";
|
|
461
|
+
e.push(`${n}${Math.abs(this.constant)}`);
|
|
462
|
+
}
|
|
463
|
+
return e.join(" ") || "0";
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
function g(e, t) {
|
|
467
|
+
let n = /* @__PURE__ */ new Map(), r = 0;
|
|
468
|
+
function i(e) {
|
|
469
|
+
if (e != null) {
|
|
470
|
+
if (typeof e == "number") r += e;
|
|
471
|
+
else if (e instanceof d || typeof e == "object" && "sense" in e && "lhs" in e && "rhs" in e) throw Error("Cannot sum a constraint comparison (<=, >=, ==) in sum(): expected a number, Var, or LinExpr.");
|
|
472
|
+
else if (e instanceof m || typeof e == "object" && "quadTerms" in e && e.quadTerms instanceof Map) {
|
|
473
|
+
let t = e;
|
|
474
|
+
if (t.quadTerms.size > 0) throw Error("Quadratic expressions are not supported in sum(): sum() produces a linear expression (LinExpr).");
|
|
475
|
+
for (let [e, r] of t.linearTerms) {
|
|
476
|
+
let t = n.get(e) ?? 0;
|
|
477
|
+
n.set(e, t + r);
|
|
478
|
+
}
|
|
479
|
+
r += t.constant;
|
|
480
|
+
} else if (typeof e == "object" && "terms" in e) {
|
|
481
|
+
let t = e;
|
|
482
|
+
for (let [e, r] of t.terms) {
|
|
483
|
+
let t = n.get(e) ?? 0;
|
|
484
|
+
n.set(e, t + r);
|
|
485
|
+
}
|
|
486
|
+
r += t.constant;
|
|
487
|
+
} else if (typeof e == "object" && "id" in e && "name" in e && "lb" in e && "ub" in e) {
|
|
488
|
+
let t = e, r = n.get(t) ?? 0;
|
|
489
|
+
n.set(t, r + 1);
|
|
490
|
+
} else throw Error("Unsupported item in sum(): expected a number, Var, or LinExpr.");
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (typeof e == "number") {
|
|
494
|
+
let n = e, r = t;
|
|
495
|
+
for (let e = 0; e < n; e++) i(r(e, e));
|
|
496
|
+
} else {
|
|
497
|
+
let n = 0;
|
|
498
|
+
for (let r of e) i(t ? t(r, n++) : r);
|
|
499
|
+
}
|
|
500
|
+
for (let [e, t] of n) t === 0 && n.delete(e);
|
|
501
|
+
return new h(n, r);
|
|
502
|
+
}
|
|
503
|
+
function _(e, t) {
|
|
504
|
+
let n = /* @__PURE__ */ new Map(), r = 0;
|
|
505
|
+
function i(e) {
|
|
506
|
+
return typeof e == "object" && !!e && !(e instanceof d) && typeof e.id == "number" && typeof e.name == "string" && typeof e.lb == "number" && typeof e.ub == "number" && typeof e.type == "string" && typeof e.mul == "function" && typeof e.le == "function";
|
|
507
|
+
}
|
|
508
|
+
function a(e) {
|
|
509
|
+
return i(e) || e instanceof h || e instanceof m;
|
|
510
|
+
}
|
|
511
|
+
function o(e, t, a) {
|
|
512
|
+
if (!Number.isFinite(e)) throw Error(`Invalid non-finite coefficient "${e}" in dot() at '${a || "root"}'.`);
|
|
513
|
+
if (t instanceof m) throw Error(`Quadratic expressions are not supported in dot() at '${a || "root"}': dot() produces a linear expression (LinExpr).`);
|
|
514
|
+
if (t instanceof h) {
|
|
515
|
+
if (!Number.isFinite(t.constant)) throw Error(`Invalid non-finite constant "${t.constant}" in dot() at '${a || "root"}'.`);
|
|
516
|
+
let i = e === 0 || t.constant === 0 ? 0 : e * t.constant;
|
|
517
|
+
if (e !== 0 && t.constant !== 0 && i === 0) throw Error("Constant multiplication underflows to zero.");
|
|
518
|
+
if (!Number.isFinite(i)) throw Error(`Coefficient multiplication overflows finite floating-point range in dot() at '${a || "root"}'.`);
|
|
519
|
+
let o = r + i;
|
|
520
|
+
if (!Number.isFinite(o)) throw Error(`Constant accumulation overflows finite floating-point range in dot() at '${a || "root"}'.`);
|
|
521
|
+
r = o;
|
|
522
|
+
for (let [r, i] of t.terms) {
|
|
523
|
+
if (!Number.isFinite(i)) throw Error(`Invalid non-finite coefficient "${i}" in dot() at '${a || "root"}'.`);
|
|
524
|
+
let t = e * i;
|
|
525
|
+
if (e !== 0 && i !== 0 && t === 0) throw Error("Coefficient multiplication underflows to zero.");
|
|
526
|
+
if (!Number.isFinite(t)) throw Error(`Coefficient multiplication overflows finite floating-point range in dot() at '${a || "root"}'.`);
|
|
527
|
+
let o = (n.get(r) ?? 0) + t;
|
|
528
|
+
if (!Number.isFinite(o)) throw Error(`Coefficient accumulation overflows finite floating-point range in dot() at '${a || "root"}'.`);
|
|
529
|
+
n.set(r, o);
|
|
530
|
+
}
|
|
531
|
+
} else if (i(t)) {
|
|
532
|
+
let r = t, i = (n.get(r) ?? 0) + e;
|
|
533
|
+
if (!Number.isFinite(i)) throw Error(`Coefficient accumulation overflows finite floating-point range in dot() at '${a || "root"}'.`);
|
|
534
|
+
n.set(r, i);
|
|
535
|
+
} else throw Error(`Cannot multiply number by non-variable/expression operand in dot() at '${a || "root"}'.`);
|
|
536
|
+
}
|
|
537
|
+
function s(e) {
|
|
538
|
+
return typeof e == "object" && !!e && !Array.isArray(e) && !a(e) && !(e instanceof d) && e.kind !== "constraint";
|
|
539
|
+
}
|
|
540
|
+
function c(e, t, n = "") {
|
|
541
|
+
if (e === void 0 || t === void 0 || e === null || t === null) throw Error(`Nullish or undefined operand encountered in dot() at '${n || "root"}'.`);
|
|
542
|
+
if (typeof e == "number" && typeof t == "number") throw Error(`Cannot multiply two numbers in dot() at '${n || "root"}': expected one numeric coefficient and one Var or LinExpr.`);
|
|
543
|
+
if (typeof e == "number") {
|
|
544
|
+
o(e, t, n);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (typeof t == "number") {
|
|
548
|
+
o(t, e, n);
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (Array.isArray(e) || Array.isArray(t)) {
|
|
552
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
553
|
+
if (e.length !== t.length) throw Error(`Array length mismatch in dot() at '${n || "root"}': received lengths ${e.length} and ${t.length}.`);
|
|
554
|
+
for (let r = 0; r < e.length; r++) c(e[r], t[r], n ? `${n}[${r}]` : `[${r}]`);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
let r = Array.isArray(e) ? e : t, i = Array.isArray(e) ? t : e;
|
|
558
|
+
if (s(i)) {
|
|
559
|
+
if (Object.getOwnPropertySymbols(i).length > 0) throw Error(`Symbol keys are not supported in dot() at '${n || "root"}'.`);
|
|
560
|
+
let a = Object.keys(i);
|
|
561
|
+
if (a.length === r.length && a.every((e) => /^(?:0|[1-9]\d*)$/.test(e))) {
|
|
562
|
+
let a = [];
|
|
563
|
+
for (let e = 0; e < r.length; e++) Object.prototype.hasOwnProperty.call(i, e) || a.push(e);
|
|
564
|
+
if (a.length > 0) throw Error(`Key mismatch in dot() at '${n || "root"}': missing indices [${a.join(", ")}] in numeric record.`);
|
|
565
|
+
for (let i = 0; i < r.length; i++) c(e[i], t[i], n ? `${n}[${i}]` : `[${i}]`);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
throw a.length > 0 && a.every((e) => /^(?:0|[1-9]\d*)$/.test(e)) ? Error(`Array length mismatch in dot() at '${n || "root"}': array has length ${r.length}, but object has ${a.length} indices.`) : Error(`Type mismatch in dot() at '${n || "root"}': one operand is an Array while the other is an Object with keys [${a.slice(0, 5).join(", ")}].`);
|
|
569
|
+
}
|
|
570
|
+
throw Error(`Type mismatch in dot() at '${n || "root"}': one operand is an Array while the other is not.`);
|
|
571
|
+
}
|
|
572
|
+
if (s(e) && s(t)) {
|
|
573
|
+
if (Object.getOwnPropertySymbols(e).length > 0 || Object.getOwnPropertySymbols(t).length > 0) throw Error(`Symbol keys are not supported in dot() at '${n || "root"}'.`);
|
|
574
|
+
let r = Object.keys(e), i = Object.keys(t), a = r.filter((e) => !Object.prototype.hasOwnProperty.call(t, e)), o = i.filter((t) => !Object.prototype.hasOwnProperty.call(e, t));
|
|
575
|
+
if (a.length > 0 || o.length > 0) {
|
|
576
|
+
let e = [];
|
|
577
|
+
throw a.length > 0 && e.push(`missing in second operand: [${a.join(", ")}]`), o.length > 0 && e.push(`missing in first operand: [${o.join(", ")}]`), Error(`Key mismatch in dot() at '${n || "root"}': ${e.join("; ")}.`);
|
|
578
|
+
}
|
|
579
|
+
for (let i of r) c(e[i], t[i], n ? `${n}.${i}` : i);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
throw Error(`Unsupported operand types in dot() at '${n || "root"}'.`);
|
|
583
|
+
}
|
|
584
|
+
c(e, t);
|
|
585
|
+
for (let [e, t] of n) t === 0 && n.delete(e);
|
|
586
|
+
return new h(n, r);
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/modeler/validation.ts
|
|
590
|
+
var v = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
|
|
591
|
+
function x(e, t, n) {
|
|
592
|
+
if (e instanceof i) for (let r of e.children) x(r, t, n);
|
|
593
|
+
else if (e instanceof d) {
|
|
594
|
+
let r = e.ownerModel, i = y.get(e);
|
|
595
|
+
(r !== t || i !== t) && (n && n.push(() => {
|
|
596
|
+
e.ownerModel = r, i ? y.set(e, i) : y.delete(e);
|
|
597
|
+
}), e.ownerModel = t, y.set(e, t));
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function S(e, t) {
|
|
601
|
+
let n = v.get(e);
|
|
602
|
+
if (n && n !== t) throw Error(`Variable "${e.name}" already belongs to model "${n.name}" and cannot be added to model "${t.name}".`);
|
|
603
|
+
v.set(e, t);
|
|
604
|
+
}
|
|
605
|
+
function C(e, t) {
|
|
606
|
+
let n = b.get(e);
|
|
607
|
+
if (n) throw Error(n === t ? `Constraint "${e.name}" is already registered in model "${t.name}".` : `Constraint "${e.name}" already belongs to model "${n.name}" and cannot be added to model "${t.name}".`);
|
|
608
|
+
let r = y.get(e);
|
|
609
|
+
if (r && r !== t) throw Error(`Constraint "${e.name}" already belongs to model "${r.name}" and cannot be added to model "${t.name}".`);
|
|
610
|
+
return b.set(e, t), y.set(e, t), r;
|
|
611
|
+
}
|
|
612
|
+
function w(e, t) {
|
|
613
|
+
v.get(e) === t && v.delete(e);
|
|
614
|
+
}
|
|
615
|
+
function T(e, t, n) {
|
|
616
|
+
b.get(e) === t && b.delete(e), y.get(e) === t && (n ? y.set(e, n) : y.delete(e));
|
|
617
|
+
}
|
|
618
|
+
var E = 1e-6;
|
|
619
|
+
function D(e) {
|
|
620
|
+
if (typeof e.lb != "number" || Number.isNaN(e.lb)) throw Error(`Variable "${e.name}" has invalid lower bound: ${e.lb} (NaN or non-numeric bound is not allowed).`);
|
|
621
|
+
if (e.lb === Infinity) throw Error(`Variable "${e.name}" has invalid lower bound: +Infinity is not allowed as a lower bound.`);
|
|
622
|
+
if (typeof e.ub != "number" || Number.isNaN(e.ub)) throw Error(`Variable "${e.name}" has invalid upper bound: ${e.ub} (NaN or non-numeric bound is not allowed).`);
|
|
623
|
+
if (e.ub === -Infinity) throw Error(`Variable "${e.name}" has invalid upper bound: -Infinity is not allowed as an upper bound.`);
|
|
624
|
+
if (e.lb > e.ub) throw Error(`Variable "${e.name}" has invalid bounds: lower bound (${e.lb}) is strictly greater than upper bound (${e.ub}).`);
|
|
625
|
+
if (e.initialValue !== void 0) {
|
|
626
|
+
if (typeof e.initialValue != "number" || !Number.isFinite(e.initialValue)) throw Error(`Variable "${e.name}" has invalid initialValue: ${String(e.initialValue)} (initialValue must be a finite number).`);
|
|
627
|
+
let t = e.type === "Binary" ? Math.max(0, e.lb) : e.lb, n = e.type === "Binary" ? Math.min(1, e.ub) : e.ub;
|
|
628
|
+
if (e.initialValue < t - 1e-6 || e.initialValue > n + 1e-6) throw Error(`Variable "${e.name}" has initialValue (${e.initialValue}) outside its bounds [${t}, ${n}] (tolerance ${E}).`);
|
|
629
|
+
if (e.type === "Integer" || e.type === "Binary") {
|
|
630
|
+
let r = Math.round(e.initialValue);
|
|
631
|
+
if (Math.abs(e.initialValue - r) > 1e-6 || r < t || r > n) throw Error(`Variable "${e.name}" of type "${e.type}" has non-integral or out-of-domain initialValue: ${e.initialValue} (must be within ${E} of an integer in [${t}, ${n}]).`);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function O(e) {
|
|
636
|
+
if (e.initialValue === void 0) return;
|
|
637
|
+
if (D(e), e.type === "Integer" || e.type === "Binary") {
|
|
638
|
+
let t = Math.round(e.initialValue);
|
|
639
|
+
return Object.is(t, -0) ? 0 : t;
|
|
640
|
+
}
|
|
641
|
+
let t = Math.min(e.ub, Math.max(e.lb, e.initialValue));
|
|
642
|
+
return Object.is(t, -0) ? 0 : t;
|
|
643
|
+
}
|
|
644
|
+
function k(e, t, n) {
|
|
645
|
+
if (e instanceof m) {
|
|
646
|
+
if (!Number.isFinite(e.constant)) throw Error(`Objective function has invalid constant: ${e.constant}. Constant must be a finite number.`);
|
|
647
|
+
for (let [r, i] of e.linearTerms) {
|
|
648
|
+
if (!n(r)) throw Error(`Variable "${r.name}" in objective function does not belong to model "${t}". All variables must belong to the model by object identity.`);
|
|
649
|
+
if (!Number.isFinite(i)) throw Error(`Variable "${r.name}" in objective function has invalid coefficient: ${i}. Coefficients must be finite numbers.`);
|
|
650
|
+
}
|
|
651
|
+
for (let [, r] of e.quadTerms) {
|
|
652
|
+
if (!n(r.var1)) throw Error(`Variable "${r.var1.name}" in quadratic objective function does not belong to model "${t}". All variables must belong to the model by object identity.`);
|
|
653
|
+
if (!n(r.var2)) throw Error(`Variable "${r.var2.name}" in quadratic objective function does not belong to model "${t}". All variables must belong to the model by object identity.`);
|
|
654
|
+
if (!Number.isFinite(r.coeff) || !Number.isFinite(r.coeff * 2)) throw Error(`Quadratic term (${r.var1.name} * ${r.var2.name}) in objective function has invalid coefficient: ${r.coeff}.`);
|
|
655
|
+
}
|
|
656
|
+
} else if ("terms" in e) {
|
|
657
|
+
if (!Number.isFinite(e.constant)) throw Error(`Objective function has invalid constant: ${e.constant}. Constant must be a finite number.`);
|
|
658
|
+
for (let [r, i] of e.terms) {
|
|
659
|
+
if (!n(r)) throw Error(`Variable "${r.name}" in objective function does not belong to model "${t}". All variables must belong to the model by object identity.`);
|
|
660
|
+
if (!Number.isFinite(i)) throw Error(`Variable "${r.name}" in objective function has invalid coefficient: ${i}. Coefficients must be finite numbers.`);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
function A(e, t, n, r = e.name) {
|
|
665
|
+
if (!Number.isFinite(e.rhs)) throw Error(`Constraint "${r}" has invalid right-hand side (RHS): ${e.rhs}. RHS must be a finite number.`);
|
|
666
|
+
if (e.lhs.constant !== void 0 && !Number.isFinite(e.lhs.constant)) throw Error(`Constraint "${r}" has invalid LHS constant: ${e.lhs.constant}. Constant must be a finite number.`);
|
|
667
|
+
for (let [i, a] of e.lhs.terms) {
|
|
668
|
+
if (!n(i)) throw Error(`Variable "${i.name}" in constraint "${r}" does not belong to model "${t}". All variables must belong to the model by object identity.`);
|
|
669
|
+
if (!Number.isFinite(a)) throw Error(`Variable "${i.name}" in constraint "${r}" has invalid coefficient: ${a}. Coefficients must be finite numbers.`);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
function j(e, t, n, a, o, s) {
|
|
673
|
+
if (e instanceof r) {
|
|
674
|
+
if (!o(e)) throw Error(`Boolean variable "${e.name}" in logical constraint "${t}" does not belong to model "${n}".`);
|
|
675
|
+
} else if (e instanceof i) for (let r of e.children) j(r, t, n, a, o, s);
|
|
676
|
+
else if (e instanceof d) {
|
|
677
|
+
if (s) {
|
|
678
|
+
let r = y.get(e) ?? e.ownerModel ?? void 0;
|
|
679
|
+
if (r && r !== s) throw Error(`Constraint "${e.name}" embedded in logical constraint "${t}" already belongs to model "${r.name ?? "another model"}" and cannot be added to model "${n}".`);
|
|
680
|
+
}
|
|
681
|
+
if (!Number.isFinite(e.rhs)) throw Error(`Constraint "${e.name}" embedded in logical constraint "${t}" has invalid RHS: ${e.rhs}.`);
|
|
682
|
+
if (e.lhs.constant !== void 0 && !Number.isFinite(e.lhs.constant)) throw Error(`Constraint "${e.name}" embedded in logical constraint "${t}" has invalid LHS constant: ${e.lhs.constant}.`);
|
|
683
|
+
for (let [r, i] of e.lhs.terms) {
|
|
684
|
+
if (!a(r)) throw Error(`Variable "${r.name}" embedded in logical constraint "${t}" does not belong to model "${n}".`);
|
|
685
|
+
if (!Number.isFinite(i)) throw Error(`Variable "${r.name}" embedded in logical constraint "${t}" has invalid coefficient: ${i}.`);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
function M(e) {
|
|
690
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
691
|
+
for (let r of e.variables) {
|
|
692
|
+
D(r);
|
|
693
|
+
let i = v.get(r);
|
|
694
|
+
if (i && i !== e || t.has(r.name) || e.getVarByName(r.name) !== r) throw Error(`Variable "${r.name}" is duplicated or not canonically registered in model "${e.name}".`);
|
|
695
|
+
t.add(r.name), n.add(r);
|
|
696
|
+
}
|
|
697
|
+
let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
698
|
+
for (let t of e.boolVars) {
|
|
699
|
+
if (r.has(t.name) || e.getBoolVarByName(t.name) !== t) throw Error(`Boolean variable "${t.name}" is duplicated or not canonically registered in model "${e.name}".`);
|
|
700
|
+
r.add(t.name), i.add(t);
|
|
701
|
+
}
|
|
702
|
+
let a = /* @__PURE__ */ new Set();
|
|
703
|
+
for (let t of e.constraints) {
|
|
704
|
+
if (r.has(t.name)) throw Error(`Constraint name "${t.name}" conflicts with Boolean variable "${t.name}" in model "${e.name}".`);
|
|
705
|
+
if (a.has(t.name)) throw Error(`Duplicate constraint name "${t.name}" in model "${e.name}".`);
|
|
706
|
+
a.add(t.name);
|
|
707
|
+
}
|
|
708
|
+
for (let t of e.logicalConstraints) {
|
|
709
|
+
if (r.has(t.name)) throw Error(`Logical constraint name "${t.name}" conflicts with Boolean variable "${t.name}" in model "${e.name}".`);
|
|
710
|
+
if (a.has(t.name)) throw Error(`Conflicting constraint name "${t.name}" across arithmetic and logical constraints in model "${e.name}".`);
|
|
711
|
+
a.add(t.name);
|
|
712
|
+
}
|
|
713
|
+
for (let t of e.constraints) {
|
|
714
|
+
let n = y.get(t);
|
|
715
|
+
if (n && n !== e || e.getConstraintByName(t.name) !== t) throw Error(`Constraint "${t.name}" is duplicated or not canonically registered in model "${e.name}".`);
|
|
716
|
+
}
|
|
717
|
+
for (let t of e.logicalConstraints) if (e.getLogicalConstraintByName(t.name) !== t) throw Error(`Logical constraint "${t.name}" is duplicated or not canonically registered in model "${e.name}".`);
|
|
718
|
+
e.objectiveExpr && k(e.objectiveExpr, e.name, (e) => n.has(e));
|
|
719
|
+
for (let t of e.constraints) A(t, e.name, (e) => n.has(e));
|
|
720
|
+
for (let t of e.logicalConstraints) j(t.expr, t.name, e.name, (e) => n.has(e), (e) => i.has(e), e);
|
|
721
|
+
}
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region src/modeler/variable.ts
|
|
724
|
+
var N = 0;
|
|
725
|
+
function P(e) {
|
|
726
|
+
if (e === void 0) return "Continuous";
|
|
727
|
+
if (typeof e == "string") {
|
|
728
|
+
let t = e.toLowerCase();
|
|
729
|
+
if (t === "binary" || t === "bin") return "Binary";
|
|
730
|
+
if (t === "integer" || t === "int") return "Integer";
|
|
731
|
+
if (t === "continuous" || t === "cont") return "Continuous";
|
|
732
|
+
}
|
|
733
|
+
throw Error(`Invalid variable type "${String(e)}": expected "Continuous", "Integer", or "Binary".`);
|
|
734
|
+
}
|
|
735
|
+
var F = class {
|
|
736
|
+
id;
|
|
737
|
+
_name;
|
|
738
|
+
prefix;
|
|
739
|
+
hasExplicitName;
|
|
740
|
+
ownerModel = null;
|
|
741
|
+
_type;
|
|
742
|
+
_lb;
|
|
743
|
+
_ub;
|
|
744
|
+
_initialValue;
|
|
745
|
+
value = null;
|
|
746
|
+
reducedCost = null;
|
|
747
|
+
constructor(e = {}) {
|
|
748
|
+
this.id = ++N;
|
|
749
|
+
let t = typeof e.name == "string" ? e.name.trim() : "", n = typeof e.prefix == "string" ? e.prefix.trim() : "";
|
|
750
|
+
this.prefix = n.length > 0 ? n : "x", this.hasExplicitName = t.length > 0, this._name = this.hasExplicitName ? t : `${this.prefix}_${this.id}`, this._type = P(e.type), this._type === "Binary" ? (this._lb = 0, this._ub = 1) : (this._lb = e.lb === void 0 ? 0 : e.lb, this._ub = e.ub === void 0 ? Infinity : e.ub), this._initialValue = e.initialValue === void 0 ? void 0 : Object.is(e.initialValue, -0) ? 0 : e.initialValue, this._initialValue !== void 0 && D(this);
|
|
751
|
+
}
|
|
752
|
+
get name() {
|
|
753
|
+
return this._name;
|
|
754
|
+
}
|
|
755
|
+
get type() {
|
|
756
|
+
return this._type;
|
|
757
|
+
}
|
|
758
|
+
set type(e) {
|
|
759
|
+
let t = P(e);
|
|
760
|
+
this._type !== t && (this._type = t, this.ownerModel?.notifyMutation?.());
|
|
761
|
+
}
|
|
762
|
+
get lb() {
|
|
763
|
+
return this._lb;
|
|
764
|
+
}
|
|
765
|
+
set lb(e) {
|
|
766
|
+
Object.is(this._lb, e) || (this._lb = e, this.ownerModel?.notifyMutation?.());
|
|
767
|
+
}
|
|
768
|
+
get ub() {
|
|
769
|
+
return this._ub;
|
|
770
|
+
}
|
|
771
|
+
set ub(e) {
|
|
772
|
+
Object.is(this._ub, e) || (this._ub = e, this.ownerModel?.notifyMutation?.());
|
|
773
|
+
}
|
|
774
|
+
get initialValue() {
|
|
775
|
+
return this._initialValue;
|
|
776
|
+
}
|
|
777
|
+
set initialValue(e) {
|
|
778
|
+
let t = e !== void 0 && Object.is(e, -0) ? 0 : e;
|
|
779
|
+
Object.is(this._initialValue, t) || (this._initialValue = t, this.ownerModel?.notifyMutation?.());
|
|
780
|
+
}
|
|
781
|
+
_assignModelName(e) {
|
|
782
|
+
this._name = e;
|
|
783
|
+
}
|
|
784
|
+
mul(e) {
|
|
785
|
+
return typeof e == "number" ? new h(/* @__PURE__ */ new Map([[this, 1]]), 0).mul(e) : new m(/* @__PURE__ */ new Map([[this, 1]]), /* @__PURE__ */ new Map(), 0).mul(e);
|
|
786
|
+
}
|
|
787
|
+
add(e) {
|
|
788
|
+
return e instanceof m ? e.add(this) : new h(/* @__PURE__ */ new Map([[this, 1]]), 0).add(e);
|
|
789
|
+
}
|
|
790
|
+
sub(e) {
|
|
791
|
+
return e instanceof m ? e.neg().add(this) : new h(/* @__PURE__ */ new Map([[this, 1]]), 0).sub(e);
|
|
792
|
+
}
|
|
793
|
+
neg() {
|
|
794
|
+
return this.mul(-1);
|
|
795
|
+
}
|
|
796
|
+
le(e, t) {
|
|
797
|
+
return new h(/* @__PURE__ */ new Map([[this, 1]]), 0).le(e, t);
|
|
798
|
+
}
|
|
799
|
+
ge(e, t) {
|
|
800
|
+
return new h(/* @__PURE__ */ new Map([[this, 1]]), 0).ge(e, t);
|
|
801
|
+
}
|
|
802
|
+
eq(e, t) {
|
|
803
|
+
return new h(/* @__PURE__ */ new Map([[this, 1]]), 0).eq(e, t);
|
|
804
|
+
}
|
|
805
|
+
toString() {
|
|
806
|
+
return this.name;
|
|
807
|
+
}
|
|
808
|
+
};
|
|
809
|
+
//#endregion
|
|
810
|
+
//#region src/modeler/lp-writer.ts
|
|
811
|
+
function I(e) {
|
|
812
|
+
return typeof e == "object" && !!e && typeof e.lpString == "string" && e.nameToVar instanceof Map && e.nameToConstraint instanceof Map;
|
|
813
|
+
}
|
|
814
|
+
function L(e, t = "x", n = 0) {
|
|
815
|
+
let r = e.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
816
|
+
return /^[0-9]/.test(r) && (r = `${t}_${r}`), (!r || r.length === 0) && (r = `${t}_${n}`), r;
|
|
817
|
+
}
|
|
818
|
+
function R(e) {
|
|
819
|
+
let t = e.variables || [], n = e.constraints || [], r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
|
|
820
|
+
for (let e = 0; e < t.length; e++) {
|
|
821
|
+
let n = t[e];
|
|
822
|
+
s.set(n, e);
|
|
823
|
+
let a = L(n.name, "x", e), o = a, l = 1;
|
|
824
|
+
for (; c.has(o);) o = `${a}_${l++}`;
|
|
825
|
+
c.add(o), i.set(n, o), r.set(o, n);
|
|
826
|
+
}
|
|
827
|
+
let l = /* @__PURE__ */ new Set();
|
|
828
|
+
for (let e = 0; e < n.length; e++) {
|
|
829
|
+
let t = n[e], r = L(t.name, "c", e + 1), i = r, s = 1;
|
|
830
|
+
for (; l.has(i);) i = `${r}_${s++}`;
|
|
831
|
+
l.add(i), o.set(t, i), a.set(i, t);
|
|
832
|
+
}
|
|
833
|
+
return {
|
|
834
|
+
nameToVar: r,
|
|
835
|
+
varToName: i,
|
|
836
|
+
nameToConstraint: a,
|
|
837
|
+
constraintToName: o,
|
|
838
|
+
constrToName: o,
|
|
839
|
+
varOrder: s
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
function z(e) {
|
|
843
|
+
let { sense: t, objective: n, constraints: r, variables: i } = e, { nameToVar: a, varToName: o, nameToConstraint: s, constrToName: c, varOrder: l } = R(e), u = [];
|
|
844
|
+
u.push(t && t.toLowerCase() === "maximize" ? "Maximize" : "Minimize");
|
|
845
|
+
let d = [], f = !0, p = n instanceof m ? n.linearTerms : n.terms;
|
|
846
|
+
if (p) for (let [e, t] of p) {
|
|
847
|
+
if (t === 0) continue;
|
|
848
|
+
let n = o.get(e), r = t >= 0 ? f ? "" : "+ " : "- ", i = Math.abs(t), a = i === 1 ? "" : `${i} `;
|
|
849
|
+
d.push(`${r}${a}${n}`), f = !1;
|
|
850
|
+
}
|
|
851
|
+
if (n instanceof m && n.quadTerms.size > 0) {
|
|
852
|
+
let e = [], t = !0, r = Array.from(n.quadTerms.values()).filter((e) => e.coeff !== 0).map((e) => {
|
|
853
|
+
let t = l.get(e.var1) ?? e.var1.id, n = l.get(e.var2) ?? e.var2.id, [r, i, a, o] = t <= n ? [
|
|
854
|
+
e.var1,
|
|
855
|
+
e.var2,
|
|
856
|
+
t,
|
|
857
|
+
n
|
|
858
|
+
] : [
|
|
859
|
+
e.var2,
|
|
860
|
+
e.var1,
|
|
861
|
+
n,
|
|
862
|
+
t
|
|
863
|
+
];
|
|
864
|
+
return {
|
|
865
|
+
firstVar: r,
|
|
866
|
+
secondVar: i,
|
|
867
|
+
firstIdx: a,
|
|
868
|
+
secondIdx: o,
|
|
869
|
+
coeff: e.coeff
|
|
870
|
+
};
|
|
871
|
+
}).sort((e, t) => e.firstIdx - t.firstIdx || e.secondIdx - t.secondIdx);
|
|
872
|
+
for (let n of r) {
|
|
873
|
+
let r = 2 * n.coeff, i = r >= 0 ? t ? "" : "+ " : "- ", a = Math.abs(r), s = a === 1 ? "" : `${a} `, c = o.get(n.firstVar), l = o.get(n.secondVar);
|
|
874
|
+
n.firstVar === n.secondVar ? e.push(`${i}${s}${c} ^ 2`) : e.push(`${i}${s}${c} * ${l}`), t = !1;
|
|
875
|
+
}
|
|
876
|
+
if (e.length > 0) {
|
|
877
|
+
let t = `[ ${e.join(" ")} ] / 2`;
|
|
878
|
+
d.length > 0 ? d.push("+", t) : d.push(t);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
let h = d.length > 0 ? d.join(" ") : "0";
|
|
882
|
+
u.push(` obj: ${h}`), u.push("Subject To");
|
|
883
|
+
for (let e of r) {
|
|
884
|
+
let t = c.get(e), n = [], r = !0;
|
|
885
|
+
for (let [t, i] of e.lhs.terms) {
|
|
886
|
+
if (i === 0) continue;
|
|
887
|
+
let e = o.get(t), a = i >= 0 ? r ? "" : "+ " : "- ", s = Math.abs(i), c = s === 1 ? "" : `${s} `;
|
|
888
|
+
n.push(`${a}${c}${e}`), r = !1;
|
|
889
|
+
}
|
|
890
|
+
let i = n.length > 0 ? n.join(" ") : "0", a = e.sense === "==" ? "=" : e.sense;
|
|
891
|
+
u.push(` ${t}: ${i} ${a} ${e.rhs}`);
|
|
892
|
+
}
|
|
893
|
+
u.push("Bounds");
|
|
894
|
+
let g = [], _ = [];
|
|
895
|
+
for (let e of i) {
|
|
896
|
+
let t = o.get(e);
|
|
897
|
+
if (e.type === "Binary") {
|
|
898
|
+
_.push(t);
|
|
899
|
+
continue;
|
|
900
|
+
}
|
|
901
|
+
e.type === "Integer" && g.push(t);
|
|
902
|
+
let n = e.lb === -Infinity, r = e.ub === Infinity;
|
|
903
|
+
n && r ? u.push(` ${t} free`) : n && !r ? u.push(` -infinity <= ${t} <= ${e.ub}`) : !n && r ? (e.lb !== 0 || e.initialValue !== void 0) && u.push(` ${t} >= ${e.lb}`) : u.push(` ${e.lb} <= ${t} <= ${e.ub}`);
|
|
904
|
+
}
|
|
905
|
+
if (g.length > 0) {
|
|
906
|
+
u.push("Generals");
|
|
907
|
+
for (let e = 0; e < g.length; e += 10) u.push(" " + g.slice(e, e + 10).join(" "));
|
|
908
|
+
}
|
|
909
|
+
if (_.length > 0) {
|
|
910
|
+
u.push("Binary");
|
|
911
|
+
for (let e = 0; e < _.length; e += 10) u.push(" " + _.slice(e, e + 10).join(" "));
|
|
912
|
+
}
|
|
913
|
+
return u.push("End"), {
|
|
914
|
+
lpString: u.join("\n") + "\n",
|
|
915
|
+
nameToVar: a,
|
|
916
|
+
nameToConstraint: s
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/modeler/solvers/registry.ts
|
|
921
|
+
var B = Symbol.for("washi.solverRegistry"), V = Symbol.for("washi.defaultSolverFactory"), H = globalThis;
|
|
922
|
+
H[B] || (H[B] = /* @__PURE__ */ new Map());
|
|
923
|
+
var U = H[B];
|
|
924
|
+
function W(e, t) {
|
|
925
|
+
U.set(e.toLowerCase(), t);
|
|
926
|
+
}
|
|
927
|
+
function G(e) {
|
|
928
|
+
if (typeof e == "string") {
|
|
929
|
+
let t = U.get(e.toLowerCase());
|
|
930
|
+
if (!t) throw Error(`Solver '${e}' is not registered.`);
|
|
931
|
+
H[V] = t;
|
|
932
|
+
} else H[V] = typeof e == "function" ? e : () => e;
|
|
933
|
+
}
|
|
934
|
+
function K(e, t) {
|
|
935
|
+
if (!e) {
|
|
936
|
+
let e = H[V] || U.get("highs");
|
|
937
|
+
if (!e) throw Error(`No default solver available. Available solvers: ${q().join(", ")}`);
|
|
938
|
+
return e(t);
|
|
939
|
+
}
|
|
940
|
+
if (typeof e == "string") {
|
|
941
|
+
let n = e.toLowerCase(), r = U.get(n);
|
|
942
|
+
if (!r) throw Error(n === "glpk" ? `Solver 'glpk' not found. Available solvers: ${q().join(", ")}. Please import '@ohtaman/washi/solvers/glpk' before selecting this solver.` : n === "z3" ? `Solver 'z3' not found. Available solvers: ${q().join(", ")}. Please import '@ohtaman/washi/solvers/z3' before selecting this solver.` : `Solver '${e}' not found. Available solvers: ${q().join(", ")}`);
|
|
943
|
+
return r(t);
|
|
944
|
+
}
|
|
945
|
+
return e;
|
|
946
|
+
}
|
|
947
|
+
function q() {
|
|
948
|
+
return Array.from(U.keys());
|
|
949
|
+
}
|
|
950
|
+
//#endregion
|
|
951
|
+
export { c as A, g as C, i as D, n as E, o as M, l as N, r as O, _ as S, d as T, j as _, R as a, D as b, L as c, C as d, S as f, A as g, w as h, G as i, s as j, a as k, F as l, T as m, q as n, z as o, O as p, W as r, I as s, K as t, x as u, M as v, m as w, h as x, k as y };
|