What you can ask
Every question below is a tool: a Session method in Python, a tool of the MCP server (optlens-mcp, 22 tools) and
the same in the Claude Code plugin. Ask in your own words; the agent picks the tools. Every answer comes from a solve,
and every recommended fix is re-solved before it is offered.
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?" |
compute_iis, 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 |
| 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.
- Quadratic objectives (QP, MIQP): a convex QP solves on HiGHS; a mixed-integer or non-convex one goes to SCIP,
chosen automatically.
Why a model is infeasible, its smallest fixes, what-ifs, plan comparisons and marginal values work as for a linear
model; feasibility does not depend on the objective.
marginal_valuematters more here, since a quadratic cost changes at a different rate each way: it re-solves both ways. Shadow prices are reported for a convex objective; sensitivity ranges are not. - Not supported: quadratic constraints, indicator and other general constraints, and SOS. Such a model is rejected when it loads, with the reason.
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; stands in for HiGHS where HiGHS cannot do a step, and the result says so |
| Gurobi | LP, MILP, QP and MIQP, convex or not | your own license; IIS for LPs and MIPs; a Gurobi session does every step on Gurobi |
Every solve has a hard time limit, and every IIS is checked: one whose constraints are feasible on their own is rejected and rebuilt.
Limits
- optlens works on a model that is already built; it does not write models.
- Gurobi is tested on its size-limited license only (2,000 constraints and 2,000 variables, 200 variables with a quadratic objective).
- Sensitivity ranges hold for the solution's basis; at a degenerate solution the shadow price can differ on each side
of a limit, and
marginal_valuere-solves to check a change.