@ohtaman/washi 0.8.0 → 0.8.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.
Files changed (81) hide show
  1. package/README.md +32 -34
  2. package/dist/browser/{__vite-browser-external-rTVKos2U.js → solvers/highs-__vite-browser-external-Dn-83hnF.js} +1 -1
  3. package/dist/browser/{browser-runtime-AG5QFtKf.js → solvers/highs-browser-runtime-0Bgq5ksG.js} +1 -1
  4. package/dist/browser/{loader-i3FnqMes.js → solvers/highs-loader-BLY3wzDH.js} +25 -18
  5. package/dist/browser/{highs-worker.js → solvers/highs-worker.js} +1 -1
  6. package/dist/browser/solvers/highs.js +1414 -0
  7. package/dist/browser/washi.js +1090 -1473
  8. package/dist/browser/washi.min.js +4 -4
  9. package/dist/lib/solvers/glpk.js +34 -32
  10. package/dist/lib/{highs-node-runtime.js → solvers/highs-node-runtime.js} +1 -1
  11. package/dist/lib/solvers/highs.js +410 -0
  12. package/dist/lib/solvers/lp-writer-CLScMFbS.js +115 -0
  13. package/dist/lib/solvers/pumpkin-node-runtime.js +1 -1
  14. package/dist/lib/solvers/pumpkin-worker.js +1 -1
  15. package/dist/lib/solvers/pumpkin.js +247 -1146
  16. package/dist/lib/solvers/registry-CrYRRk9q.js +907 -0
  17. package/dist/lib/solvers/types-BGqPkxwu.js +12 -0
  18. package/dist/lib/solvers/z3.js +125 -123
  19. package/dist/lib/washi.js +2426 -1340
  20. package/dist/types/index.d.ts +1 -2
  21. package/dist/types/index.d.ts.map +1 -1
  22. package/dist/types/modeler/index.d.ts +0 -1
  23. package/dist/types/modeler/index.d.ts.map +1 -1
  24. package/dist/types/modeler/model.d.ts +6 -7
  25. package/dist/types/modeler/model.d.ts.map +1 -1
  26. package/dist/types/modeler/solvers/index.d.ts +2 -1
  27. package/dist/types/modeler/solvers/index.d.ts.map +1 -1
  28. package/dist/types/modeler/solvers/registry.d.ts.map +1 -1
  29. package/docs/examples/diet-sensitivity.md +33 -14
  30. package/docs/examples/ecommerce-coupons.md +17 -9
  31. package/docs/examples/index.md +34 -30
  32. package/docs/examples/knapsack.md +11 -5
  33. package/docs/examples/portfolio-qp.md +21 -8
  34. package/docs/examples/production.md +10 -5
  35. package/docs/examples/project-scheduling.md +25 -12
  36. package/docs/examples/shift-scheduling.md +27 -19
  37. package/docs/examples/smt-security.md +27 -12
  38. package/docs/examples/transportation.md +23 -13
  39. package/docs/examples/traveling-salesperson.md +34 -22
  40. package/docs/examples/unsat-core.md +27 -15
  41. package/docs/examples/vehicle-routing.md +74 -28
  42. package/docs/getting-started/ai-agents.md +129 -90
  43. package/docs/getting-started/coding-agents.md +60 -41
  44. package/docs/getting-started/cross-origin.md +27 -14
  45. package/docs/getting-started/index.md +23 -16
  46. package/docs/getting-started/runtimes.md +70 -40
  47. package/docs/guide/constraint-programming.md +74 -44
  48. package/docs/guide/constraints.md +71 -39
  49. package/docs/guide/decomposition.md +72 -42
  50. package/docs/guide/expressions.md +79 -48
  51. package/docs/guide/formulation-tips.md +46 -27
  52. package/docs/guide/objectives.md +55 -31
  53. package/docs/guide/unsat-core.md +56 -53
  54. package/docs/guide/variables.md +61 -28
  55. package/docs/solvers/custom-solver.md +155 -119
  56. package/docs/solvers/glpk.md +58 -17
  57. package/docs/solvers/highs.md +115 -43
  58. package/docs/solvers/index.md +33 -26
  59. package/docs/solvers/pumpkin.md +71 -63
  60. package/docs/solvers/z3.md +63 -25
  61. package/llms-full.txt +1623 -953
  62. package/llms.txt +125 -93
  63. package/package.json +29 -22
  64. package/skills/washi/SKILL.md +43 -22
  65. package/README.ja.md +0 -248
  66. package/README.zh-CN.md +0 -248
  67. package/dist/browser/solvers/pumpkin.min.js +0 -1
  68. package/dist/lib/registry-dx7x4e5c.js +0 -1694
  69. /package/dist/browser/{highs.wasm → solvers/highs.wasm} +0 -0
  70. /package/dist/browser/{highs.wasm.LICENSE → solvers/highs.wasm.LICENSE} +0 -0
  71. /package/dist/lib/{__vite-browser-external-oLchLuMx.js → solvers/__vite-browser-external-oLchLuMx.js} +0 -0
  72. /package/dist/lib/{highs-assets.js → solvers/highs-assets.js} +0 -0
  73. /package/dist/lib/{highs-browser-runtime.js → solvers/highs-browser-runtime.js} +0 -0
  74. /package/dist/lib/{highs-runtime.js → solvers/highs-runtime.js} +0 -0
  75. /package/dist/lib/{highs-worker-factory.js → solvers/highs-worker-factory.js} +0 -0
  76. /package/dist/lib/{highs-worker.js → solvers/highs-worker.js} +0 -0
  77. /package/dist/lib/{highs.wasm → solvers/highs.wasm} +0 -0
  78. /package/dist/lib/{highs.wasm.LICENSE → solvers/highs.wasm.LICENSE} +0 -0
  79. /package/dist/lib/{loader-CDpPXN_F.js → solvers/loader-CDpPXN_F.js} +0 -0
  80. /package/dist/lib/solvers/{pumpkin-loader-Ow74Fa1B.js → loader-Ow74Fa1B.js} +0 -0
  81. /package/dist/lib/{rolldown-runtime-DtPi1Y-2.js → solvers/rolldown-runtime-DtPi1Y-2.js} +0 -0
@@ -7,6 +7,5 @@
7
7
  export { Model, type ModelOptions, type BoundsOptions, type BinaryOptions, type IndicatorOptions, type ConstraintItem, type KeyCollection, type LogicalConstraint, deriveBigMForLe, deriveBigMForGe, validateUserBigM, buildIndicatorLinearization, linearizeModelForMip, type LinearizationResult, maximize, minimize, type ObjectiveExpr, type ObjectiveSpec, Var, type VarOptions, LinExpr, QuadExpr, type Expr, type NonlinearAtom, type NonlinearTerm, type DotTerm, type DotVarContainer, type DotCoeffContainer, type SumTerm, type SumContainer, type ExtremumTerm, type ExtremumArg, type QuadTerm, sum, dot, abs, max, min, at, Constraint, BoolVar, BoolExpr, BoolOp, GlobalConstraint, type GlobalConstraintSpec, type DiscreteExprOperand, type DisjointTask, type CumulativeTask, type LogicElement, type LogicInput, and, or, not, implies, xor, distinct, disjoint, cumulative, allowed, parseExpr, parseConstraint, expr, type ParsedExpr, type ExprResolver, type ExprContainerLeaf, type ExprRecordContainer, type ExprMapperFn, type ExprInterpolation, generateLpString, buildLpSymbolMaps, isLpExportResult, sanitizeIdentifier, type LpModelData, type LpSymbolMaps, type LpExportResult, type VerifyOptions, type ViolationType, type VerificationViolation, type VerificationSummary, type VerificationReport, } from "./modeler/index.js";
8
8
  export { normalizeSense, type VarType, type OptimizationSense, type ComparisonSense, type SolverStatus, type TerminationStatus, type SolveProgressEvent, type SolveOptions, type SolverSolution, type CheckResult, type ColumnDefinition, } from "./modeler/types.js";
9
9
  export { solveColumnGeneration, solveBenders, type ColumnProposal, type PricingContext, type ColumnGenerationIterationInfo, type ColumnGenerationOptions, type ColumnGenerationResult, type BendersCut, type BendersSubproblemContext, type BendersSubproblemResult, type BendersIterationInfo, type BendersOptions, type BendersResult, } from "./decomposition/index.js";
10
- export { type Solver, type SolverOptions, type SolverResult, type SolverCheckResult, type SolverCapabilities, type SolveModelData, type CheckModelData, type LogicalConstraintItem, HighsSolver, HiGHS, MockSolver, type MockSolverOptions, registerSolver, getSolver, setDefaultSolver, listAvailableSolvers, } from "./modeler/solvers/index.js";
11
- export { getHighs, solveLpWithHighs, setHighsWasmUrl, getHighsWasmUrl, Highs, type HighsSolutionResult, type HighsSolutionColumn, type HighsSolutionRow, } from "./modeler/solvers/highs/index.js";
10
+ export { type Solver, type SolverOptions, type SolverResult, type SolverCheckResult, type SolverCapabilities, type SolveModelData, type CheckModelData, type LogicalConstraintItem, MockSolver, type MockSolverOptions, registerSolver, getSolver, setDefaultSolver, listAvailableSolvers, } from "./modeler/solvers/index.js";
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,KAAK,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3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AAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,KAAK,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,KAAK,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,2BAA2B,EAC3B,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,QAAQ,EACR,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,GAAG,EACH,KAAK,UAAU,EACf,OAAO,EACP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AK,cAAc,EACnB,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,iBAAiB,EACtB,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC"}
@@ -12,5 +12,4 @@ export { generateLpString, buildLpSymbolMaps, isLpExportResult, sanitizeIdentifi
12
12
  export { type VerifyOptions, type ViolationType, type VerificationViolation, type VerificationSummary, type VerificationReport, } from "./solution-validator.js";
13
13
  export type { VarType, OptimizationSense, ComparisonSense, SolverStatus, TerminationStatus, SolveProgressEvent, SolveOptions, SolverSolution, CheckResult, ColumnDefinition, } from "./types.js";
14
14
  export * from "./solvers/index.js";
15
- export { getHighs, solveLpWithHighs, setHighsWasmUrl, getHighsWasmUrl } from "./solvers/highs/index.js";
16
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modeler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAC7G,OAAO,EAAE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W,EAChB,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,EAAE,GACH,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,GAAG,EACH,EAAE,EACF,GAAG,EACH,OAAO,EACP,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAO,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,SAAS,EACT,eAAe,EACf,IAAI,EACJ,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,cAAc,oBAAoB,CAAC"}
@@ -19,7 +19,7 @@ export interface ModelOptions {
19
19
  name?: string;
20
20
  /** Default optimization direction (`"Minimize"` or `"Maximize"`, default: `"Minimize"`). */
21
21
  sense?: OptimizationSense;
22
- /** Solver instance or registered solver name (`"highs"`, `"glpk"`, `"z3"`, or custom solver). */
22
+ /** Solver instance or registered solver name (`"highs"`, `"pumpkin"`, `"glpk"`, `"z3"`, or custom solver). */
23
23
  solver?: Solver | string;
24
24
  }
25
25
  export interface BoundsOptions {
@@ -82,10 +82,10 @@ export type KeyCollection<K extends string | number> = ReadonlyArray<K> | (Itera
82
82
  * running with WebAssembly solvers (HiGHS, Pumpkin, GLPK, Z3) in Node.js and browsers.
83
83
  *
84
84
  * **Solver capability notes**:
85
- * - `"highs"` (default, built-in): Supports LP, MIP, convex QP objectives (`supportsQP: true`),
85
+ * - `"highs"` (default, bundled): Supports LP, MIP, convex QP objectives (`supportsQP: true`),
86
86
  * and `initialValue` warm starts (`supportsWarmStart: true`). Also supports `m.check()` on purely
87
87
  * linear models via a zero-objective feasibility fallback. Throws if `BoolVar`/logical constraints are present.
88
- * - `"pumpkin"` (`import "@ohtaman/washi/solvers/pumpkin"`): Supports bounded `Integer`/`Binary` variables,
88
+ * - `"pumpkin"` (bundled, zero extra imports): Supports bounded `Integer`/`Binary` variables,
89
89
  * integer linear constraints, native `BoolVar`/logical constraints (`and`, `or`, `not`, `implies`, `xor`),
90
90
  * `initialValue` warm-start hints (`supportsWarmStart: true`), and `unsatCore` extraction (`m.check()`)
91
91
  * without requiring `COOP`/`COEP` headers. Throws on `Continuous` variables, quadratic objectives, or `relax: true`.
@@ -552,10 +552,9 @@ export declare class Model {
552
552
  * integer-valued expressions; `Continuous` or non-integer negated constraints require `{ solver: "z3" }`
553
553
  * or explicit `or(expr\`... >= ... + eps\`, ...)` / `m.bool()`), and conflicting constraints are diagnosed
554
554
  * as `result.conflicts` via elastic slack relaxation (leaving `unsatCore: undefined`).
555
- * - **Zero-`COOP`/`COEP` `unsatCore` (Pumpkin)**: Bundled Pumpkin (`{ solver: "pumpkin" }` after
556
- * `import "@ohtaman/washi/solvers/pumpkin"`) extracts `result.conflicts` and `result.unsatCore` (as well as
557
- * `m.conflicts` / `m.unsatCore`) over bounded integer and boolean models without `SharedArrayBuffer` or
558
- * Cross-Origin Isolation headers in browsers.
555
+ * - **Zero-`COOP`/`COEP` `unsatCore` (Pumpkin)**: Bundled Pumpkin (`{ solver: "pumpkin" }`, available out of the box)
556
+ * extracts `result.conflicts` and `result.unsatCore` (as well as `m.conflicts` / `m.unsatCore`) over bounded
557
+ * integer and boolean models without `SharedArrayBuffer` or Cross-Origin Isolation headers in browsers.
559
558
  * - **Exact SMT `unsatCore` (Z3)**: Unsatisfiable-core extraction (`result.conflicts` and `result.unsatCore`,
560
559
  * as well as `m.conflicts` / `m.unsatCore`) also supports `Continuous` and mixed real-integer SMT constraints
561
560
  * when using Z3 (`{ solver: "z3" }` after `import "@ohtaman/washi/solvers/z3"`). Both Pumpkin and Z3 report
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/modeler/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAmB,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,EAIL,KAAK,MAAM,EAGZ,M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tC,OAAO,CAAC,aAAa,CAAC,CAIxB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,qBAAqB,CAAC,WAAW,GAAG,OAAO,EAC/C,OAAO,EAAE,IAAI,CAAC,uBAAuB,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,GAC5D,OAAO,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAI9C;CACF"}
@@ -1,5 +1,6 @@
1
1
  export * from "./types.js";
2
2
  export * from "./registry.js";
3
- export * from "./highs.js";
4
3
  export * from "./mock.js";
4
+ import "./highs.js";
5
+ import "./pumpkin.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAG1B,OAAO,YAAY,CAAC;AACpB,OAAO,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC;AAYhE;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAEzE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,IAAI,CAYpF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAuCzF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/modeler/solvers/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,EAAE,aAAa,KAAK,MAAM,CAAC;AAYhE;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAEzE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,IAAI,CAYpF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAiCzF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
@@ -2,17 +2,17 @@
2
2
 
3
3
  | Problem Class | Solver | Key APIs | Links |
4
4
  | :--- | :--- | :--- | :--- |
5
- | Linear Programming (LP) | HiGHS (default) | `m.continuous()`, `m.constraint()`, `expr` (`dot`), `minimize` | <ul><li><a href="https://washi.ohtaman.dev/demo/?preset=diet_sensitivity">Open in Playground</a></li><li><a href="https://github.com/ohtaman/washi/blob/main/examples/node/10-diet-sensitivity.ts">Source Code</a></li></ul> |
5
+ | Linear Programming (LP) | HiGHS (default) | `m.continuous()`, `m.constraint()`, `constr.dual`, `constr.slack`, `var.reducedCost` | <ul><li><a href="https://washi.ohtaman.dev/demo/?preset=diet_sensitivity">Open in Playground</a></li><li><a href="https://github.com/ohtaman/washi/blob/main/examples/node/10-diet-sensitivity.ts">Source Code</a></li></ul> |
6
6
 
7
- When solving a Linear Programming model, the optimal variable values (`var.value`) are only half the story. In practice, decision-makers need to know:
7
+ After solving a Linear Programming (LP) model, **sensitivity analysis** shows how the optimal cost responds to changes in requirements, caps, or unit prices:
8
8
 
9
- 1. **Bottlenecks (`constr.dual` — Shadow Price):** Which minimum requirements are actively driving up the total cost, and by how much per unit?
10
- 2. **Surpluses (`constr.slack`):** Which constraints have room to spare?
11
- 3. **Reduced Costs (`var.reducedCost`):** For items not selected in the optimal plan, how much cheaper would they need to become before entering the solution?
9
+ 1. **Shadow Price (`constr.dual`):** Marginal change in optimal cost when a constraint's right-hand side increases by 1 unit.
10
+ 2. **Slack (`constr.slack`):** Spare margin (or surplus) on a constraint, where `0` means the constraint is binding.
11
+ 3. **Reduced Cost (`var.reducedCost`):** Marginal change in optimal cost when a variable fixed at its lower or upper bound is increased by 1 unit.
12
12
 
13
13
  ## Problem Inputs
14
14
 
15
- We choose daily servings ($0 \le x_i \le 4$) among 6 food items to meet 4 daily nutritional minimums (`Calories >= 2000 kcal`, `Protein >= 105 g`, `Calcium >= 1000 mg`, `Iron >= 18 mg`) at minimum cost:
15
+ We determine daily servings ($0 \le x_i \le 4$, continuous) for each of 6 foods to minimize daily cost. The plan must meet 4 daily minimums: at least `2000 kcal` of calories, `105 g` of protein, `1000 mg` of calcium, and `18 mg` of iron.
16
16
 
17
17
  | Food Item | Cost / Serving | Calories (kcal) | Protein (g) | Calcium (mg) | Iron (mg) | Max Servings |
18
18
  | :--- | :---: | :---: | :---: | :---: | :---: | :---: |
@@ -42,7 +42,7 @@ const foods = [
42
42
  async function runDietSensitivity() {
43
43
  const m = new Model("DietSensitivity");
44
44
 
45
- // Continuous servings per day (0 to 4 servings max per food)
45
+ // Continuous servings per day (0 to 4 servings per food)
46
46
  const srv = m.continuous(foods.map((f) => f.name), { lb: 0, ub: 4 });
47
47
 
48
48
  const costs = Object.fromEntries(foods.map((f) => [f.name, f.cost]));
@@ -51,10 +51,10 @@ async function runDietSensitivity() {
51
51
  const calcs = Object.fromEntries(foods.map((f) => [f.name, f.calcium]));
52
52
  const irons = Object.fromEntries(foods.map((f) => [f.name, f.iron]));
53
53
 
54
- // Objective: Minimize total daily cost via dot() inside expr
54
+ // Objective: Minimize total daily cost
55
55
  m.objective(minimize(expr`dot(${costs}, ${srv})`));
56
56
 
57
- // Nutritional constraints defined declaratively with expr and constraint()
57
+ // Nutritional minimum constraints
58
58
  const nutConstraints = [
59
59
  m.constraint(expr`dot(${cals}, ${srv}) >= 2000`, "min_calories"),
60
60
  m.constraint(expr`dot(${prots}, ${srv}) >= 105`, "min_protein"),
@@ -83,9 +83,28 @@ runDietSensitivity();
83
83
 
84
84
  ## Interpretation of Results
85
85
 
86
- - **Bottleneck constraints (`slack == 0`, `dual > 0`):** Calories (`2000 kcal`) and Iron (`18 mg`) are tight at their lower bounds. Increasing the daily Iron requirement by 1 mg increases the minimum daily diet cost by **$0.3241**.
87
- - **Constraints with surplus (`slack > 0`, `dual == 0`):** Protein (`+46.46 g` surplus) and Calcium (`+483.02 mg` surplus) are already exceeded with room to spare, so their shadow prices are `$0`.
88
- - **Reduced cost at lower bound (`Salmon`):** Unselected `Salmon` (`0.00` servings) has a reduced cost of `+1.5125`, meaning its price per serving would need to drop by at least **$1.51** before it enters the optimal daily menu.
89
- - **Negative reduced cost at upper bound (`Oats`, `Eggs`):** Both `Oats` (`reducedCost = -0.2581`) and `Eggs` (`reducedCost = -0.0887`) are pinned against their upper serving cap (`ub = 4.0`). In a minimization LP, a negative reduced cost on an upper-bounded variable tells you how much the total objective would **decrease** per unit increase in `ub`—raising the daily cap on `Oats` from 4 to 5 servings would save **$0.26/day**.
90
- - **Basis stability range:** Shadow prices (`dual`) and reduced costs (`reducedCost`) represent local marginal rates of change within the current optimal simplex basis. If a right-hand side or bound changes enough to trigger a basis change (for example, once another variable hits its bound), the marginal rate shifts to a new piece of the piecewise-linear optimal cost curve.
86
+ HiGHS returns `"Optimal"` with a minimum daily cost of **`$13.66`** (`Oats`, `Eggs`, and `Milk` at `4.00` servings each, `Chicken` at `1.55`, `Spinach` at `0.50`, and `Salmon` at `0.00`).
91
87
 
88
+ ### Bottleneck Constraints (`slack == 0`, `dual > 0`)
89
+
90
+ Both `min_calories` and `min_iron` are binding at their lower bounds, with `dual = $0.0091/kcal` for calories and `dual = $0.3241/mg` for iron. Raising the daily iron target by `1 mg` increases the minimum daily cost by `$0.3241`.
91
+
92
+ ### Constraints with Surplus (`|slack| > 0`, `dual == 0`)
93
+
94
+ For `>=` constraints, HiGHS reports `slack` as `rhs - lhs`, returning negative values (`-46.46` for protein and `-483.02` for calcium). The code prints `Math.abs(c.slack)` as the surplus (`46.46 g` of protein and `483.02 mg` of calcium). Because both targets have spare room, their shadow prices are `0`.
95
+
96
+ ### Reduced Cost at the Lower Bound (`Salmon`)
97
+
98
+ `Salmon` is unselected (`value = 0.00`) with `reducedCost = +1.5125`. Its price per serving would need to drop by at least `$1.5125` (about `$1.51`) before entering the optimal menu.
99
+
100
+ ### Negative Reduced Cost at the Upper Bound (`Oats`, `Eggs`, `Milk`)
101
+
102
+ Three foods hit the daily cap of `ub = 4.0`. In a minimization LP, an upper-bounded variable has a non-positive reduced cost, indicating the marginal cost change per unit increase in `ub` (its magnitude is the saving per added serving):
103
+
104
+ - `Oats`: `reducedCost = -1.3546` (raising `ub` by 1 serving saves about `$1.35/day`)
105
+ - `Eggs`: `reducedCost = -1.0307` (raising `ub` by 1 serving saves about `$1.03/day`)
106
+ - `Milk`: `reducedCost = -0.2294` (raising `ub` by 1 serving saves about `$0.23/day`)
107
+
108
+ ### Basis Stability Range
109
+
110
+ Both `dual` and `reducedCost` are local marginal rates valid within the current optimal simplex basis. If a bound or right-hand side changes enough to switch which constraints or bounds are active, these marginal rates shift to new values.
@@ -4,17 +4,22 @@
4
4
  | :--- | :--- | :--- | :--- |
5
5
  | Mixed-Integer Programming (MIP) | HiGHS (default) | `m.binary()`, `m.constraint()`, `m.indicator()`, `expr`, `minimize` | <ul><li><a href="https://washi.ohtaman.dev/demo/?preset=cart_coupon">Open in Playground</a></li><li><a href="https://github.com/ohtaman/washi/blob/main/examples/node/12-ecommerce-coupon-optimizer.ts">Source Code</a></li></ul> |
6
6
 
7
- Modern e-commerce checkouts often feature complex promotional rules: minimum spend thresholds, category-specific discounts, stackable vs. mutually exclusive coupons, and maximum coupon limits per order. Running an optimizer directly in the browser (or an edge worker) lets the checkout UI automatically apply the best coupon combination—and even recommend a small "filler" item when crossing a spend threshold lowers the customer's net bill.
7
+ E-commerce checkouts often combine minimum spend thresholds, category discounts, mutually exclusive coupons, and per-order coupon caps. Formulating these rules as a single MIP model selects the best coupon set and simultaneously determines whether adding a low-cost filler item lowers the final bill.
8
8
 
9
- This example demonstrates **`m.indicator(binVar, constraint, { activeValue, M? })`**, which automatically linearizes conditional *"if coupon is selected, minimum spend must hold"* constraints using Big-M reformulation for MIP solvers like HiGHS. When `M` is omitted, WaSHI automatically derives safe, tight Big-M values from finite variable bounds.
9
+ This example uses `m.indicator(binVar, constraint, { activeValue, M? })` to model conditional rules such as "if a coupon is applied, minimum spend must hold." For MIP solvers like HiGHS, WaSHI applies **Big-M linearization**, relaxing the inequality by a constant `M` when the binary indicator is inactive.
10
+
11
+ > [!IMPORTANT]
12
+ > **Precondition for omitting `M`**: WaSHI derives a tight Big-M automatically only when every variable in the constrained inequality has **finite** `lb` and `ub` bounds (binary variables are automatically bounded in `[0, 1]`). If any variable is unbounded, pass an explicit `M` or set finite bounds first.
10
13
 
11
14
  <EcommerceCouponDemo />
12
15
 
13
16
  ## Scenario & Promotion Rules
14
17
 
15
- A customer's shopping cart currently contains **$242** of merchandise (**$210** in Tech items and **$32** in Apparel):
16
- - **Optional Filler Add-on:** A **$10** Braided USB-C Cable (Tech) can be added to bring the cart total from `$242` to `$252`.
17
- - **Available Coupons** (maximum **2 coupons** total per checkout; at most **1 Exclusive** coupon):
18
+ While the interactive widget above lets you explore a multi-item catalog, the runnable walkthrough below uses a compact single-cart scenario (`$242`, 4 coupons, and 1 optional add-on).
19
+
20
+ A customer's shopping cart currently contains `$242` of merchandise (`$210` in Tech items and `$32` in Apparel):
21
+ - **Optional Filler Add-on**: Adding a `$10` Braided USB-C Cable (Tech) raises the cart subtotal from `$242` to `$252` (and Tech spend from `$210` to `$220`).
22
+ - **Available Coupons**: At most 2 coupons per checkout; exclusive coupons are mutually exclusive with each other (at most 1), though still combinable with stackable coupons.
18
23
 
19
24
  | Coupon Code | Discount | Condition | Stacking Rule |
20
25
  | :--- | :---: | :--- | :--- |
@@ -23,9 +28,6 @@ A customer's shopping cart currently contains **$242** of merchandise (**$210**
23
28
  | `MEGA45_250` | **-$45** | Total cart spend $\ge \$250$ | **Exclusive** (cannot combine with `TECH30`) |
24
29
  | `MEMBER10` | **-$10** | Total cart spend $\ge \$150$ | **Stackable** |
25
30
 
26
- Without adding the `$10` cable, the cart (`$242`) cannot use `MEGA45_250` and pays `$242 - $30 (TECH30) - $15 (WELCOME15) = $197`.
27
- By adding the `$10` cable (`$252` gross), the customer unlocks `MEGA45_250` (`-$45`) + `WELCOME15` (`-$15`) for a net total of **$192**—saving an extra **$5** while getting an extra item!
28
-
29
31
  ## Implementation in WaSHI
30
32
 
31
33
  <CodeRunner preset="cart_coupon">
@@ -58,7 +60,7 @@ async function optimizeCheckoutCart() {
58
60
  const techSpend = expr`${baseTechSubtotal} + ${usbCablePrice} * ${addUsbCable}`;
59
61
 
60
62
  // 1. Indicator constraints: If useCoupon[id] == 1, minimum spend threshold must hold.
61
- // Omitting `M` lets WaSHI automatically derive the tightest Big-M from variable bounds!
63
+ // Omitting `M` lets WaSHI automatically derive a tight Big-M from variable bounds.
62
64
  for (const cpn of coupons) {
63
65
  if (cpn.minCart > 0) {
64
66
  m.indicator(useCoupon[cpn.id], expr`${merchSpend} >= ${cpn.minCart}`, {
@@ -97,3 +99,9 @@ optimizeCheckoutCart();
97
99
  ```
98
100
 
99
101
  </CodeRunner>
102
+
103
+ ## Key Takeaways
104
+
105
+ - **Without the add-on (`$197`)**: At `$242`, `MEGA45_250` is unavailable, so the best valid pair is `TECH30` (`-$30`) and `WELCOME15` (`-$15`), leaving `$197`.
106
+ - **With the `$10` USB-C cable (`$192`)**: Raising gross spend to `$252` unlocks `MEGA45_250` (`-$45`) alongside `WELCOME15` (`-$15`), bringing the net bill to `$192`—saving `$5` while including the cable.
107
+ - **Why `m.indicator()` fits**: Modeling `addUsbCable` and `useCoupon` in one MIP avoids enumerating cart combinations manually and lets the solver weigh add-on costs against unlocked discounts directly.
@@ -1,50 +1,54 @@
1
1
  # Examples & API Finder
2
2
 
3
- Explore runnable optimization and logic formulations built with WaSHI. Every example can be executed directly inside its documentation page, or edited in the [Playground](https://washi.ohtaman.dev/demo/).
3
+ Explore runnable optimization and logic formulations built with WaSHI. Every example runs directly on its documentation page, and most can also be edited and run in the [Playground](https://washi.ohtaman.dev/demo/).
4
4
 
5
5
  ## Examples
6
6
 
7
7
  | Example | Problem Class | Solver | Key WaSHI APIs | Description | Playground / Guide |
8
8
  | :--- | :--- | :--- | :--- | :--- | :--- |
9
- | **[Production Planning](./production.md)** | LP / MIP | HiGHS | `m.integer()`, `m.constraint()`, `expr` | Basic variables, tagged template literal equations, and maximizing profit under resource limits. | [Playground](https://washi.ohtaman.dev/demo/?preset=production) |
10
- | **[0-1 Knapsack](./knapsack.md)** | Binary MIP | HiGHS | `m.binary(keys)`, `expr` (`dot`), `m.constraint()` | 1D dictionary of `Binary` variables and linear aggregation over item arrays. | [Playground](https://washi.ohtaman.dev/demo/?preset=knapsack) |
11
- | **[Transportation Network](./transportation.md)** | LP | HiGHS | `m.continuous(rows, cols)`, `expr` (`sum`, `dot`), `m.constraint()` | 2D matrix indexing (`ship[factory][store]`) and row/column flow balance constraints. | [Playground](https://washi.ohtaman.dev/demo/?preset=transportation) |
12
- | **[Diet & Sensitivity Analysis](./diet-sensitivity.md)** | LP | HiGHS | `constr.dual`, `constr.slack`, `var.reducedCost` | Reading shadow prices (bottlenecks), constraint surpluses, and reduced costs after solving. | [Playground](https://washi.ohtaman.dev/demo/?preset=diet_sensitivity) |
13
- | **[Staff Shift Scheduling](./shift-scheduling.md)** | Binary MIP + Unsat Core | HiGHS + Z3 | `m.binary(staff, days)`, `check()`, `unsatCore` | 5×7 weekly roster planner (coverage, senior duty, max shifts, day-off requests) and diagnosing conflicting vacation requests with Z3 `unsatCore`. | [Playground](https://washi.ohtaman.dev/demo/?preset=shift_scheduling) |
14
- | **[E-Commerce Coupon Optimizer](./ecommerce-coupons.md)** | Indicator MIP | HiGHS | `m.indicator()`, `expr` (`sum`, `dot`), `m.constraint()` | Checkout optimizer using `m.indicator()` for minimum spend thresholds, exclusive vs. stackable rules, and smart filler add-on suggestions. | [Playground](https://washi.ohtaman.dev/demo/?preset=cart_coupon) |
15
- | **[Portfolio Optimization](./portfolio-qp.md)** | Convex QP | HiGHS | `m.continuous()`, `m.constraint()`, `dot()`, `QuadExpr` | Markowitz mean-variance risk minimization ($w^T \Sigma w$) using `QuadExpr` subject to return targets. | [Playground](https://washi.ohtaman.dev/demo/?preset=portfolio_qp) |
16
- | **[Project Scheduling (RCPSP)](./project-scheduling.md)** | CP / LCG + Unsat Core | Pumpkin | `m.integer()`, `disjoint()`, `cumulative()`, `max()`, `m.check()` | 6-task resource-constrained schedule (unary rig + 3-engineer crew limit) and zero-`COOP`/`COEP` `unsatCore` deadline conflict check. | [Playground](https://washi.ohtaman.dev/demo/?preset=project_scheduling) |
17
- | **[SMT Security Policies](./smt-security.md)** | SMT Logic | Z3 | `m.bool()`, `m.constraint()`, `m.check()` | Propositional variables (`BoolVar`) and logical connectives (`implies`, `and`, `not`, `xor`) mixed with integer bounds. | [Playground](https://washi.ohtaman.dev/demo/?preset=smt_security) |
18
- | **[Conflict Diagnosis (`unsatCore`)](./unsat-core.md)** | Unsat Core | Z3 | `m.constraint()`, `m.check()`, `m.unsatCore` | Extracting a conflicting constraint subset (`unsatCore`) when staffing and budget rules contradict each other. | [Playground](https://washi.ohtaman.dev/demo/?preset=conflict_diagnosis_unsat) |
19
- | **[Vehicle Routing (CVRP)](./vehicle-routing.md)** | Combinatorial OR / Dantzig-Wolfe | HiGHS | `m.solveColumnGeneration()`, `pricing` | Dynamic route column generation from customer dual shadow prices to minimize total fleet vehicles. | [Decomposition Guide](../guide/decomposition.md) |
20
- | **[Traveling Salesperson (TSP)](./traveling-salesperson.md)** | Combinatorial OR / Benders | HiGHS | `m.solveBenders()`, `subproblem` | Subtour elimination on degree-assignment relaxation using dynamic Benders feasibility cuts. | [Decomposition Guide](../guide/decomposition.md) |
9
+ | **[Production Planning](./production.md)** | Integer Programming (MIP) | HiGHS | `m.integer()`, `m.constraint()`, `expr` | Basic integer variables, tagged template equations, and profit maximization under resource caps. | [Playground](https://washi.ohtaman.dev/demo/?preset=production) |
10
+ | **[0-1 Knapsack Problem](./knapsack.md)** | Binary MIP | HiGHS | `m.binary(keys)`, `expr` (`dot`), `m.constraint()` | 1D dictionary of binary variables and weighted aggregation over item arrays. | [Playground](https://washi.ohtaman.dev/demo/?preset=knapsack) |
11
+ | **[Transportation & Allocation Network](./transportation.md)** | LP | HiGHS | `m.continuous(rows, cols)`, `expr` (`sum`, `dot`), `m.constraint()` | 2D matrix indexing (`ship[factory][store]`) and row/column supply-cap and demand-satisfaction constraints. | [Playground](https://washi.ohtaman.dev/demo/?preset=transportation) |
12
+ | **[Diet Problem & Sensitivity Analysis](./diet-sensitivity.md)** | LP | HiGHS | `constr.dual`, `constr.slack`, `var.reducedCost` | Reading dual values (shadow prices), constraint slacks, and reduced costs after solving. | [Playground](https://washi.ohtaman.dev/demo/?preset=diet_sensitivity) |
13
+ | **[Staff Shift Scheduling](./shift-scheduling.md)** | Binary MIP + Unsat Core | HiGHS + Z3* | `m.binary(staff, days)`, `m.check()`, `m.unsatCore` | 5×7 weekly roster optimization and diagnosing conflicting day-off requests with Z3 `unsatCore`. | [Playground](https://washi.ohtaman.dev/demo/?preset=shift_scheduling) |
14
+ | **[E-Commerce Cart & Coupon Optimizer](./ecommerce-coupons.md)** | Indicator MIP | HiGHS | `m.indicator()`, `expr` (`sum`, `dot`), `m.constraint()` | Checkout optimization with minimum spend rules, exclusive coupons, and optional add-on evaluation. | [Playground](https://washi.ohtaman.dev/demo/?preset=cart_coupon) |
15
+ | **[Portfolio Optimization (QP)](./portfolio-qp.md)** | Convex QP | HiGHS | `m.continuous()`, `m.constraint()`, `dot()`, `QuadExpr` | Markowitz mean-variance risk minimization ($\mathbf{w}^T \boldsymbol{\Sigma} \mathbf{w}$) with `QuadExpr`. | [Playground](https://washi.ohtaman.dev/demo/?preset=portfolio_qp) |
16
+ | **[Project Scheduling (CP)](./project-scheduling.md)** | CP + Unsat Core | Pumpkin | `m.integer()`, `disjoint()`, `cumulative()`, `max()`, `m.check()` | 6-task resource-constrained schedule with a shared rig, 3-engineer crew cap, and deadline conflict diagnosis. | [Playground](https://washi.ohtaman.dev/demo/?preset=project_scheduling) |
17
+ | **[SMT Security Policies](./smt-security.md)** | SMT | Z3* | `m.bool()`, `implies()`, `.and()`, `not()`, `m.check()` | Propositional `BoolVar` rules (`implies()`, `.and()`, `not()`) combined with integer sensor bounds. | [Playground](https://washi.ohtaman.dev/demo/?preset=smt_security) |
18
+ | **[Conflict Diagnosis (Unsat Core)](./unsat-core.md)** | SMT / MIP + Unsat Core | Z3* + HiGHS | `m.constraint()`, `m.check()`, `m.conflicts` | Extracting a conflicting constraint subset when staffing and budget rules contradict each other. | [Playground](https://washi.ohtaman.dev/demo/?preset=conflict_diagnosis_unsat) |
19
+ | **[Vehicle Routing (CVRP)](./vehicle-routing.md)** | Combinatorial OR / Dantzig-Wolfe | HiGHS | `m.solveColumnGeneration()`, `pricing`, `constr.dual` | Dynamic route generation from dual values (shadow prices) to minimize fleet size. | [Decomposition Methods](../guide/decomposition.md) |
20
+ | **[Traveling Salesperson (TSP)](./traveling-salesperson.md)** | Combinatorial OR / Benders | HiGHS | `m.solveBenders()`, `subproblem` | Subtour elimination on the degree-assignment relaxation using dynamic Benders feasibility cuts. | [Decomposition Methods](../guide/decomposition.md) |
21
+
22
+ > [!NOTE]
23
+ > **Solver Preconditions**: HiGHS and Pumpkin are bundled with WaSHI. Examples marked `Z3*` require the optional peer package `z3-solver` (and `COOP`/`COEP` headers in browsers). Examples using GLPK require `glpk.js` (GPL-3.0 license).
21
24
 
22
25
  ## Find by WaSHI API (Reverse Index)
23
26
 
24
- Looking for a specific modeling method or solver capability? Jump straight to the example that demonstrates it:
27
+ Looking for a specific modeling method or solver feature? Jump directly to the matching example or guide:
25
28
 
26
- | Feature / API | Description | Example Page | Node.js Source |
29
+ | Feature / API | Description | Example / Guide | Node.js Source |
27
30
  | :--- | :--- | :--- | :--- |
28
31
  | ``m.constraint(expr`...`)`` | Tagged template literal constraints | [Production Planning](./production.md) | [`01-production-planning.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/01-production-planning.ts) |
29
- | `m.binary(keys)` / `m.continuous(keys)` | 1D dictionary of indexed variables | [0-1 Knapsack](./knapsack.md) | [`02-knapsack-problem.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/02-knapsack-problem.ts) |
30
- | `m.continuous(rows, cols)` / `m.binary(rows, cols)` | 2D matrix of indexed variables | [Transportation Network](./transportation.md), [Shift Scheduling](./shift-scheduling.md) | [`09-transportation-problem.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/09-transportation-problem.ts) |
31
- | ``expr`dot(${A}, ${X})` `` / `dot(A, X)` | Fast vector/matrix dot product | [Transportation Network](./transportation.md), [Portfolio Optimization](./portfolio-qp.md) | [`09-transportation-problem.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/09-transportation-problem.ts) |
32
- | `constr.dual` & `constr.slack` | Shadow prices & constraint surpluses | [Diet & Sensitivity Analysis](./diet-sensitivity.md) | [`10-diet-sensitivity.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/10-diet-sensitivity.ts) |
33
- | `var.reducedCost` | Variable reduced costs in LP | [Diet & Sensitivity Analysis](./diet-sensitivity.md) | [`10-diet-sensitivity.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/10-diet-sensitivity.ts) |
34
- | `m.indicator()` | Big-M conditional constraints (`binVar => constr`) | [E-Commerce Coupon Optimizer](./ecommerce-coupons.md) | [`12-ecommerce-coupon-optimizer.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/12-ecommerce-coupon-optimizer.ts) |
35
- | `new QuadExpr()` | Convex quadratic objectives ($x^T Q x$) | [Portfolio Optimization](./portfolio-qp.md) | [`03-portfolio-qp.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/03-portfolio-qp.ts) |
32
+ | `m.binary(keys)` / `m.continuous(keys)` | 1D dictionary of indexed variables | [0-1 Knapsack Problem](./knapsack.md) | [`02-knapsack-problem.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/02-knapsack-problem.ts) |
33
+ | `m.continuous(rows, cols)` / `m.binary(rows, cols)` | 2D matrix of indexed variables | [Transportation & Allocation Network](./transportation.md), [Staff Shift Scheduling](./shift-scheduling.md) | [`09-transportation-problem.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/09-transportation-problem.ts), [`11-shift-scheduling.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/11-shift-scheduling.ts) |
34
+ | ``expr`dot(${A}, ${X})` `` / `dot(A, X)` | Vector and matrix dot product | [0-1 Knapsack Problem](./knapsack.md), [Transportation & Allocation Network](./transportation.md), [Portfolio Optimization (QP)](./portfolio-qp.md) | [`02-knapsack-problem.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/02-knapsack-problem.ts), [`09-transportation-problem.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/09-transportation-problem.ts) |
35
+ | `constr.dual` & `constr.slack` | Dual values (shadow prices) & constraint slacks | [Diet Problem & Sensitivity Analysis](./diet-sensitivity.md) | [`10-diet-sensitivity.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/10-diet-sensitivity.ts) |
36
+ | `var.reducedCost` | Variable reduced costs in LP | [Diet Problem & Sensitivity Analysis](./diet-sensitivity.md) | [`10-diet-sensitivity.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/10-diet-sensitivity.ts) |
37
+ | `m.indicator()` | Big-M conditional constraints (`binVar => constr`) | [E-Commerce Cart & Coupon Optimizer](./ecommerce-coupons.md) | [`12-ecommerce-coupon-optimizer.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/12-ecommerce-coupon-optimizer.ts) |
38
+ | `new QuadExpr()` | Quadratic objectives ($\mathbf{x}^T \mathbf{Q} \mathbf{x}$, for convex QP) | [Portfolio Optimization (QP)](./portfolio-qp.md) | [`03-portfolio-qp.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/03-portfolio-qp.ts) |
36
39
  | `m.bool()` & `implies()` | Propositional logic & SMT rules | [SMT Security Policies](./smt-security.md) | [`04-smt-security-rules.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/04-smt-security-rules.ts) |
37
- | `m.check()` & `m.unsatCore` | Feasibility check & conflict diagnosis | [Conflict Diagnosis](./unsat-core.md), [Shift Scheduling](./shift-scheduling.md) | [`05-unsat-core-diagnosis.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/05-unsat-core-diagnosis.ts) |
38
- | `m.solveColumnGeneration()` | Dantzig-Wolfe Column Generation | [Vehicle Routing](./vehicle-routing.md) | [`13-vehicle-routing-column-generation.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/13-vehicle-routing-column-generation.ts) |
39
- | `m.solveBenders()` | Benders Decomposition & cut separation | [Traveling Salesperson](./traveling-salesperson.md) | [`14-traveling-salesperson-benders.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/14-traveling-salesperson-benders.ts) |
40
- | `distinct()` / `disjoint()` / `cumulative()` / `allowed()` | Backend-agnostic CP global constraints | [Project Scheduling](./project-scheduling.md), [CP Modeling Guide](../guide/constraint-programming.md) | [`15-project-scheduling-cp.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/15-project-scheduling-cp.ts) |
41
- | `max()` / `min()` / `abs()` / `at()` | Piecewise-linear & element lookup primitives | [Project Scheduling](./project-scheduling.md), [Expressions Guide](../guide/expressions.md) | [`15-project-scheduling-cp.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/15-project-scheduling-cp.ts) |
42
- | `solver: "pumpkin"` | Bundled CP/LCG scheduling & zero-`COOP`/`COEP` `unsatCore` | [Project Scheduling](./project-scheduling.md), [Pumpkin Solver Guide](../solvers/pumpkin.md) | [`15-project-scheduling-cp.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/15-project-scheduling-cp.ts) |
43
- | `solver: "glpk"` | Solving LP/MIP with GLPK plugin | [GLPK Solver Guide](../solvers/glpk.md) | [`08-glpk-solver-plugin.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/08-glpk-solver-plugin.ts) |
40
+ | `m.check()` & `m.conflicts` | Feasibility check & conflict diagnosis (`conflicts` / `unsatCore`) | [Conflict Diagnosis (Unsat Core)](./unsat-core.md), [Staff Shift Scheduling](./shift-scheduling.md) | [`05-unsat-core-diagnosis.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/05-unsat-core-diagnosis.ts), [`11-shift-scheduling.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/11-shift-scheduling.ts) |
41
+ | Hybrid Z3 SMT + HiGHS MIP | Policy check with Z3 before MIP capacity allocation | [Z3 Solver Guide](../solvers/z3.md) | [`07-hybrid-smt-mip.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/07-hybrid-smt-mip.ts) |
42
+ | `m.solveColumnGeneration()` | Dantzig-Wolfe Column Generation | [Vehicle Routing (CVRP)](./vehicle-routing.md) | [`13-vehicle-routing-column-generation.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/13-vehicle-routing-column-generation.ts) |
43
+ | `m.solveBenders()` | Benders Decomposition & lazy cuts | [Traveling Salesperson (TSP)](./traveling-salesperson.md) | [`14-traveling-salesperson-benders.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/14-traveling-salesperson-benders.ts) |
44
+ | `disjoint()` / `cumulative()` / `max()` | Scheduling global constraints & makespan objective | [Project Scheduling (CP)](./project-scheduling.md), [Constraint Programming (CP) Modeling](../guide/constraint-programming.md) | [`15-project-scheduling-cp.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/15-project-scheduling-cp.ts) |
45
+ | `distinct()` / `allowed()` / `at()` | CP value-domain, table, and element constraints | [Constraint Programming (CP) Modeling](../guide/constraint-programming.md), [Expressions](../guide/expressions.md) | — |
46
+ | `solver: "pumpkin"` | Bundled CP scheduling & discrete `unsatCore` | [Project Scheduling (CP)](./project-scheduling.md), [Pumpkin Guide](../solvers/pumpkin.md) | [`15-project-scheduling-cp.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/15-project-scheduling-cp.ts) |
47
+ | `solver: "glpk"` | LP/MIP via optional `glpk.js` plugin (GPL-3.0) | [GLPK Guide](../solvers/glpk.md) | [`08-glpk-solver-plugin.ts`](https://github.com/ohtaman/washi/blob/main/examples/node/08-glpk-solver-plugin.ts) |
44
48
 
45
49
  ## Running Examples Locally in Node.js
46
50
 
47
- All standalone scripts are located in [`examples/node/`](https://github.com/ohtaman/washi/tree/main/examples/node):
51
+ All standalone scripts are located in [`examples/node/`](https://github.com/ohtaman/washi/tree/main/examples/node) (examples using Z3 or GLPK require the optional `z3-solver` or `glpk.js` package):
48
52
 
49
53
  ```bash
50
54
  npx tsx examples/node/01-production-planning.ts
@@ -4,16 +4,16 @@
4
4
  | :--- | :--- | :--- | :--- |
5
5
  | 0-1 Binary MIP | HiGHS (default) | `m.binary()`, `m.constraint()`, `expr` (`dot`), `maximize` | <ul><li><a href="https://washi.ohtaman.dev/demo/?preset=knapsack">Open in Playground</a></li><li><a href="https://github.com/ohtaman/washi/blob/main/examples/node/02-knapsack-problem.ts">Source Code</a></li></ul> |
6
6
 
7
- The 0-1 Knapsack problem is an essential combinatorial optimization problem: given a set of items, each with a weight and a value, determine which items to include in a collection so that the total weight does not exceed a given limit and the total value is maximized.
7
+ The 0-1 Knapsack problem is a fundamental combinatorial optimization problem. Given items with weights and values, choose a subset that maximizes total value without exceeding the backpack's weight limit.
8
8
 
9
9
  ## Mathematical Formulation
10
10
 
11
- Let $x_i \in \{0, 1\}$ be binary decision variables indicating whether item $i$ is selected ($x_i = 1$) or not ($x_i = 0$):
11
+ Let $v_i$ and $w_i$ be the value and weight of item $i$, $W$ be the weight capacity, and $x_i \in \{0, 1\}$ be a binary decision variable where $x_i = 1$ selects the item and $x_i = 0$ leaves it out:
12
12
 
13
13
  $$\begin{aligned}
14
14
  \text{Maximize} \quad & \sum_{i} v_i x_i & (\text{Total Value}) \\
15
15
  \text{Subject to} \quad & \sum_{i} w_i x_i \le W & (\text{Weight Capacity}) \\
16
- & x_i \in \{0, 1\} & (\text{Binary Decisions})
16
+ & x_i \in \{0, 1\} \quad \forall i & (\text{Binary Decisions})
17
17
  \end{aligned}$$
18
18
 
19
19
  ## Implementation in WaSHI
@@ -26,6 +26,7 @@ import { Model, maximize, expr } from "@ohtaman/washi";
26
26
  async function solveKnapsack() {
27
27
  const m = new Model("Knapsack");
28
28
 
29
+ // weight in kg, value in $
29
30
  const items = [
30
31
  { name: "Laptop", weight: 3, value: 50 },
31
32
  { name: "Camera", weight: 2, value: 40 },
@@ -41,10 +42,10 @@ async function solveKnapsack() {
41
42
  const values = Object.fromEntries(items.map((it) => [it.name, it.value]));
42
43
  const weights = Object.fromEntries(items.map((it) => [it.name, it.weight]));
43
44
 
44
- // Maximize total value via dot() inside expr
45
+ // Objective: Maximize total value
45
46
  m.objective(maximize(expr`dot(${values}, ${x})`));
46
47
 
47
- // Weight capacity constraint using expr and constraint()
48
+ // Weight capacity constraint
48
49
  m.constraint(expr`dot(${weights}, ${x}) <= ${maxCapacity}`, "capacity_limit");
49
50
 
50
51
  const status = await m.solve();
@@ -59,3 +60,8 @@ solveKnapsack();
59
60
  ```
60
61
 
61
62
  </CodeRunner>
63
+
64
+ ## Key Takeaways
65
+
66
+ - **Optimal Result**: Packing `Camera` (`2 kg`, `$40`), `Drone` (`4 kg`, `$65`), and `FirstAid` (`1 kg`, `$15`) reaches the exact `7 kg` capacity with a maximum value of `$120`.
67
+ - **Concise Modeling with `m.binary(names)` and `dot()`**: Passing item names to `m.binary()` creates a keyed dictionary of 0-1 variables in one call. Pairing that dictionary with `dot()` inside `expr` computes weighted sums directly without manual loops.
@@ -4,22 +4,24 @@
4
4
  | :--- | :--- | :--- | :--- |
5
5
  | Convex Quadratic Programming (QP) | HiGHS (default) | `m.continuous()`, `m.constraint()`, `expr`, `minimize`, `dot`, `QuadExpr` | <ul><li><a href="https://washi.ohtaman.dev/demo/?preset=portfolio_qp">Open in Playground</a></li><li><a href="https://github.com/ohtaman/washi/blob/main/examples/node/03-portfolio-qp.ts">Source Code</a></li></ul> |
6
6
 
7
- The Markowitz mean-variance portfolio optimization problem is the foundation of modern quantitative finance: allocate capital across risky assets to minimize overall portfolio variance (risk) subject to achieving a minimum required expected return.
7
+ The Markowitz mean-variance model is a classic problem in quantitative finance. It allocates capital across risky assets to minimize portfolio variance (risk) while meeting a minimum target return.
8
8
 
9
9
  <PortfolioQpDemo />
10
10
 
11
+ The interactive demo above uses a preset with a `60%` per-asset weight cap, while the formulation and code below solve the uncapped long-only model ($0 \le w_i \le 1$).
12
+
11
13
  ## Mathematical Formulation
12
14
 
13
- Let $w_i \ge 0$ denote the allocation weight for asset $i$:
15
+ Let $n$ be the number of assets, $w_i$ be the allocation weight for asset $i$ (written as vector $\mathbf{w}$), $r_i$ be its expected return, and $R_{\text{target}}$ be the minimum target return:
14
16
 
15
17
  $$\begin{aligned}
16
18
  \text{Minimize} \quad & \mathbf{w}^T \boldsymbol{\Sigma} \mathbf{w} & (\text{Portfolio Variance}) \\
17
19
  \text{Subject to} \quad & \sum_{i=1}^n w_i = 1 & (\text{Full Capital Budget}) \\
18
20
  & \sum_{i=1}^n r_i w_i \ge R_{\text{target}} & (\text{Minimum Target Return}) \\
19
- & 0 \le w_i \le 1 & (\text{Long-Only Weights})
21
+ & 0 \le w_i \le 1 \quad \forall i = 1, \dots, n & (\text{Long-Only Weights})
20
22
  \end{aligned}$$
21
23
 
22
- where $\boldsymbol{\Sigma}$ is the positive semi-definite asset return covariance matrix.
24
+ where $\boldsymbol{\Sigma}$ is the symmetric positive semi-definite asset return covariance matrix, making the objective a convex quadratic function.
23
25
 
24
26
  ## Implementation in WaSHI
25
27
 
@@ -55,7 +57,7 @@ async function solvePortfolio() {
55
57
  const portfolioReturn = dot(retMap, w);
56
58
  m.constraint(expr`${portfolioReturn} >= ${targetReturn}`, "target_return");
57
59
 
58
- // 3. Quadratic Objective: minimize risk w^T * Sigma * w
60
+ // 3. Quadratic Objective: minimize portfolio variance w^T * Sigma * w
59
61
  let risk = new QuadExpr();
60
62
  for (let i = 0; i < assets.length; i++) {
61
63
  for (let j = 0; j < assets.length; j++) {
@@ -66,7 +68,7 @@ async function solvePortfolio() {
66
68
  }
67
69
  m.objective(minimize(risk));
68
70
 
69
- // Solve natively with HiGHS Convex QP engine
71
+ // Solve with HiGHS QP solver
70
72
  const status = await m.solve();
71
73
 
72
74
  console.log(`Status: ${status}`);
@@ -86,5 +88,16 @@ solvePortfolio();
86
88
 
87
89
  ## Practical Notes
88
90
 
89
- - **Tracing the Efficient Frontier (`targetReturn` & `portfolioReturn.value`)**: Because the achieved return (`8.50%`) matches `targetReturn` exactly, the return constraint is tightly binding on the Markowitz efficient frontier. Varying `targetReturn` across `[0.05, 0.12]` traces out the full risk-return frontier.
90
- - **Risk-Aversion Scalarization vs. Target Return Constraint**: If `targetReturn` is set above the highest single-asset return ($12\%$ for `Tech` under long-only weights), the hard constraint $\mathbf{r}^T \mathbf{w} \ge R_{\text{target}}$ becomes `"Infeasible"`. An alternative formulation that is always feasible for any risk appetite $\lambda > 0$ is to minimize the risk-adjusted objective $\min (\lambda \, \mathbf{w}^T \boldsymbol{\Sigma} \mathbf{w} - \mathbf{r}^T \mathbf{w})$.
91
+ At `8.50%` target return, optimal variance is `0.014229` (`11.93%` volatility): `52.68%` `Tech` and `30.57%` `Bonds` balance return and risk, while `GlobalEq` drops to `0.00%` due to high covariance with `Tech`.
92
+
93
+ ### Tracing the Efficient Frontier
94
+
95
+ The solved `portfolioReturn.value` matches `targetReturn` (`8.50%`) exactly, showing that the target return constraint is binding and the solution lies on the Markowitz efficient frontier for `8.50%`. Sweeping `targetReturn` from the minimum-variance portfolio's expected return (about `4.52%`) up to the maximum single-asset return (`12%`) traces the entire efficient frontier.
96
+
97
+ ### Target Return Constraint vs. Risk-Aversion Scalarization
98
+
99
+ Under long-only weights ($0 \le w_i \le 1$), setting `targetReturn` above the highest single-asset return (`12%` for `Tech`) makes the hard return constraint `"Infeasible"`.
100
+
101
+ To drop the hard target-return constraint and keep the model feasible for any risk-aversion coefficient $\lambda > 0$, minimize the risk-adjusted objective using the expected return vector $\mathbf{r}$:
102
+
103
+ $$\min_{\mathbf{w}} \; \lambda \, \mathbf{w}^T \boldsymbol{\Sigma} \mathbf{w} - \mathbf{r}^T \mathbf{w}$$
@@ -1,14 +1,14 @@
1
- # Production Planning (LP / MIP)
1
+ # Production Planning (Integer Programming / MIP)
2
2
 
3
3
  | Problem Class | Solver | Key APIs | Links |
4
4
  | :--- | :--- | :--- | :--- |
5
- | Linear / Integer Programming (LP / MIP) | HiGHS (default) | `m.integer()`, `m.constraint()`, `expr` | <ul><li><a href="https://washi.ohtaman.dev/demo/?preset=production">Open in Playground</a></li><li><a href="https://github.com/ohtaman/washi/blob/main/examples/node/01-production-planning.ts">Source Code</a></li></ul> |
5
+ | Integer Programming (MIP) | HiGHS (default) | `m.integer()`, `m.constraint()`, `expr`, `maximize` | <ul><li><a href="https://washi.ohtaman.dev/demo/?preset=production">Open in Playground</a></li><li><a href="https://github.com/ohtaman/washi/blob/main/examples/node/01-production-planning.ts">Source Code</a></li></ul> |
6
6
 
7
- Production planning is a classic Linear Programming problem: determine the optimal quantity of each product to manufacture in order to maximize total profit while respecting resource constraints (raw materials, machine time, labor hours).
7
+ Production planning is a classic optimization problem. You choose how many units of each product to make to maximize profit without exceeding resource limits such as raw materials or labor hours.
8
8
 
9
9
  ## Mathematical Formulation
10
10
 
11
- Let $x$ be the number of chairs and $y$ be the number of tables.
11
+ Let $x$ be the number of chairs (profit `$45` each) and $y$ be the number of tables (profit `$80` each).
12
12
 
13
13
  $$\begin{aligned}
14
14
  \text{Maximize} \quad & 45x + 80y & (\text{Profit}) \\
@@ -34,7 +34,7 @@ async function runProductionOptimization() {
34
34
  // Objective: Maximize total profit ($45 per chair, $80 per table)
35
35
  m.objective(maximize(expr`45 * ${chairs} + 80 * ${tables}`));
36
36
 
37
- // Resource constraints: declarative formulas via expr and constraint()
37
+ // Resource constraints: mahogany wood and carpentry labor limits
38
38
  m.constraint(expr`5 * ${chairs} + 20 * ${tables} <= 400`, "mahogany_limit");
39
39
  m.constraint(expr`10 * ${chairs} + 15 * ${tables} <= 450`, "labor_limit");
40
40
 
@@ -49,3 +49,8 @@ runProductionOptimization();
49
49
  ```
50
50
 
51
51
  </CodeRunner>
52
+
53
+ ## Key Takeaways
54
+
55
+ - **Optimal Result**: Producing `chairs = 24` and `tables = 14` yields the maximum profit of `$2,200`. Both resources are fully used: mahogany wood is $5(24) + 20(14) = 400$ and carpentry labor is $10(24) + 15(14) = 450$.
56
+ - **Why `m.integer()` instead of `m.continuous()`**: Chairs and tables are discrete items that cannot be shipped in fractions. Although this instance happens to have an integer LP optimum, `m.integer()` guarantees whole-number outputs even when limits or prices change.