Skip to content

Commit

Permalink
Handle IpOpt reporting obj_value 0.0 in case of non-finite fval or gr…
Browse files Browse the repository at this point in the history
…adient (#221)
  • Loading branch information
dweindl committed May 16, 2020
1 parent 52dbd74 commit 8018064
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/parpeoptimization/localOptimizationIpoptTNLP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ LocalOptimizationIpoptTNLP::finalize_solution(
{

auto unlockIpOpt = ipOptReleaseLock();
// If we finish with objective value of NAN, IpOpt still passes
// obj_value 0.0 along with the respective flag. This does not make too
// much sense. Set to NAN.
if(status == INVALID_NUMBER_DETECTED && obj_value == 0.0) {
obj_value = NAN;
}

reporter.finished(obj_value, gsl::span<double const>(x, n), status);
}
Expand Down

0 comments on commit 8018064

Please sign in to comment.