Production Planning (LP / MIP)
| Problem Class | Solver | Key APIs | Links |
|---|---|---|---|
| Linear / Integer Programming (LP / MIP) | HiGHS (default) | m.integer(), m.constraint(), c, expr |
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).
Mathematical Formulation
Let be the number of chairs and be the number of tables.
Implementation in WaSHI
typescript
import { Model, expr, c, maximize } from "@ohtaman/washi";
async function runProductionOptimization() {
const m = new Model("FactoryProduction");
// Decision variables: non-negative integer quantities
const chairs = m.integer("chairs", { lb: 0 });
const tables = m.integer("tables", { lb: 0 });
// Objective: Maximize total profit ($45 per chair, $80 per table)
m.objective(maximize(expr`45 * ${chairs} + 80 * ${tables}`));
// Resource constraints: declarative formulas via c and fluent constraint()
m.constraint(c`5 * ${chairs} + 20 * ${tables} <= 400`, "mahogany_limit")
.constraint(c`10 * ${chairs} + 15 * ${tables} <= 450`, "labor_limit");
const status = await m.solve();
console.log(`Status: ${status}`);
console.log(`Optimal Profit: $${m.objectiveValue}`);
console.log(`Chairs: ${chairs.value}, Tables: ${tables.value}`);
}
runProductionOptimization();