gtsam
Loading...
Searching...
No Matches
RISAMGraduationScheduler.h
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
19#pragma once
21#include <gtsam/base/Matrix.h>
22#include <gtsam/nonlinear/internal/ChiSquaredInverse.h>
23
24#include <memory>
25#include <optional>
26#include <stdexcept>
27
28namespace gtsam {
29
42class GTSAM_EXPORT GraduationScheduler {
45 public:
47 typedef std::shared_ptr<GraduationScheduler> shared_ptr;
49 typedef std::function<double(double, double, size_t)> MuUpdateStrategy;
51
54 protected:
56 double muInit_;
66
69 public:
81 double muInitIncrement = 0.2, double muInit = 0.0)
82 : muInit_(muInit),
84 muUpdateStrategy_(muUpdateStrategy),
85 muInitIncrement_(muInitIncrement) {
86 if (!(muInit >= 0.0 && muInit <= 1.0)) {
87 throw std::invalid_argument(
88 "GraduationScheduler: muInit must be in [0, 1].");
89 }
90 }
91
93 double muInit() const { return muInit_; }
94
100 double updateMu(const double& mu, const double& residual,
101 const size_t& updateCount) const;
102
109 double updateMuInit(const double& muInit, const bool isInlier) const;
110
112 bool isMuConverged(const double& mu) const;
114
117 public:
121 static double MuUpdateMcGann2023(const double& mu, const double& residual,
122 const size_t& updateCount);
126 static double MuUpdateStable(const double& mu, const double& residual,
127 const size_t& updateCount);
129};
130} // namespace gtsam
A thin wrapper around std::vector that uses a custom allocator.
typedef and functions to augment Eigen's MatrixXd
Global functions in a separate testing namespace.
Definition chartTesting.h:28
std::function< double(double, double, size_t)> MuUpdateStrategy
Function type for $\mu$ update sequence.
Definition RISAMGraduationScheduler.h:49
GraduationScheduler(MuUpdateStrategy muUpdateStrategy=MuUpdateStable, double muInitIncrement=0.2, double muInit=0.0)
Individual Parameter Constructor.
Definition RISAMGraduationScheduler.h:80
std::shared_ptr< GraduationScheduler > shared_ptr
Shortcut for shared pointer.
Definition RISAMGraduationScheduler.h:47
double muInit() const
Returns the value of $\mu_{init}$ for this graduated.
Definition RISAMGraduationScheduler.h:93
double convergenceThreshold_
The threshold at which to consider mu to be converged.
Definition RISAMGraduationScheduler.h:59
double muInit_
The initial value for mu $\mu_{init}$.
Definition RISAMGraduationScheduler.h:56
double muInitIncrement_
The amount to increment/decrement $\mu_{init}$ if the factor is a strong inlier/outlier when values c...
Definition RISAMGraduationScheduler.h:64
static double MuUpdateStable(const double &mu, const double &residual, const size_t &updateCount)
More stable $\mu$ Update sequence developed empirically since algorithm was published.
Definition RISAMGraduationScheduler.cpp:44
MuUpdateStrategy muUpdateStrategy_
The update strategy for the sequence $\mu$ values.
Definition RISAMGraduationScheduler.h:61