optlens finds why an LP or MILP model is infeasible, the smallest change that fixes it, and what a change costs. Then it says so in words a planner understands. Use it from Python, any MCP client, or Claude Code, on HiGHS, SCIP or your own Gurobi.
pip
pip install "optlens[scip,mcp]"
Claude Code
claude plugin marketplace add jjd-lab/optlens
claude plugin install optlens@optlens
Codex (others: one line)
codex mcp add optlens -- optlens-mcp
Infeasible, wrong and working LP and MILP models of up to 837,000 constraints, each case with a solver-verified answer key.
We compare Claude with optlens against the same agent given only a solver, both in our own minimal agent loop with the same model context. We also measured the plugin in Claude Code itself.
optlens solves the model for every answer, and it re-solves every fix before it offers it.
The conflicting constraints (an IIS), grouped by family, even on models with hundreds of thousands of constraints.
The smallest change per family that restores feasibility, with the best plan it allows. Also the inputs that break their own pattern, each with its undo already solved.
Edits as versions, why-not questions, marginal values and sensitivity, without touching your model code.
Changes against the closest optimal plan, so an edit shows what it forces, not the solver's choice among ties.
Open several models or scenarios side by side and compare status, objective and every family's metrics, or ask a what-if on one of them.
A model context, generated once from your document or code. It gives each family's business meaning, checked against the model, as JSON your team reviews and reuses.
Step-by-step answers to common questions about infeasible models, with code you can run and the output it prints.
Find the constraints that clash (an IIS) with HiGHS or Gurobi, read them as a business conflict, and get the smallest fix. Start here.
Why log_infeasible_constraints shows nothing after an infeasible solve, and how to get the IIS of a Pyomo model on HiGHS.
The IIS says which rules clash; the solver's proof says why, as a sum anyone can check. On a 2,691-row hotel week.
A clean Claude Code with the optlens plugin works on the hotel pack's week. A data load typed one night's group target as 1,200 instead of 120. The agent finds the cause, re-solves to check the fix, then prices each business rule. The animation comes from a recorded session, and each tool call shows its real duration.
Try the same week yourself, in a setup of its own:
git clone https://github.com/jjd-lab/optlens && optlens/scripts/sandbox.sh ~/optlens-try
optchat is a chat agent built on optlens. Planners, analysts and managers, the people who act on a model's plan, use it to work with the model in plain language. It keeps every change as a version and compares scenarios side by side. It carries a change across linked models, such as a new rate plan into the booking plan. It applies nothing until the planner approves, and it records each decision. In the recording, a planner finds a data-entry error, approves the fix and asks what the rules cost. In the recording, waits longer than two seconds are cut to two. optchat is available on request: hello@optlens.dev.
Load the file, the model object, or the script that builds it.
One MCP server, connected with one line, gives the agent the tools and the method. It runs locally, on your machine.