Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PyNumero Reduced Hessian example #1867

Open
blnicho opened this issue Mar 12, 2021 · 1 comment
Open

Add PyNumero Reduced Hessian example #1867

blnicho opened this issue Mar 12, 2021 · 1 comment
Labels

Comments

@blnicho
Copy link
Member

blnicho commented Mar 12, 2021

Documenting #1282 as an issue instead of a PR.

Motivation:

Implement a basic example that demonstrates how to compute the reduced hessian of a nonlinear equality constrained problem with pynumero. Extensions to general nonlinear optimization problems with bounds can be implemented in pynumero following a very similar approach where the KKT matrix is the augmented system of the barrier subproblem at the optimal point. @carldlaird @blnicho @michaelbynum please refer to A.35 in Here for the computation of the KKT matrix.

The calculation of the reduced hessian can be beneficial for different applications of pyomo models. These include advanced step NMPC (e.g. pyomo.dae @blnicho ) and estimation of covariance matrices in parameter estimation problems (e.g. Parmest @kaklise, KIPET @salvadorgarciamunoz). Note that now that pynumero is supported on windows the implementation of the reduced hessian can be done in pynumero without the need of compiling any additional packages

@carldlaird for PyNumero itself, efficient calculation of the reduced hessian can be very useful for designing new algorithms. An interesting example is presented in here. There information from the reduced hessian is used within the inertia correction.

@adowling2
Copy link
Member

@michaelbynum @carldlaird @blnicho

For my class, I tried replicating Example 4.20 in Biegler (2010). Here is a notebook with the example:
https://ndcbe.github.io/CBE60499/04.05-Second-Order.html

This is a two-variable optimization problem with a single inequality constraint. The calculated reduced Hessian has dimensions 2x2. We expect a 1x1 reduced Hessian because the constraint removes a degree of freedom.

Changing the constraint from an inequality (which is strongly active) to an equality constraint does not change the KKT multiplier (as expected) but does change the inverse reduced Hessian!

With an inequality constraint, the calculated reduced Hessian is:

[[ 0.50075352 -0.15638396]
 [-0.15638396  0.36113557]]

With an equality constraint, the calculated reduced Hessian is:

[[ 0.21115307 -0.26122822]
 [-0.26122822  0.32317873]]

Summary of problems:

  • Wrong dimensions for the (inverse) reduced Hessian.
  • (Inverse) reduced Hessian changes when switching a strongly active constraint from inequality to equality.
  • Calculate does not match textbook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants