I really enjoy using Pyomo, but could use some help!
When trying to analyze a nonlinear ConcreteModel solved using Pyomo with IPOPT, I am having difficulties determining an approximation of the gradient, i.e. trying to answer the question:
- At the optimum (x*), when each variable x_i is perturbed, e.g. to x*_i+1 or x*_i+0.001, what is the change in the objective function value?
I may just be skipping over something, but feel like I'm going around in circles... I've tried:
- using the "gjh" solver, however the results do not seem to correspond well to results of manually perturbing the solution.
- looking at the dual, ipopt_zL_out, ipopt_zU_out Suffixes.
- using the "derivative_test" option with IPOPT (but the "grad_f" output doesn't seem to be placed back into the model instance when specifying "grad_f" as an IMPORT Suffix)
---- (a related question: even if I can load the grad_f values into the model instance, how does one relate the numbered indexes, e.g. grad_f[ 121], to variables indexed by named sets, which might be unordered? For this instance, each variable looks like x[('ConserveTill', 'N51133RL0_6450_0000', 'hfr')], so I don't know which variable [ 121] is referring to. )
Here are the problem details as output by IPOPT:
Number of nonzeros in equality constraint Jacobian...: 0
Number of nonzeros in inequality constraint Jacobian.: 2628
Number of nonzeros in Lagrangian Hessian.............: 5278
Total number of variables............................: 1339
variables with only lower bounds: 1339
variables with lower and upper bounds: 0
variables with only upper bounds: 0
Total number of equality constraints.................: 0
Total number of inequality constraints...............: 1108
inequality constraints with only lower bounds: 0
inequality constraints with lower and upper bounds: 0
inequality constraints with only upper bounds: 1108
I am relatively new to using nonlinear solvers, so please pardon any unintentional misstatements and the additional questions embedded within this one post. Thanks for any thoughts you are willing to share!