Talk to a solver
A min-cost network flow model — plants, regions, shipping lanes — that you can change by describing what happened. The agent translates your sentence into an edit on a validated model spec, CVXPY re-solves it, and the result comes back with the shadow prices that say what to do next.
Why this shape: the language model never computes an answer. It only proposes edits to a schema-validated spec, which a separate Python service solves to optimality. That keeps the optimization reproducible and auditable while still letting a planner work in plain English — the useful half of the agentic pattern without handing arithmetic to a model.
A cheap plant that cannot cover demand alone, and a pricier one that has to make up the gap. The classic setup where capacity is worth more than it looks.
Plants — capacity 1,400
| Plant | Capacity | Unit cost |
|---|---|---|
| Ohio | 800 | $10 |
| Texas | 600 | $14 |
Regions — demand 1,150
| Region | Demand |
|---|---|
| Northeast | 500 |
| Southeast | 400 |
| West | 250 |
Change the scenario in plain English
The model rewrites the optimization spec, CVXPY re-solves it, and the result gets explained. The numbers always come from the solver.
How it is built
- Model:linear program over plant→region flows, minimizing production plus shipping cost subject to capacity, demand, and per-lane limits. Demand shortfall is allowed at a penalty so the model degrades gracefully instead of returning “infeasible”.
- Solver: CVXPY with HiGHS, running as its own Cloud Run service. Duals are returned alongside the primal solution and rendered as shadow prices.
- Agent: Claude translates the request into a complete revised spec under a Zod schema, so a malformed or out-of-scope edit is rejected before it reaches the solver.
- App: Next.js on Cloud Run; the browser never sees the solver URL or the API key.