From 66939fd984ce7bd32d60f4786b1623ca694fa4eb Mon Sep 17 00:00:00 2001 From: Stefan Vigerske Date: Mon, 13 Feb 2023 12:17:02 +0100 Subject: [PATCH] update changelog, style change --- ChangeLog.md | 5 ++++- src/Interfaces/IpStdCInterface.cpp | 16 ++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index a780bf08f..89c8301c8 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -9,7 +9,10 @@ More detailed information about incremental changes can be found in the ### 3.14.12 (2023-xx-yy) -- Fix that a source file was installed and install more header files [#642] +- Fix that a source file was installed and install more header files. + [#641, #642, by Joao Sousa Pinto] +- Fixed crash of GetIpoptCurrentIterate() and GetIpoptCurrentViolations() in + C interface when called before or after IpoptSolve(). [#644, #645, by Robbybp] ### 3.14.11 (2023-02-07) diff --git a/src/Interfaces/IpStdCInterface.cpp b/src/Interfaces/IpStdCInterface.cpp index 3c2e86fdf..66969b9ae 100644 --- a/src/Interfaces/IpStdCInterface.cpp +++ b/src/Interfaces/IpStdCInterface.cpp @@ -302,14 +302,12 @@ bool GetIpoptCurrentIterate( ipnumber* lambda ) { - if (IsNull(ipopt_problem->tnlp)) + if( IsNull(ipopt_problem->tnlp) ) { return false; } - else - { - return ipopt_problem->tnlp->get_curr_iterate(scaled, n, x, z_L, z_U, m, g, lambda); - } + + return ipopt_problem->tnlp->get_curr_iterate(scaled, n, x, z_L, z_U, m, g, lambda); } bool GetIpoptCurrentViolations( @@ -326,12 +324,10 @@ bool GetIpoptCurrentViolations( ipnumber* compl_g ) { - if (IsNull(ipopt_problem->tnlp)) + if( IsNull(ipopt_problem->tnlp) ) { return false; } - else - { - return ipopt_problem->tnlp->get_curr_violations(scaled != 0, n, x_L_violation, x_U_violation, compl_x_L, compl_x_U, grad_lag_x, m, nlp_constraint_violation, compl_g); - } + + return ipopt_problem->tnlp->get_curr_violations(scaled != 0, n, x_L_violation, x_U_violation, compl_x_L, compl_x_U, grad_lag_x, m, nlp_constraint_violation, compl_g); }