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 , where is the error term. The goal is to minimize the sum of these robust costs over all measurements:
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:
As μ increases, the function 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:
Parameter | Type | Default Value | Description |
---|---|---|---|
lossType | GncLossType | TLS | Type of robust loss function (GM = Geman McClure or TLS = Truncated least squares) |
maxIterations | size_t | 100 | Maximum number of iterations |
muStep | double | 1.4 | Multiplicative factor to reduce/increase mu in GNC |
relativeCostTol | double | 1e-5 | Threshold for relative cost change to stop iterating |
weightsTol | double | 1e-4 | Threshold for weights being close to binary to stop iterating (TLS only) |
verbosity | Verbosity enum | SILENT | Verbosity level (options: SILENT, SUMMARY, MU, WEIGHTS, VALUES) |
knownInliers | IndexVector | Empty | Slots in factor graph for measurements known to be inliers |
knownOutliers | IndexVector | Empty | Slots 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.