gtsam
Loading...
Searching...
No Matches
gtsam::GncOptimizer< GncParameters > Class Template Reference

Public Member Functions

 GncOptimizer (const NonlinearFactorGraph &graph, const Values &initialValues, const GncParameters &params=GncParameters())
 Constructor.
void setInlierCostThresholds (const double inth)
 Set the maximum weighted residual error for an inlier (same for all factors).
void setInlierCostThresholds (const Vector &inthVec)
 Set the maximum weighted residual error for an inlier (one for each factor).
void setInlierCostThresholdsAtProbability (const double alpha)
 Set the maximum weighted residual error threshold by specifying the probability alpha that the inlier residuals are smaller than that threshold.
void setWeights (const Vector w)
 Set weights for each factor.
const NonlinearFactorGraphgetFactors () const
 Access a copy of the internal factor graph.
const ValuesgetState () const
 Access a copy of the internal values.
const GncParameters & getParams () const
 Access a copy of the parameters.
const Vector & getWeights () const
 Access a copy of the GNC weights.
const Vector & getInlierCostThresholds () const
 Get the inlier threshold.
const GncTiminggetTiming () const
 Get the timing of the last optimize() call.
bool equals (const GncOptimizer &other, double tol=1e-9) const
 Equals.
Vector initializeWeightsFromKnownInliersAndOutliers () const
Values optimize ()
 Compute optimal solution using graduated non-convexity.
void validateLossSchedulerCombination () const
double initializeLambda () const
 Initialize the gnc parameter lambda such that loss is approximately convex (remark 5 in GNC paper).
double updateLambda (const double lambda) const
 Update the gnc parameter lambda to gradually increase nonconvexity.
bool checkLambdaConvergence (const double lambda) const
 Check if we have reached the value of lambda for which the surrogate loss matches the original loss.
bool checkCostConvergence (const double cost, const double prev_cost) const
 Check convergence of relative cost differences.
bool checkWeightsConvergence (const Vector &weights) const
 Check convergence of weights to binary values.
bool checkConvergence (const double lambda, const Vector &weights, const double cost, const double prev_cost) const
 Check for convergence between consecutive GNC iterations.
NonlinearFactorGraph makeWeightedGraph (const Vector &weights) const
 Create a graph where each factor is weighted by the gnc weights.
Vector calculateWeights (const Values &currentEstimate, const double lambda)
 Calculate gnc weights.

Static Public Member Functions

static double NormalizedMu (GncLossType lossType, const double lambda)
 Map this optimizer's historical graduation parameter to the normalized \mu in [0,1] expected by the robust loss interface.

Public Types

typedef GncParameters::OptimizerType BaseOptimizer
 For each parameter, specify the corresponding optimizer: e.g., GaussNewtonParams -> GaussNewtonOptimizer.

Member Function Documentation

◆ NormalizedMu()

template<class GncParameters>
double gtsam::GncOptimizer< GncParameters >::NormalizedMu ( GncLossType lossType,
const double lambda )
inlinestatic

Map this optimizer's historical graduation parameter to the normalized \mu in [0,1] expected by the robust loss interface.

\lambda is this class' name for the unbounded control parameter of the schedule, for every loss, which is why the parameters that drive it are named lambdaStep and lambdaMax. It is internal scheduling state, and the quantity it corresponds to in the publications differs per loss:

  • GM: \lambda decreases from a large value to 1; \mu = 1 / \lambda.
  • TLS: \lambda increases from ~0 to infinity; \mu = \lambda/(1 + \lambda). This is the same quantity LossFunctions.h calls \theta for TLS. Both maps are exact inverses of the ones documented in LossFunctions.h.

◆ setInlierCostThresholds() [1/2]

template<class GncParameters>
void gtsam::GncOptimizer< GncParameters >::setInlierCostThresholds ( const double inth)
inline

Set the maximum weighted residual error for an inlier (same for all factors).

For a factor in the form f(x) = 0.5 * || r(x) ||^2_Omega, the inlier threshold is the largest value of f(x) for the corresponding measurement to be considered an inlier. In other words, an inlier at x is such that 0.5 * || r(x) ||^2_Omega <= barcSq. Assuming an isotropic measurement covariance sigma^2 * Identity, the cost becomes: 0.5 * 1/sigma^2 || r(x) ||^2 <= barcSq. Hence || r(x) ||^2 <= 2 * barcSq * sigma^2.

◆ setInlierCostThresholds() [2/2]

template<class GncParameters>
void gtsam::GncOptimizer< GncParameters >::setInlierCostThresholds ( const Vector & inthVec)
inline

Set the maximum weighted residual error for an inlier (one for each factor).

For a factor in the form f(x) = 0.5 * || r(x) ||^2_Omega, the inlier threshold is the largest value of f(x) for the corresponding measurement to be considered an inlier. In other words, an inlier at x is such that 0.5 * || r(x) ||^2_Omega <= barcSq.

◆ setWeights()

template<class GncParameters>
void gtsam::GncOptimizer< GncParameters >::setWeights ( const Vector w)
inline

Set weights for each factor.

This is typically not needed, but provides an extra interface for the user to initialize the weights


The documentation for this class was generated from the following file:
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/nonlinear/GncOptimizer.h