55template<
class BaseOptimizerParameters>
68#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
119 <<
"setMaxIterations: changing the max nr of iters might lead to less accurate solutions and is not recommended! "
151 for (
size_t i = 0; i < knownIn.size(); i++){
162 for (
size_t i = 0; i < knownOut.size(); i++){
163 knownOutliers.push_back(knownOut[i]);
165 std::sort(knownOutliers.begin(), knownOutliers.end());
168 void setAllowNonNoiseModelFactors(
bool allow) {
172#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
185 && knownOutliers == other.knownOutliers
190 void print(
const std::string& str)
const {
191 std::cout << str <<
"\n";
194 std::cout <<
"lossType: Geman McClure" <<
"\n";
197 std::cout <<
"lossType: Truncated Least-squares" <<
"\n";
200 throw std::runtime_error(
"GncParams::print: unknown loss type.");
203 case GncScheduler::Linear:
204 std::cout <<
"scheduler: Linear" <<
"\n";
206 case GncScheduler::SuperLinear:
207 std::cout <<
"scheduler: SuperLinear" <<
"\n";
210 throw std::runtime_error(
"GncParams::print: unknown scheduler type.");
213 std::cout <<
"lambdaStep: " <<
lambdaStep <<
"\n";
215 std::cout <<
"weightsTol: " <<
weightsTol <<
"\n";
216 std::cout <<
"verbosity: " <<
verbosity <<
"\n";
218 std::cout <<
"knownInliers: " <<
knownInliers[i] <<
"\n";
219 for (
size_t i = 0; i < knownOutliers.size(); i++)
220 std::cout <<
"knownOutliers: " << knownOutliers[i] <<
"\n";
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
FastVector is a type alias to a std::vector with a custom memory allocator.
Definition FastVector.h:33
Global functions in a separate testing namespace.
Definition chartTesting.h:28
GncLossType
Choice of robust loss function for GNC.
Definition GncParams.h:43
GncScheduler
Choice of GNC scheduling strategy.
Definition GncParams.h:50
BaseOptimizerParameters baseOptimizerParams
GNC parameters.
Definition GncParams.h:87
double lambdaMax
Maximum value of lambda in GNC, acts as a cap (only for TLS).
Definition GncParams.h:95
IndexVector knownInliers
Slots in the factor graph corresponding to measurements that we know are outliers.
Definition GncParams.h:102
GncParams()
Default constructor.
Definition GncParams.h:82
BaseOptimizerParameters::OptimizerType OptimizerType
For each parameter, specify the corresponding optimizer: e.g., GaussNewtonParams -> GaussNewtonOptimi...
Definition GncParams.h:59
void setKnownInliers(const IndexVector &knownIn)
(Optional) Provide a vector of measurements that must be considered inliers.
Definition GncParams.h:150
void print(const std::string &str) const
Print.
Definition GncParams.h:190
double lambdaStep
Multiplicative factor to reduce/increase the lambda in gnc.
Definition GncParams.h:92
FastVector< uint64_t > IndexVector
Use IndexVector for inliers and outliers since it is fast.
Definition GncParams.h:100
GncParams(const BaseOptimizerParameters &baseOptimizerParams)
Constructor.
Definition GncParams.h:77
void setLambdaStep(const double step)
Set the graduated non-convexity step: at each GNC iteration, lambda is updated as lambda <- lambda * ...
Definition GncParams.h:125
double weightsTol
If the weights are within weightsTol from being binary, stop iterating (only for TLS).
Definition GncParams.h:94
void setKnownOutliers(const IndexVector &knownOut)
(Optional) Provide a vector of measurements that must be considered outliers.
Definition GncParams.h:161
Verbosity verbosity
Verbosity level.
Definition GncParams.h:96
bool equals(const GncParams &other, double tol=1e-9) const
Equals.
Definition GncParams.h:179
void setRelativeCostTol(double value)
Set the maximum relative difference in lambda values to stop iterating.
Definition GncParams.h:130
GncLossType lossType
any other specific GNC parameters:
Definition GncParams.h:89
bool allowNonNoiseModelFactors
If true, factors without noise model are not reweighted and not not included in lambda calculation.
Definition GncParams.h:97
size_t maxIterations
Maximum number of iterations.
Definition GncParams.h:91
void setLossType(const GncLossType type)
Set the robust loss function to be used in GNC (chosen among the ones in GncLossType).
Definition GncParams.h:107
GncScheduler scheduler
Default scheduler.
Definition GncParams.h:90
double relativeCostTol
If relative cost change is below this threshold, stop iterating.
Definition GncParams.h:93
void setVerbosityGNC(const Verbosity value)
Set the verbosity level.
Definition GncParams.h:140
void setMaxIterations(const size_t maxIter)
Set the maximum number of iterations in GNC (changing the max nr of iters might lead to less accurate...
Definition GncParams.h:117
Verbosity
Verbosity levels.
Definition GncParams.h:62
void setWeightsTol(double value)
Set the maximum difference between the weights and their rounding in {0,1} to stop iterating.
Definition GncParams.h:135
void setScheduler(const GncScheduler s)
Set the scheduler type.
Definition GncParams.h:112