Initialize inner_iterations_were_useful_ correctly.
This variable should be initialized before the decision to
perform inner iterations are performed.
Change-Id: Ic80e2d5284ecc67eaed1859be009b1a4d18bf76b
diff --git a/internal/ceres/trust_region_minimizer.cc b/internal/ceres/trust_region_minimizer.cc
index 7a4a775..8d4407b 100644
--- a/internal/ceres/trust_region_minimizer.cc
+++ b/internal/ceres/trust_region_minimizer.cc
@@ -469,6 +469,7 @@
// point, and if the optimization is successful, candidate_x_ will be
// updated with the optimized parameters.
void TrustRegionMinimizer::DoInnerIterationsIfNeeded() {
+ inner_iterations_were_useful_ = false;
if (!inner_iterations_are_enabled_ ||
candidate_cost_ >= std::numeric_limits<double>::max()) {
return;