Skip to content

WaSHIAlgebraic Modeler for Mathematical Optimization & Constraint Programming

A TypeScript alternative to Python's PuLP and Julia's JuMP. Formulate LP, MIP, Convex QP, and SMT models with intuitive infix expressions and solve client-side via WebAssembly (HiGHS, Z3, GLPK) with zero Python or native C++ dependencies.

WaSHI Emblem

Quick Example ​

typescript
import { Model, expr, maximize } from "@ohtaman/washi";

// 1. Create a model
const m = new Model("WoodworkingProfit");

// 2. Define decision variables
const desks = m.integer("desks", { lb: 0 });
const chairs = m.integer("chairs", { lb: 0 });

// 3. Set objective function ($30/desk, $50/chair)
m.objective(maximize(expr`30 * ${desks} + 50 * ${chairs}`));

// 4. Add constraints (material and labor limits)
m.constraint(expr`${desks} + 2 * ${chairs} <= 40`, "wood_limit");
m.constraint(expr`2 * ${desks} + ${chairs} <= 50`, "labor_limit");

// 5. Solve via WebAssembly (HiGHS)
await m.solve();

console.log(`Produce: ${desks.value} desks, ${chairs.value} chairs`);
console.log(`Maximum Profit: $${m.objectiveValue}`);

Explore Documentation ​

Released under the MIT License.