Skip to content

Commit

Permalink
Fix eval_jac_g error being silently ignored in TNLPAdapter::GetSpaces (
Browse files Browse the repository at this point in the history
…#697)

- throw INVALID_NLP exception now
  • Loading branch information
chrhansk authored and svigerske committed Sep 16, 2023
1 parent 5a492e9 commit c821775
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ More detailed information about incremental changes can be found in the

- Reduced priority for making Spral the default value for option linear_solver [#677].
- Adapted to change of integer types in Spral interface. Minimal required Spral version is now v2023.03.29.
- Fixed that return code from TNLP::eval_jac_g() was ignored at first call [#697, by
Christoph Hansknecht].

### 3.14.12 (2023-04-05)

Expand Down
11 changes: 10 additions & 1 deletion src/Interfaces/IpTNLPAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,16 @@ bool TNLPAdapter::GetSpaces(
// Get the non zero structure
Index* g_iRow = new Index[nz_full_jac_g_];
Index* g_jCol = new Index[nz_full_jac_g_];
tnlp_->eval_jac_g(n_full_x_, NULL, false, n_full_g_, nz_full_jac_g_, g_iRow, g_jCol, NULL);

bool retval = tnlp_->eval_jac_g(n_full_x_, NULL, false, n_full_g_, nz_full_jac_g_, g_iRow, g_jCol, NULL);

if( !retval )
{
delete[] g_iRow;
delete[] g_jCol;

ASSERT_EXCEPTION(INVALID_TNLP, "eval_jac_g returned false in GetSpaces");
}

if( index_style_ != TNLP::FORTRAN_STYLE )
{
Expand Down

0 comments on commit c821775

Please sign in to comment.