Reputation: 1068
Is there a reasonnably straightforward way (in very few lines of code) to request a sensitivity analysis of an AbstractModel
in Pyomo, regardless of the solver and the problem? If so, will the results of this sensitivity analysis be accessible through Pyomo or Python objects?
I suspect it might have something to do with the opt.solve(model)
code line (where opt
is aSolverFactory
instance and model
is a previously defined AbstractModel
).
Upvotes: 1
Views: 1719
Reputation: 2828
Pyomo does not currently include tools for sensitivity analysis although we are in the preliminary stages of developing a sensitivity analysis extension. This extension is at least a year away from being included in a release. There are a few alternatives to consider which will require some coding effort to achieve your goal. First, you could use the gjh
"solver" to get derivatives back from your model. See the discussion 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.
One caveat with all of these is that they will not work on an AbstractModel
, they must be applied to a ConcreteModel
. This is because abstract models are not constructed and don't include any expressions from which derivatives can be extracted.
Upvotes: 2