Skip to content

Commit

Permalink
fix that grad_f_cache was not invalidated
Browse files Browse the repository at this point in the history
- ... when warmstart with same structure and grad_f_constant is set
- need to get new gradient value still, as coefs may have changed for new
  solve
  • Loading branch information
svigerske committed Oct 10, 2022
1 parent fe3868c commit a34c853
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Algorithm/IpOrigIpoptNLP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,12 @@ bool OrigIpoptNLP::Initialize(
// Reset the cache entries belonging to a dummy dependency. This
// is required for repeated solve, since the cache is not updated
// if a dimension is zero. It is also required if we choose
// jac_[cd]_constant and hessian_constant differently between
// runs
// jac_[cd]_constant, grad_f_constant, or hessian_constant differently between
// runs or when the values of these derivatives changes due to a problem change.
std::vector<const TaggedObject*> deps(1);
deps[0] = NULL;
std::vector<Number> sdeps(0);
grad_f_cache_.InvalidateResult(deps, sdeps);
c_cache_.InvalidateResult(deps, sdeps);
d_cache_.InvalidateResult(deps, sdeps);
jac_c_cache_.InvalidateResult(deps, sdeps);
Expand Down

0 comments on commit a34c853

Please sign in to comment.