AI 中文总结
研究针对优化模型最优性后分析信息分散问题,提出pyoptexplain库,适配多种建模前端模型,经统一接口回答相关问题。基于避免不可靠报告及分摊重复场景分析成本的设计,经计算研究证实有效。
AI 中文摘要
优化模型通过多种建模语言构建并由多种求解器求解,然而理解解所需信息分散。本文提出pyoptexplain库,它可适配五种建模前端编写的模型至归一化内部表示,通过选择后端求解,并经统一接口回答优化决策的‘为什么’和‘如果……会怎样’问题。其设计基于两点:一是仅在表示和后端都能证明时才报告数量,不近似不可用信息;二是重复场景分析可通过提取一次模型并跨一批场景重用热求解器会话来分摊成本。可复现的计算研究证实了这两点。
英文摘要
Optimization models are built in a variety of modeling languages and solved by a variety of solvers, but once a solution exists, the information needed to understand it is fragmented: each solver exposes a partial, differently named set of native diagnostics, and the modeling language has already canonicalized the formulation the user wrote. We present pyoptexplain, a practitioner-first Python library for post-optimality analysis of optimization models that sits above this layer. It adapts a model authored in any of five modeling front ends, namely cvxpy, Pyomo, gurobipy, docplex, and OR-Tools, into a normalized internal representation, solves it through a choice of backends, and answers the why and what-if questions of an optimization decision through one uniform interface. The design rests on two observations. First, a post-optimality quantity requested from different backends for the same problem can come back as an exception, a structurally meaningless zero or a basis-dependent value that disagrees across solvers, so reporting whatever one solver returns is unreliable. pyoptexplain reports a quantity only when both the representation and the chosen backend can justify it, and does not approximate unavailable information. Second, repeated scenario analysis can amortize its cost by extracting the model once and reusing a warm solver session across a batch of scenarios. pyoptexplain builds a single scalable what-if interface, uniform across its modeling languages and backends and returning a certified report for every scenario, at a cost within a small constant factor of the bare solver. A reproducible computational study substantiates both claims. Source code is available at https://github.com/h-fellahi/pyoptexplain and installation can be done through the Python Package Index https://pypi.org/project/pyoptexplain/.