What you can ask
Each question below maps to a tool. In Python the tool is a Session method. The MCP server (optlens-mcp, 24
tools) and the Claude Code plugin have the same tools. Ask in your own words, and the agent picks the tools.
Questions and tools
| you want to know | for example | tools |
|---|---|---|
| what the model is and means | "What does this model decide, and what limits it?" | get_model_overview, query_constraints, query_variables, read_model_document, save_model_context |
| why it is infeasible | "Why is plan.mps infeasible? Prove it." |
compute_iis, infeasibility_proof (on request: the checked sum), feasibility_relaxation, drop_test |
| what fixes it | "What is the smallest change that makes it solve? Is an input mistyped?" | fix_menu, suspicious_values (each flag's undo solved) |
| what happens if... | "What if the budget drops by 10 %?" | modify_and_resolve, try_options, version_history |
| how two plans differ | "What changed between the old plan and this one?" | compare_versions (against the closest optimal plan) |
| what a limit is worth, how far it can go | "What is one more hour of capacity worth? How high can demand go?" | marginal_value, sensitivity_report, attainable_limit |
| whether a better plan exists | "Could any plan do better? Prove this one is the best." | optimality_proof (on request: the checked bound and what holds the plan there) |
| why the plan doesn't do X | "Why doesn't the plan use the second warehouse?" | why_not |
| how several models or scenarios compare | "Which of these three scenarios costs least?" | open_model, add_model, compare_models |
| anything else, in code | "Rank every capacity limit by what relaxing it would save." | run_python (optlens preloaded as session) |
Models
- Formats. LP and MPS files; Pyomo, gurobipy and PuLP models, from the object or from the script that builds it.
- Linear and mixed-integer models (LP, MILP). Every question above works.
- Quadratic objectives (QP, MIQP). A convex QP solves on HiGHS. optlens sends a mixed-integer or non-convex one
to SCIP automatically.
Infeasibility, smallest fixes, what-ifs, plan comparisons and marginal values work as for a linear model, because
feasibility does not depend on the objective.
marginal_valuematters more here. A quadratic cost changes at a different rate in each direction, somarginal_valuere-solves both ways. optlens reports shadow prices for a convex objective, but not sensitivity ranges. - Not supported. Quadratic constraints, indicator and other general constraints, and SOS. optlens rejects such a model when it loads and says why.
Solvers
| solver | solves | notes |
|---|---|---|
| HiGHS | LP, MILP, convex QP | comes with optlens; the default; IIS for LPs |
| SCIP | LP, MILP, QP and MIQP, convex or not | the scip extra; IIS for MIPs; runs the steps HiGHS cannot do, and the result says so |
| Gurobi | LP, MILP, QP and MIQP, convex or not | your own license; tested on small models and on one large one (a 279k-row hotel model); IIS for LPs and MIPs |
Solvers in the README explains how optlens picks a solver. It also covers why a Gurobi session stays on Gurobi, the hard time limits and how optlens checks an IIS.
Limits
- optlens works on a model that is already built; it does not write models.
- Sensitivity ranges hold only for the solution's basis. At a degenerate solution, the shadow price can differ on
each side of a limit.
marginal_valuere-solves to check a change.