Skip to content

Commit 7d66b1a

Browse files
Core Solver - Ceres Solver uses parameter bounds
This isn't the in-built Ceres parameter bounds, but rather the hacky version that was used for CMinpack, but seems to work very well overall.
1 parent 53bea8b commit 7d66b1a

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/mmSolver/adjust/adjust_ceres_lmder.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,6 @@ bool solve_3d_ceres_lmder(SolverOptions& solverOptions,
226226
options.logging_type = ::ceres::PER_MINIMIZER_ITERATION;
227227
}
228228

229-
// // TODO: Add parameter bounds.
230-
// for (int i = 0; i < numberOfParameters; i++) {
231-
// if (paramWeightList[i] < 1.0) {
232-
// // TODO: Set parameter bounds.
233-
// problem.SetParameterLowerBound(param_ptr, i, -1e8);
234-
// problem.SetParameterUpperBound(param_ptr, i, 1e8);
235-
// }
236-
// }
237-
238229
::ceres::Solver::Summary summary;
239230
::ceres::Solve(options, &problem, &summary);
240231

@@ -256,7 +247,6 @@ bool solve_3d_ceres_lmder(SolverOptions& solverOptions,
256247

257248
if (solveResult.success) {
258249
// NOTE: Parameters are updated in-place.
259-
// errorList = std::vector<double>(numberOfErrors);
260250
errorList.resize(numberOfErrors);
261251
cost_function->Evaluate(&param_ptr, errorList.data(), nullptr);
262252
}

src/mmSolver/adjust/adjust_defines.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
// auto-differentiation
171171
#define CERES_LMDIF_SUPPORT_AUTO_DIFF_FORWARD_VALUE false
172172
#define CERES_LMDIF_SUPPORT_AUTO_DIFF_CENTRAL_VALUE false
173-
#define CERES_LMDIF_SUPPORT_PARAMETER_BOUNDS_VALUE false
173+
#define CERES_LMDIF_SUPPORT_PARAMETER_BOUNDS_VALUE true
174174
#define CERES_LMDIF_SUPPORT_ROBUST_LOSS_VALUE false
175175

176176
// Ceres Levenberg-Marquardt Solver default flag values, using custom
@@ -190,7 +190,7 @@
190190
#define CERES_LMDER_ROBUST_LOSS_SCALE_DEFAULT_VALUE (1.0)
191191
#define CERES_LMDER_SUPPORT_AUTO_DIFF_FORWARD_VALUE true
192192
#define CERES_LMDER_SUPPORT_AUTO_DIFF_CENTRAL_VALUE true
193-
#define CERES_LMDER_SUPPORT_PARAMETER_BOUNDS_VALUE false
193+
#define CERES_LMDER_SUPPORT_PARAMETER_BOUNDS_VALUE true
194194
#define CERES_LMDER_SUPPORT_ROBUST_LOSS_VALUE false
195195

196196

0 commit comments

Comments
 (0)