diff --git a/docs/source/gradient_solver.rst b/docs/source/gradient_solver.rst index cf0653068..1ef151564 100644 --- a/docs/source/gradient_solver.rst +++ b/docs/source/gradient_solver.rst @@ -327,11 +327,10 @@ Solving Solver terminates if - .. math:: \frac{|\Delta \text{cost}|}{\text{cost}} < \text{function_tolerance} + .. math:: \frac{|\Delta \text{cost}|}{\text{cost}} <= \text{function_tolerance} where, :math:`\Delta \text{cost}` is the change in objective - function value (up or down) in the current iteration of - Levenberg-Marquardt. + function value (up or down) in the current iteration of the line search. .. member:: double GradientProblemSolver::Options::gradient_tolerance @@ -339,13 +338,24 @@ Solving Solver terminates if - .. math:: \|x - \Pi \boxplus(x, -g(x))\|_\infty < \text{gradient_tolerance} + .. math:: \|x - \Pi \boxplus(x, -g(x))\|_\infty <= \text{gradient_tolerance} where :math:`\|\cdot\|_\infty` refers to the max norm, :math:`\Pi` is projection onto the bounds constraints and :math:`\boxplus` is Plus operation for the overall local parameterization associated with the parameter vector. +.. member:: double GradientProblemSolver::Options::parameter_tolerance + + Default: ``1e-8`` + + Solver terminates if + + .. math:: \|\Delta x\| <= (\|x\| + \text{parameter_tolerance}) * \text{parameter_tolerance} + + where :math:`\Delta x` is the step computed by the linear solver in + the current iteration of the line search. + .. member:: LoggingType GradientProblemSolver::Options::logging_type Default: ``PER_MINIMIZER_ITERATION`` diff --git a/docs/source/nnls_solving.rst b/docs/source/nnls_solving.rst index 95f1a3634..d3a64799b 100644 --- a/docs/source/nnls_solving.rst +++ b/docs/source/nnls_solving.rst @@ -1156,7 +1156,7 @@ elimination group [LiSaad]_. Solver terminates if - .. math:: \frac{|\Delta \text{cost}|}{\text{cost}} < \text{function_tolerance} + .. math:: \frac{|\Delta \text{cost}|}{\text{cost}} <= \text{function_tolerance} where, :math:`\Delta \text{cost}` is the change in objective function value (up or down) in the current iteration of @@ -1168,7 +1168,7 @@ elimination group [LiSaad]_. Solver terminates if - .. math:: \|x - \Pi \boxplus(x, -g(x))\|_\infty < \text{gradient_tolerance} + .. math:: \|x - \Pi \boxplus(x, -g(x))\|_\infty <= \text{gradient_tolerance} where :math:`\|\cdot\|_\infty` refers to the max norm, :math:`\Pi` is projection onto the bounds constraints and :math:`\boxplus` is @@ -1181,10 +1181,10 @@ elimination group [LiSaad]_. Solver terminates if - .. math:: \|\Delta x\| < (\|x\| + \text{parameter_tolerance}) * \text{parameter_tolerance} + .. math:: \|\Delta x\| <= (\|x\| + \text{parameter_tolerance}) * \text{parameter_tolerance} where :math:`\Delta x` is the step computed by the linear solver in - the current iteration of Levenberg-Marquardt. + the current iteration. .. member:: LinearSolverType Solver::Options::linear_solver_type diff --git a/internal/ceres/line_search_minimizer.cc b/internal/ceres/line_search_minimizer.cc index 0d29b3eb9..62264fb0b 100644 --- a/internal/ceres/line_search_minimizer.cc +++ b/internal/ceres/line_search_minimizer.cc @@ -412,7 +412,7 @@ void LineSearchMinimizer::Minimize(const Minimizer::Options& options, const double absolute_function_tolerance = options.function_tolerance * previous_state.cost; - if (fabs(iteration_summary.cost_change) < absolute_function_tolerance) { + if (fabs(iteration_summary.cost_change) <= absolute_function_tolerance) { summary->message = StringPrintf("Function tolerance reached. " "|cost_change|/cost: %e <= %e", diff --git a/internal/ceres/trust_region_minimizer.cc b/internal/ceres/trust_region_minimizer.cc index e490768cf..d654d0867 100644 --- a/internal/ceres/trust_region_minimizer.cc +++ b/internal/ceres/trust_region_minimizer.cc @@ -489,7 +489,7 @@ void TrustRegionMinimizer::Minimize(const Minimizer::Options& options, iteration_summary.cost_change = cost - new_cost; const double absolute_function_tolerance = options_.function_tolerance * cost; - if (fabs(iteration_summary.cost_change) < absolute_function_tolerance) { + if (fabs(iteration_summary.cost_change) <= absolute_function_tolerance) { summary->message = StringPrintf("Function tolerance reached. " "|cost_change|/cost: %e <= %e",