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

mismatched grad_f and h implementation in the feasibility restoration problem #478

Closed
nychiang opened this issue May 26, 2021 · 2 comments
Closed

Comments

@nychiang
Copy link

I believe the current code computes the objective to the feasibility restoration problem as
f = \sum(p+n) + eta/2*two_norm(DR*(x-x_ref))^2
(see equation (30a) in the implementation paper and the corresponding code here)

However, it computes the gradient and Hessian for the second term as:
eta*DR*(x-x_ref) and eta*DR, see grad_f and h, respective.

I believe DR^2 should be used in computing grad_f and h.
For example, to compute grad_f, we add one line:

SmartPtr<Vector> x_only = c_vec->GetCompNonConst(0); 
x_only->Copy(*x_only_in); 
x_only->Axpy(-1.0, *x_ref_);
x_only->ElementWiseMultiply(*dr_x_); 
x_only->ElementWiseMultiply(*dr_x_);           // add this line
x_only->Scal(Eta(mu));
@svigerske
Copy link
Member

Great observation! I really appreciate that you took the effort to look into the code.
It is difficult to believe that this was undiscovered for so long. How did you find that? Did you debug a problem where the restoration NLP wasn't solved or did you just read the code out of interest?

I would fix that via 8c2e380. Please have a look.

@nychiang
Copy link
Author

@svigerske I found this and mentioned it to Andreas 2 years ago, when I developed feasibility problem in another solver. Then we forgot to address it in Ipopt. :-)
Recently I have problems requiring feasibility restoration, hence I checked the source code again and noticed that the bug still exists.

The new commit looks good to me. Thanks for the quick response.

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

No branches or pull requests

2 participants