Reconstruct dual infeasibility from results #608
-
Hi all, I am using the compilation of IPOPT from OPTI to solve a large NLP in MATLAB. Very often, the dual infeasibility doesn't converge hence failing the solve. I want to manually calculate the dual infeasibility from results so I can find which variables and constraints cause this. Unfortunately, my naive attempt doesn't generate the same dual infeasibility as reported from the command line print-out. Here is what I did and please let me know what I should fix: The ipopt function returns:
I use x to evaluate objective gradient Then use formula from the IPOPT reference paper (On the Implementation of an Interior-Point Filter Line-Search Algorithm for Large-Scale Nonlinear Programming) Eqn 4a:
As I mentioned earlier, this doesn't give the same inf_du from the print-out. One thing I know I am missing is the scaling, since the print-out value is scaled. But setting nlp_scaling_method to 'none' doesn't help. So am I using the right approach? What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
From the code, it is This is the function that calculates the The calculation of the gradient of the Lagrangian is at https://github.com/coin-or/Ipopt/blob/stable/3.14/src/Algorithm/IpIpoptCalculatedQuantities.cpp#L1993-L2030, in particular tmp->Copy(*curr_grad_f());
tmp->AddTwoVectors(1., *curr_jac_cT_times_curr_y_c(), 1., *curr_jac_dT_times_curr_y_d(), 1.);
DBG_PRINT_VECTOR(2, "jac_cT*y_c", *curr_jac_cT_times_curr_y_c());
DBG_PRINT_VECTOR(2, "jac_dT*y_d", *curr_jac_dT_times_curr_y_d());
ip_nlp_->Px_L()->MultVector(-1., *z_L, 1., *tmp);
ip_nlp_->Px_U()->MultVector(1., *z_U, 1., *tmp); So, in some sense, it is Note that Ipopt also works on an internal reformulation of the problem with slack variables added. This adds another term to the dual infeasibility, using quantities that are probably not accessible in OPTI (vl, vu). |
Beta Was this translation helpful? Give feedback.
From the code, it is
+ zu
and not- zu
.This is the function that calculates the
inf_du
from the output (calles withNormType=NormMax
):https://github.com/coin-or/Ipopt/blob/stable/3.14/src/Algorithm/IpIpoptCalculatedQuantities.cpp#L2653-L2697
The calculation of the gradient of the Lagrangian is at https://github.com/coin-or/Ipopt/blob/stable/3.14/src/Algorithm/IpIpoptCalculatedQuantities.cpp#L1993-L2030, in particular