Skip to content

Commit

Permalink
Core Solver - Ceres Solver uses parameter bounds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
david-cattermole committed Jan 26, 2025
1 parent 53bea8b commit 7d66b1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
10 changes: 0 additions & 10 deletions src/mmSolver/adjust/adjust_ceres_lmder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,6 @@ bool solve_3d_ceres_lmder(SolverOptions& solverOptions,
options.logging_type = ::ceres::PER_MINIMIZER_ITERATION;
}

// // TODO: Add parameter bounds.
// for (int i = 0; i < numberOfParameters; i++) {
// if (paramWeightList[i] < 1.0) {
// // TODO: Set parameter bounds.
// problem.SetParameterLowerBound(param_ptr, i, -1e8);
// problem.SetParameterUpperBound(param_ptr, i, 1e8);
// }
// }

::ceres::Solver::Summary summary;
::ceres::Solve(options, &problem, &summary);

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

if (solveResult.success) {
// NOTE: Parameters are updated in-place.
// errorList = std::vector<double>(numberOfErrors);
errorList.resize(numberOfErrors);
cost_function->Evaluate(&param_ptr, errorList.data(), nullptr);
}
Expand Down
4 changes: 2 additions & 2 deletions src/mmSolver/adjust/adjust_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
// auto-differentiation
#define CERES_LMDIF_SUPPORT_AUTO_DIFF_FORWARD_VALUE false
#define CERES_LMDIF_SUPPORT_AUTO_DIFF_CENTRAL_VALUE false
#define CERES_LMDIF_SUPPORT_PARAMETER_BOUNDS_VALUE false
#define CERES_LMDIF_SUPPORT_PARAMETER_BOUNDS_VALUE true
#define CERES_LMDIF_SUPPORT_ROBUST_LOSS_VALUE false

// Ceres Levenberg-Marquardt Solver default flag values, using custom
Expand All @@ -190,7 +190,7 @@
#define CERES_LMDER_ROBUST_LOSS_SCALE_DEFAULT_VALUE (1.0)
#define CERES_LMDER_SUPPORT_AUTO_DIFF_FORWARD_VALUE true
#define CERES_LMDER_SUPPORT_AUTO_DIFF_CENTRAL_VALUE true
#define CERES_LMDER_SUPPORT_PARAMETER_BOUNDS_VALUE false
#define CERES_LMDER_SUPPORT_PARAMETER_BOUNDS_VALUE true
#define CERES_LMDER_SUPPORT_ROBUST_LOSS_VALUE false


Expand Down

0 comments on commit 7d66b1a

Please sign in to comment.