Skip to article frontmatterSkip to article content

GncOptimizer

Overview

The GncOptimizer class in GTSAM is designed to perform robust optimization using Graduated Non-Convexity (GNC). This method is particularly useful in scenarios where the optimization problem is affected by outliers. The GNC approach gradually transitions from a convex approximation of the problem to the original non-convex problem, thereby improving robustness and convergence.

The GncOptimizer leverages a robust cost function ρ(e)\rho(e), where ee is the error term. The goal is to minimize the sum of these robust costs over all measurements:

minxiρ(ei(x))\min_x \sum_i \rho(e_i(x))

In the context of GNC, the robust cost function is gradually transformed from a convex approximation to the original non-convex form. This transformation is controlled by a parameter μ, which is adjusted during the optimization process:

ρμ(e)=1μρ(μe)\rho_\mu(e) = \frac{1}{\mu} \rho(\mu e)

As μ increases, the function ρμ(e)\rho_\mu(e) transitions from a convex to a non-convex shape, allowing the optimizer to handle outliers effectively.

Key features:

  • Robust Optimization: The GncOptimizer is specifically tailored to handle optimization problems with outliers, using a robust cost function that can mitigate their effects.
  • Graduated Non-Convexity: This technique allows the optimizer to start with a convex problem and gradually transform it into the original non-convex problem, which helps in avoiding local minima.
  • Customizable Parameters: Users can adjust various parameters to control the behavior of the optimizer, such as the type of robust loss function and the parameters governing the GNC process.

Key Methods

Please see the base class NonlinearOptimizer.

Parameters

The GncParams class defines parameters specific to the GNC optimization algorithm:

ParameterTypeDefault ValueDescription
lossTypeGncLossTypeTLSType of robust loss function (GM = Geman McClure or TLS = Truncated least squares)
maxIterationssize_t100Maximum number of iterations
muStepdouble1.4Multiplicative factor to reduce/increase mu in GNC
relativeCostToldouble1e-5Threshold for relative cost change to stop iterating
weightsToldouble1e-4Threshold for weights being close to binary to stop iterating (TLS only)
verbosityVerbosity enumSILENTVerbosity level (options: SILENT, SUMMARY, MU, WEIGHTS, VALUES)
knownInliersIndexVectorEmptySlots in factor graph for measurements known to be inliers
knownOutliersIndexVectorEmptySlots in factor graph for measurements known to be outliers

These parameters complement the standard optimization parameters inherited from NonlinearOptimizerParams, which include:

  • Maximum iterations
  • Relative and absolute error thresholds
  • Error function verbosity
  • Linear solver type

Usage Considerations

  • Outlier Rejection: The GncOptimizer is particularly effective in scenarios with significant outlier presence, such as SLAM or bundle adjustment problems.
  • Parameter Tuning: Proper tuning of the GNC parameters is crucial for achieving optimal performance. Users should experiment with different settings to find the best configuration for their specific problem.

Files