43 double _wildfireThreshold =
49 void print(
const std::string str =
"")
const {
51 cout << str <<
"type: ISAM2GaussNewtonParams\n";
52 cout << str <<
"wildfireThreshold: " << wildfireThreshold <<
"\n";
56 double getWildfireThreshold()
const {
return wildfireThreshold; }
57 void setWildfireThreshold(
double wildfireThreshold) {
58 this->wildfireThreshold = wildfireThreshold;
81 double _initialDelta = 1.0,
82 double _wildfireThreshold =
86 SEARCH_EACH_ITERATION,
94 void print(
const std::string str =
"")
const {
96 cout << str <<
"type: ISAM2DoglegParams\n";
97 cout << str <<
"initialDelta: " << initialDelta <<
"\n";
98 cout << str <<
"wildfireThreshold: " << wildfireThreshold <<
"\n";
100 <<
"adaptationMode: " << adaptationModeTranslator(adaptationMode)
105 double getInitialDelta()
const {
return initialDelta; }
106 double getWildfireThreshold()
const {
return wildfireThreshold; }
107 std::string getAdaptationMode()
const {
108 return adaptationModeTranslator(adaptationMode);
110 bool isVerbose()
const {
return verbose; }
111 void setInitialDelta(
double initialDelta) {
112 this->initialDelta = initialDelta;
114 void setWildfireThreshold(
double wildfireThreshold) {
115 this->wildfireThreshold = wildfireThreshold;
117 void setAdaptationMode(
const std::string& adaptationMode) {
118 this->adaptationMode = adaptationModeTranslator(adaptationMode);
120 void setVerbose(
bool verbose) { this->verbose = verbose; }
122 std::string adaptationModeTranslator(
123 const DoglegOptimizerImpl::TrustRegionAdaptationMode& adaptationMode)
125 DoglegOptimizerImpl::TrustRegionAdaptationMode adaptationModeTranslator(
126 const std::string& adaptationMode)
const;
142 double stepSize = 1.5,
143 double sufficientDecreaseCoeff = 1e-3,
144 bool verbose =
false,
146 :
dllsParams{minDelta, maxDelta, stepSize, sufficientDecreaseCoeff,
149 if (minDelta < 1e-12 || maxDelta < 1e-12 || stepSize < 1.0) {
150 throw std::invalid_argument(
151 "ISAM2DoglegLineSearchParams constructed with invalid configuration. "
152 "Search Bounds [minDelta, maxDelta] ~ 0 or stepSize < 1.0");
156 void print(
const std::string str =
"")
const {
158 cout << str <<
"type: ISAM2DoglegLineSearchParams\n";
159 cout << str <<
"minDelta: " << dllsParams.
minDelta <<
"\n";
160 cout << str <<
"maxDelta: " << dllsParams.
maxDelta <<
"\n";
161 cout << str <<
"stepSize: " << dllsParams.
stepSize <<
"\n";
165 cout << str <<
"verbose: " << dllsParams.
verbose <<
"\n";
166 cout << str <<
"wildfireThreshold: " << wildfireThreshold <<
"\n";
171 double getMaxDelta()
const {
return dllsParams.
maxDelta; }
172 double getStepSize()
const {
return dllsParams.
stepSize; }
173 double getSufficientDecreaseCoeff()
const {
176 bool isVerbose()
const {
return dllsParams.
verbose; }
177 double getWildfireThreshold()
const {
return wildfireThreshold; }
181 void setMaxDelta(
double maxDelta) { this->dllsParams.
maxDelta = maxDelta; }
182 void setStepSize(
double stepSize) { this->dllsParams.
stepSize = stepSize; }
183 void setSufficientDecreaseCoeff(
double sufficientDecreaseCoeff) {
186 void setVerbose(
bool verbose) { this->dllsParams.
verbose = verbose; }
187 void setWildfireThreshold(
double wildfireThreshold) {
188 this->wildfireThreshold = wildfireThreshold;
198typedef ISAM2ThresholdMap::value_type ISAM2ThresholdMapValue;
205 typedef std::variant<double, FastMap<char, Vector> >
248 enum Factorization { CHOLESKY, QR };
314 int _relinearizeSkip = 10,
bool _enableRelinearization =
true,
315 bool _evaluateNonlinearError =
false,
316 Factorization _factorization = ISAM2Params::CHOLESKY,
317 bool _cacheLinearizedFactors =
true,
320 bool _enableDetailedResults =
false)
336 void print(
const std::string& str =
"")
const {
340 static const std::string kStr(
"optimizationParams: ");
346 cout << kStr <<
"{unknown type}\n";
349 cout <<
"relinearizeThreshold: ";
353 cout <<
"{mapped}\n";
354 for (
const ISAM2ThresholdMapValue& value :
356 cout <<
" '" << value.first
357 <<
"' -> [" << value.second.transpose() <<
" ]\n";
366 cout <<
"factorization: "
372 cout <<
"enablePartialRelinearizationCheck: "
387 OptimizationParams getOptimizationParams()
const {
388 return this->optimizationParams;
390 RelinearizationThreshold getRelinearizeThreshold()
const {
391 return relinearizeThreshold;
393 std::string getFactorization()
const {
394 return factorizationTranslator(factorization);
396 KeyFormatter getKeyFormatter()
const {
return keyFormatter; }
398 void setOptimizationParams(
const OptimizationParams& optimizationParams) {
399 this->optimizationParams = optimizationParams;
401 void setRelinearizeThreshold(
402 const RelinearizationThreshold& relinearizeThreshold) {
403 this->relinearizeThreshold = relinearizeThreshold;
405 void setFactorization(
const std::string& factorization) {
406 this->factorization = factorizationTranslator(factorization);
408 void setKeyFormatter(KeyFormatter keyFormatter) {
409 this->keyFormatter = keyFormatter;
412 GaussianFactorGraph::Eliminate getEliminationFunction()
const {
413 return factorization == CHOLESKY
414 ? (GaussianFactorGraph::Eliminate)EliminatePreferCholesky
423 static Factorization factorizationTranslator(
const std::string& str);
424 static std::string factorizationTranslator(
const Factorization& value);
Linear Factor Graph where all factors are Gaussians.
Nonlinear factor graph optimizer using Powell's Dogleg algorithm (detail implementation).
FastMap< char, Vector > ISAM2ThresholdMap
Parameters for the ISAM2 algorithm.
Definition ISAM2Params.h:197
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)
Multiply all factors and eliminate the given keys from the resulting factor using a QR variant that h...
Definition JacobianFactor.cpp:976
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
FastMap is a thin wrapper around std::map that uses the boost fast_pool_allocator instead of the defa...
Definition FastMap.h:40
This class contains the implementation of the Dogleg algorithm.
Definition DoglegOptimizerImpl.h:33
TrustRegionAdaptationMode
Specifies how the trust region is adapted at each Dogleg iteration.
Definition DoglegOptimizerImpl.h:54
Definition DoglegOptimizerImpl.h:261
bool verbose
Whether to print debug information.
Definition DoglegOptimizerImpl.h:266
double minDelta
Minimum allowed small delta.
Definition DoglegOptimizerImpl.h:262
double stepSize
Increase of trust region for outward steps.
Definition DoglegOptimizerImpl.h:264
double maxDelta
Maximum allowed delta.
Definition DoglegOptimizerImpl.h:263
double sufficientDecreaseCoeff
Coefficient for suff. decrease check.
Definition DoglegOptimizerImpl.h:265
Parameters for ISAM2 using Gauss-Newton optimization.
Definition ISAM2Params.h:36
double wildfireThreshold
Continue updating the linear delta only when changes are above this threshold (default: 0....
Definition ISAM2Params.h:38
ISAM2GaussNewtonParams(double _wildfireThreshold=0.001)
Specify parameters as constructor arguments.
Definition ISAM2Params.h:42
Parameters for ISAM2 using Dogleg optimization.
Definition ISAM2Params.h:68
DoglegOptimizerImpl::TrustRegionAdaptationMode adaptationMode
See description in DoglegOptimizerImpl::TrustRegionAdaptationMode.
Definition ISAM2Params.h:74
bool verbose
Whether Dogleg prints iteration and convergence information.
Definition ISAM2Params.h:77
ISAM2DoglegParams(double _initialDelta=1.0, double _wildfireThreshold=1e-5, DoglegOptimizerImpl::TrustRegionAdaptationMode _adaptationMode=DoglegOptimizerImpl::SEARCH_EACH_ITERATION, bool _verbose=false)
Specify parameters as constructor arguments.
Definition ISAM2Params.h:80
double initialDelta
The initial trust region radius for Dogleg.
Definition ISAM2Params.h:69
double wildfireThreshold
Continue updating the linear delta only when changes are above this threshold (default: 1e-5).
Definition ISAM2Params.h:71
Parameters for ISAM2 using Dogleg Line Search optimization.
Definition ISAM2Params.h:136
ISAM2DoglegLineSearchParams(double minDelta=0.02, double maxDelta=0.5, double stepSize=1.5, double sufficientDecreaseCoeff=1e-3, bool verbose=false, double wildfireThreshold=1e-4)
Specify parameters as constructor arguments.
Definition ISAM2Params.h:141
DoglegLineSearchImpl::Params dllsParams
Params for DoglegLineSearch.
Definition ISAM2Params.h:137
double wildfireThreshold
Update delta when changes are above thresh.
Definition ISAM2Params.h:138
void setMinDelta(double minDelta)
Setters.
Definition ISAM2Params.h:180
double getMinDelta() const
Getters.
Definition ISAM2Params.h:170
bool enablePartialRelinearizationCheck
Check variables for relinearization in tree-order, stopping the check once a variable does not need t...
Definition ISAM2Params.h:286
OptimizationParams optimizationParams
Optimization parameters, this both selects the nonlinear optimization method and specifies its parame...
Definition ISAM2Params.h:216
void print(const std::string &str="") const
print iSAM2 parameters
Definition ISAM2Params.h:336
double adaptiveReorderThreshold
The fill-in growth ratio that triggers a batch reorder when enableAdaptiveReorder is true (default: 2...
Definition ISAM2Params.h:306
std::variant< double, FastMap< char, Vector > > RelinearizationThreshold
Either a constant relinearization threshold or a per-variable-type set of thresholds.
Definition ISAM2Params.h:206
bool enableRelinearization
Controls whether ISAM2 will ever relinearize any variables (default: true).
Definition ISAM2Params.h:241
bool cacheLinearizedFactors
Whether to cache linear factors (default: true).
Definition ISAM2Params.h:267
bool evaluateNonlinearError
Whether to evaluate the nonlinear error before and after the update, to return in ISAM2Result from up...
Definition ISAM2Params.h:244
bool enableDetailedResults
Compute per-variable details and ISAM2Result::treeNnz.
Definition ISAM2Params.h:276
bool findUnusedFactorSlots
When you will be removing many factors, e.g.
Definition ISAM2Params.h:292
bool enableAdaptiveReorder
When enabled, ISAM2 tracks the total number of nonzero entries (nnz) in the Bayes tree after every ba...
Definition ISAM2Params.h:301
int relinearizeSkip
Only relinearize any variables every relinearizeSkip calls to ISAM2::update (default: 10).
Definition ISAM2Params.h:237
std::variant< ISAM2GaussNewtonParams, ISAM2DoglegParams, ISAM2DoglegLineSearchParams > OptimizationParams
Either ISAM2GaussNewtonParams or ISAM2DoglegParams or ISAM2DoglegLineSearchParams.
Definition ISAM2Params.h:202
Factorization factorization
Specifies whether to use QR or CHOESKY numerical factorization (default: CHOLESKY).
Definition ISAM2Params.h:260
KeyFormatter keyFormatter
A KeyFormatter for when keys are printed during debugging (default: DefaultKeyFormatter).
Definition ISAM2Params.h:270
RelinearizationThreshold relinearizeThreshold
Only relinearize variables whose linear delta magnitude is greater than this threshold (default: 0....
Definition ISAM2Params.h:235
ISAM2Params(OptimizationParams _optimizationParams=ISAM2GaussNewtonParams(), RelinearizationThreshold _relinearizeThreshold=0.1, int _relinearizeSkip=10, bool _enableRelinearization=true, bool _evaluateNonlinearError=false, Factorization _factorization=ISAM2Params::CHOLESKY, bool _cacheLinearizedFactors=true, const KeyFormatter &_keyFormatter=DefaultKeyFormatter, bool _enableDetailedResults=false)
Specify parameters as constructor arguments See the documentation of member variables above.
Definition ISAM2Params.h:312