Pyomo 敏感性分析
Pyomo sensitivity analysis
是否有一种合理直接的方法(只需很少的代码行)来请求对 Pyomo 中的 AbstractModel
进行敏感性分析,而不考虑求解器和问题?如果是这样,是否可以通过 Pyomo 或 Python 对象访问此敏感性分析的结果?
我怀疑它可能与 opt.solve(model)
代码行有关(其中 opt
是一个 SolverFactory
实例,而 model
是先前定义的 AbstractModel
).
Pyomo 目前不包含用于敏感性分析的工具,尽管我们正处于开发敏感性分析扩展的初步阶段。此扩展至少需要一年时间才能包含在版本中。有几个备选方案需要考虑,这些备选方案需要一些编码工作才能实现您的目标。首先,您可以使用 gjh
"solver" 从您的模型中获取导数。请参阅讨论 here and here. You can also use SIPOPT to get some sensitivity information following the example here. Finally, symbolic differentiation has been prototyped in Pyomo using Sympy. This feature is currently undocumented and subject to change but you can see examples of how to use it here。
所有这些的一个警告是它们不适用于 AbstractModel
,它们必须应用于 ConcreteModel
。这是因为没有构造抽象模型,并且不包含任何可以从中提取导数的表达式。
是否有一种合理直接的方法(只需很少的代码行)来请求对 Pyomo 中的 AbstractModel
进行敏感性分析,而不考虑求解器和问题?如果是这样,是否可以通过 Pyomo 或 Python 对象访问此敏感性分析的结果?
我怀疑它可能与 opt.solve(model)
代码行有关(其中 opt
是一个 SolverFactory
实例,而 model
是先前定义的 AbstractModel
).
Pyomo 目前不包含用于敏感性分析的工具,尽管我们正处于开发敏感性分析扩展的初步阶段。此扩展至少需要一年时间才能包含在版本中。有几个备选方案需要考虑,这些备选方案需要一些编码工作才能实现您的目标。首先,您可以使用 gjh
"solver" 从您的模型中获取导数。请参阅讨论 here and here. You can also use SIPOPT to get some sensitivity information following the example here. Finally, symbolic differentiation has been prototyped in Pyomo using Sympy. This feature is currently undocumented and subject to change but you can see examples of how to use it here。
所有这些的一个警告是它们不适用于 AbstractModel
,它们必须应用于 ConcreteModel
。这是因为没有构造抽象模型,并且不包含任何可以从中提取导数的表达式。