gtsam 4.1.1
gtsam
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). More...
 
void setInlierCostThresholds (const Vector &inthVec)
 Set the maximum weighted residual error for an inlier (one for each factor). More...
 
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. More...
 
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.
 
bool equals (const GncOptimizer &other, double tol=1e-9) const
 Equals.
 
Vector initializeWeightsFromKnownInliersAndOutliers () const
 
Values optimize ()
 Compute optimal solution using graduated non-convexity.
 
double initializeMu () const
 Initialize the gnc parameter mu such that loss is approximately convex (remark 5 in GNC paper).
 
double updateMu (const double mu) const
 Update the gnc parameter mu to gradually increase nonconvexity.
 
bool checkMuConvergence (const double mu) const
 Check if we have reached the value of mu 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 mu, 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 mu)
 Calculate gnc weights.
 

Public Types

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

Member Function Documentation

◆ 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 weightst


The documentation for this class was generated from the following file: