Better options checking for TrustRegionMinimizer.
Since the trust region minimizer can use the line search
minimizer when it is solving a box constrained problem,
ensure that the line search options are valid.
Also some minor spacing fixes in the line search code.
Change-Id: Ife04204855cfac389cf980f0a79155d4accc8662
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc
index 3512e15..a1f347f 100644
--- a/internal/ceres/solver.cc
+++ b/internal/ceres/solver.cc
@@ -446,11 +446,16 @@
return false;
}
- if (minimizer_type == TRUST_REGION) {
- return TrustRegionOptionsAreValid(*this, error);
+ if (minimizer_type == TRUST_REGION &&
+ !TrustRegionOptionsAreValid(*this, error)) {
+ return false;
}
- CHECK_EQ(minimizer_type, LINE_SEARCH);
+ // We do not know if the problem is bounds constrained or not, if it
+ // is then the trust region solver will also use the line search
+ // solver to do a projection onto the box constraints, so make sure
+ // that the line search options are checked independent of what
+ // minimizer algorithm is being used.
return LineSearchOptionsAreValid(*this, error);
}