gtsam  4.0.0
gtsam
ISAM2.h
Go to the documentation of this file.
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 
18 // \callgraph
19 
20 #pragma once
21 
25 
26 #include <boost/variant.hpp>
27 
28 namespace gtsam {
29 
36 struct GTSAM_EXPORT ISAM2GaussNewtonParams {
38 
41  double _wildfireThreshold = 0.001
42  ) : wildfireThreshold(_wildfireThreshold) {}
43 
44  void print(const std::string str = "") const {
45  std::cout << str << "type: ISAM2GaussNewtonParams\n";
46  std::cout << str << "wildfireThreshold: " << wildfireThreshold << "\n";
47  std::cout.flush();
48  }
49 
50  double getWildfireThreshold() const { return wildfireThreshold; }
51  void setWildfireThreshold(double wildfireThreshold) { this->wildfireThreshold = wildfireThreshold; }
52 };
53 
60 struct GTSAM_EXPORT ISAM2DoglegParams {
61  double initialDelta;
64  bool verbose;
65 
68  double _initialDelta = 1.0,
69  double _wildfireThreshold = 1e-5,
70  DoglegOptimizerImpl::TrustRegionAdaptationMode _adaptationMode = DoglegOptimizerImpl::SEARCH_EACH_ITERATION,
71  bool _verbose = false
72  ) : initialDelta(_initialDelta), wildfireThreshold(_wildfireThreshold),
73  adaptationMode(_adaptationMode), verbose(_verbose) {}
74 
75  void print(const std::string str = "") const {
76  std::cout << str << "type: ISAM2DoglegParams\n";
77  std::cout << str << "initialDelta: " << initialDelta << "\n";
78  std::cout << str << "wildfireThreshold: " << wildfireThreshold << "\n";
79  std::cout << str << "adaptationMode: " << adaptationModeTranslator(adaptationMode) << "\n";
80  std::cout.flush();
81  }
82 
83  double getInitialDelta() const { return initialDelta; }
84  double getWildfireThreshold() const { return wildfireThreshold; }
85  std::string getAdaptationMode() const { return adaptationModeTranslator(adaptationMode); };
86  bool isVerbose() const { return verbose; };
87 
88  void setInitialDelta(double initialDelta) { this->initialDelta = initialDelta; }
89  void setWildfireThreshold(double wildfireThreshold) { this->wildfireThreshold = wildfireThreshold; }
90  void setAdaptationMode(const std::string& adaptationMode) { this->adaptationMode = adaptationModeTranslator(adaptationMode); }
91  void setVerbose(bool verbose) { this->verbose = verbose; };
92 
93  std::string adaptationModeTranslator(const DoglegOptimizerImpl::TrustRegionAdaptationMode& adaptationMode) const;
94  DoglegOptimizerImpl::TrustRegionAdaptationMode adaptationModeTranslator(const std::string& adaptationMode) const;
95 };
96 
102 typedef ISAM2ThresholdMap::value_type ISAM2ThresholdMapValue;
103 struct GTSAM_EXPORT ISAM2Params {
104  typedef boost::variant<ISAM2GaussNewtonParams, ISAM2DoglegParams> OptimizationParams;
105  typedef boost::variant<double, FastMap<char,Vector> > RelinearizationThreshold;
106 
113  OptimizationParams optimizationParams;
114 
130  RelinearizationThreshold relinearizeThreshold;
131 
133 
135 
137 
138  enum Factorization { CHOLESKY, QR };
147  Factorization factorization;
148 
155 
157 
159 
166 
171 
174  OptimizationParams _optimizationParams = ISAM2GaussNewtonParams(),
175  RelinearizationThreshold _relinearizeThreshold = 0.1,
176  int _relinearizeSkip = 10,
177  bool _enableRelinearization = true,
178  bool _evaluateNonlinearError = false,
179  Factorization _factorization = ISAM2Params::CHOLESKY,
180  bool _cacheLinearizedFactors = true,
181  const KeyFormatter& _keyFormatter = DefaultKeyFormatter
182  ) : optimizationParams(_optimizationParams), relinearizeThreshold(_relinearizeThreshold),
183  relinearizeSkip(_relinearizeSkip), enableRelinearization(_enableRelinearization),
184  evaluateNonlinearError(_evaluateNonlinearError), factorization(_factorization),
185  cacheLinearizedFactors(_cacheLinearizedFactors), keyFormatter(_keyFormatter),
186  enableDetailedResults(false), enablePartialRelinearizationCheck(false),
187  findUnusedFactorSlots(false) {}
188 
190  void print(const std::string& str = "") const {
191  std::cout << str << "\n";
192  if(optimizationParams.type() == typeid(ISAM2GaussNewtonParams))
193  boost::get<ISAM2GaussNewtonParams>(optimizationParams).print("optimizationParams: ");
194  else if(optimizationParams.type() == typeid(ISAM2DoglegParams))
195  boost::get<ISAM2DoglegParams>(optimizationParams).print("optimizationParams: ");
196  else
197  std::cout << "optimizationParams: " << "{unknown type}" << "\n";
198  if(relinearizeThreshold.type() == typeid(double))
199  std::cout << "relinearizeThreshold: " << boost::get<double>(relinearizeThreshold) << "\n";
200  else
201  {
202  std::cout << "relinearizeThreshold: " << "{mapped}" << "\n";
203  for(const ISAM2ThresholdMapValue& value: boost::get<ISAM2ThresholdMap>(relinearizeThreshold)) {
204  std::cout << " '" << value.first << "' -> [" << value.second.transpose() << " ]\n";
205  }
206  }
207  std::cout << "relinearizeSkip: " << relinearizeSkip << "\n";
208  std::cout << "enableRelinearization: " << enableRelinearization << "\n";
209  std::cout << "evaluateNonlinearError: " << evaluateNonlinearError << "\n";
210  std::cout << "factorization: " << factorizationTranslator(factorization) << "\n";
211  std::cout << "cacheLinearizedFactors: " << cacheLinearizedFactors << "\n";
212  std::cout << "enableDetailedResults: " << enableDetailedResults << "\n";
213  std::cout << "enablePartialRelinearizationCheck: " << enablePartialRelinearizationCheck << "\n";
214  std::cout << "findUnusedFactorSlots: " << findUnusedFactorSlots << "\n";
215  std::cout.flush();
216  }
217 
220 
221  OptimizationParams getOptimizationParams() const { return this->optimizationParams; }
222  RelinearizationThreshold getRelinearizeThreshold() const { return relinearizeThreshold; }
223  int getRelinearizeSkip() const { return relinearizeSkip; }
224  bool isEnableRelinearization() const { return enableRelinearization; }
225  bool isEvaluateNonlinearError() const { return evaluateNonlinearError; }
226  std::string getFactorization() const { return factorizationTranslator(factorization); }
227  bool isCacheLinearizedFactors() const { return cacheLinearizedFactors; }
228  KeyFormatter getKeyFormatter() const { return keyFormatter; }
229  bool isEnableDetailedResults() const { return enableDetailedResults; }
230  bool isEnablePartialRelinearizationCheck() const { return enablePartialRelinearizationCheck; }
231 
232  void setOptimizationParams(OptimizationParams optimizationParams) { this->optimizationParams = optimizationParams; }
233  void setRelinearizeThreshold(RelinearizationThreshold relinearizeThreshold) { this->relinearizeThreshold = relinearizeThreshold; }
234  void setRelinearizeSkip(int relinearizeSkip) { this->relinearizeSkip = relinearizeSkip; }
235  void setEnableRelinearization(bool enableRelinearization) { this->enableRelinearization = enableRelinearization; }
236  void setEvaluateNonlinearError(bool evaluateNonlinearError) { this->evaluateNonlinearError = evaluateNonlinearError; }
237  void setFactorization(const std::string& factorization) { this->factorization = factorizationTranslator(factorization); }
238  void setCacheLinearizedFactors(bool cacheLinearizedFactors) { this->cacheLinearizedFactors = cacheLinearizedFactors; }
239  void setKeyFormatter(KeyFormatter keyFormatter) { this->keyFormatter = keyFormatter; }
240  void setEnableDetailedResults(bool enableDetailedResults) { this->enableDetailedResults = enableDetailedResults; }
241  void setEnablePartialRelinearizationCheck(bool enablePartialRelinearizationCheck) { this->enablePartialRelinearizationCheck = enablePartialRelinearizationCheck; }
242 
243  GaussianFactorGraph::Eliminate getEliminationFunction() const {
244  return factorization == CHOLESKY
245  ? (GaussianFactorGraph::Eliminate)EliminatePreferCholesky
247  }
248 
250 
253 
254  static Factorization factorizationTranslator(const std::string& str);
255  static std::string factorizationTranslator(const Factorization& value);
256 
258 };
259 
261 
269 struct GTSAM_EXPORT ISAM2Result {
281  boost::optional<double> errorBefore;
282 
292  boost::optional<double> errorAfter;
293 
303 
311 
314 
316  size_t cliques;
317 
322  FactorIndices newFactorsIndices;
323 
330  struct VariableStatus {
337  bool isRelinearized;
338  bool isObserved;
339  bool isNew;
341  VariableStatus(): isReeliminated(false), isAboveRelinThreshold(false), isRelinearizeInvolved(false),
342  isRelinearized(false), isObserved(false), isNew(false), inRootClique(false) {}
343  };
344 
348  };
349 
352  boost::optional<DetailedResults> detail;
353 
354 
355  void print(const std::string str = "") const {
356  std::cout << str << " Reelimintated: " << variablesReeliminated << " Relinearized: " << variablesRelinearized << " Cliques: " << cliques << std::endl;
357  }
358 
360  size_t getVariablesRelinearized() const { return variablesRelinearized; };
361  size_t getVariablesReeliminated() const { return variablesReeliminated; };
362  size_t getCliques() const { return cliques; };
363 };
364 
369 class GTSAM_EXPORT ISAM2Clique : public BayesTreeCliqueBase<ISAM2Clique, GaussianFactorGraph>
370 {
371 public:
372  typedef ISAM2Clique This;
374  typedef boost::shared_ptr<This> shared_ptr;
375  typedef boost::weak_ptr<This> weak_ptr;
377  typedef ConditionalType::shared_ptr sharedConditional;
378 
379  Base::FactorType::shared_ptr cachedFactor_;
380  Vector gradientContribution_;
382 
384  ISAM2Clique() : Base() {}
385 
387  ISAM2Clique(const ISAM2Clique& other) :
388  Base(other), cachedFactor_(other.cachedFactor_), gradientContribution_(other.gradientContribution_) {}
389 
392  {
393  Base::operator=(other);
394  cachedFactor_ = other.cachedFactor_;
395  gradientContribution_ = other.gradientContribution_;
396  return *this;
397  }
398 
400  void setEliminationResult(const FactorGraphType::EliminationResult& eliminationResult);
401 
403  Base::FactorType::shared_ptr& cachedFactor() { return cachedFactor_; }
404 
406  const Vector& gradientContribution() const { return gradientContribution_; }
407 
408  bool equals(const This& other, double tol=1e-9) const;
409 
411  void print(const std::string& s = "", const KeyFormatter& formatter = DefaultKeyFormatter) const;
412 
413 private:
414 
416  friend class boost::serialization::access;
417  template<class ARCHIVE>
418  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
419  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
420  ar & BOOST_SERIALIZATION_NVP(cachedFactor_);
421  ar & BOOST_SERIALIZATION_NVP(gradientContribution_);
422  }
423 }; // \struct ISAM2Clique
424 
435 class GTSAM_EXPORT ISAM2: public BayesTree<ISAM2Clique> {
436 
437 protected:
438 
441 
444 
452 
453  mutable VectorValues deltaNewton_; // Only used when using Dogleg - stores the Gauss-Newton update
454  mutable VectorValues RgProd_; // Only used when using Dogleg - stores R*g and is updated incrementally
455 
464  mutable KeySet deltaReplacedMask_; // TODO: Make sure accessed in the right way
465 
468 
471 
474 
476  mutable boost::optional<double> doglegDelta_;
477 
481 
483 
484 public:
485 
486  typedef ISAM2 This;
491 
493  ISAM2(const ISAM2Params& params);
494 
496  ISAM2();
497 
499  virtual ~ISAM2() {}
500 
502  virtual bool equals(const ISAM2& other, double tol = 1e-9) const;
503 
532  virtual ISAM2Result update(const NonlinearFactorGraph& newFactors = NonlinearFactorGraph(),
533  const Values& newTheta = Values(),
534  const FactorIndices& removeFactorIndices = FactorIndices(),
535  const boost::optional<FastMap<Key,int> >& constrainedKeys = boost::none,
536  const boost::optional<FastList<Key> >& noRelinKeys = boost::none,
537  const boost::optional<FastList<Key> >& extraReelimKeys = boost::none,
538  bool force_relinearize = false);
539 
554  void marginalizeLeaves(const FastList<Key>& leafKeys,
555  boost::optional<FactorIndices&> marginalFactorsIndices = boost::none,
556  boost::optional<FactorIndices&> deletedFactorsIndices = boost::none);
557 
559  const Values& getLinearizationPoint() const {
560  return theta_;
561  }
562 
564  bool valueExists(Key key) const {
565  return theta_.exists(key);
566  }
567 
572  Values calculateEstimate() const;
573 
580  template<class VALUE>
581  VALUE calculateEstimate(Key key) const;
582 
590  const Value& calculateEstimate(Key key) const;
591 
593  Matrix marginalCovariance(Key key) const;
594 
597 
599  struct Impl;
600 
603  Values calculateBestEstimate() const;
604 
606  const VectorValues& getDelta() const;
607 
609  double error(const VectorValues& x) const;
610 
612  const NonlinearFactorGraph& getFactorsUnsafe() const { return nonlinearFactors_; }
613 
615  const VariableIndex& getVariableIndex() const { return variableIndex_; }
616 
618  const KeySet& getFixedVariables() const { return fixedVariables_; }
619 
620  size_t lastAffectedVariableCount;
621  size_t lastAffectedFactorCount;
622  size_t lastAffectedCliqueCount;
623  size_t lastAffectedMarkedCount;
624  mutable size_t lastBacksubVariableCount;
625  size_t lastNnzTop;
626 
627  const ISAM2Params& params() const { return params_; }
628 
630  void printStats() const { getCliqueData().getStats().print(); }
631 
638  VectorValues gradientAtZero() const;
639 
641 
642 protected:
643 
644  FastSet<Key> getAffectedFactors(const FastList<Key>& keys) const;
645  GaussianFactorGraph::shared_ptr relinearizeAffectedFactors(const FastList<Key>& affectedKeys, const KeySet& relinKeys) const;
646  GaussianFactorGraph getCachedBoundaryFactors(Cliques& orphans);
647 
648  virtual boost::shared_ptr<KeySet > recalculate(const KeySet& markedKeys, const KeySet& relinKeys,
649  const std::vector<Key>& observedKeys, const KeySet& unusedIndices, const boost::optional<FastMap<Key,int> >& constrainKeys, ISAM2Result& result);
650  void updateDelta(bool forceFullSolve = false) const;
651 
652 }; // ISAM2
653 
655 template<> struct traits<ISAM2> : public Testable<ISAM2> {};
656 
668 template<class CLIQUE>
669 size_t optimizeWildfire(const boost::shared_ptr<CLIQUE>& root,
670  double threshold, const KeySet& replaced, VectorValues& delta);
671 
672 template<class CLIQUE>
673 size_t optimizeWildfireNonRecursive(const boost::shared_ptr<CLIQUE>& root,
674  double threshold, const KeySet& replaced, VectorValues& delta);
675 
677 template<class CLIQUE>
678 int calculate_nnz(const boost::shared_ptr<CLIQUE>& clique);
679 
680 }
681 
ISAM2Params params_
The current parameters.
Definition: ISAM2.h:473
bool isAboveRelinThreshold
Whether the variable was just relinearized due to being above the relinearization threshold...
Definition: ISAM2.h:335
bool isNew
Whether the variable itself was just added.
Definition: ISAM2.h:339
double initialDelta
The initial trust region radius for Dogleg.
Definition: ISAM2.h:61
bool valueExists(Key key) const
Check whether variable with given key exists in linearization point.
Definition: ISAM2.h:564
Definition: ISAM2.h:269
void printStats() const
prints out clique statistics
Definition: ISAM2.h:630
Definition: ISAM2.h:36
virtual ~ISAM2()
default virtual destructor
Definition: ISAM2.h:499
bool enableDetailedResults
Whether to compute and return ISAM2Result::detailedResults, this can increase running time (default: ...
Definition: ISAM2.h:158
Incremental update functionality (ISAM2) for BayesTree, with fluid relinearization.
Base::sharedClique sharedClique
Shared pointer to a clique.
Definition: ISAM2.h:489
int calculate_nnz(const boost::shared_ptr< CLIQUE > &clique)
calculate the number of non-zero entries for the tree starting at clique (use root for complete matri...
Definition: ISAM2-inl.h:303
int relinearizeSkip
Only relinearize any variables every relinearizeSkip calls to ISAM2::update (default: 10) ...
Definition: ISAM2.h:132
FastMap< Key, VariableStatus > variableStatus
The status of each variable during this update, see VariableStatus.
Definition: ISAM2.h:347
bool isObserved
Whether the variable was relinearized, either by being above the relinearization threshold or by invo...
Definition: ISAM2.h:338
ISAM2Clique(const ISAM2Clique &other)
Copy constructor, does not copy solution pointers as these are invalid in different trees...
Definition: ISAM2.h:387
Definition: ISAM2-impl.h:25
std::pair< boost::shared_ptr< ConditionalType >, boost::shared_ptr< _FactorType > > EliminationResult
The pair of conditional and remaining factor produced by a single dense elimination step on a subgrap...
Definition: EliminateableFactorGraph.h:86
ISAM2GaussNewtonParams(double _wildfireThreshold=0.001)
Specify parameters as constructor arguments.
Definition: ISAM2.h:40
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:140
bool findUnusedFactorSlots
When you will be removing many factors, e.g.
Definition: ISAM2.h:170
Values theta_
The current linearization point.
Definition: ISAM2.h:440
A conditional Gaussian functions as the node in a Bayes network It has a set of parents y...
Definition: GaussianConditional.h:36
boost::variant< double, FastMap< char, Vector > > RelinearizationThreshold
Either a constant relinearization threshold or a per-variable-type set of thresholds.
Definition: ISAM2.h:105
size_t cliques
The number of cliques in the Bayes&#39; Tree.
Definition: ISAM2.h:316
void print(const std::string &str="") const
print iSAM2 parameters
Definition: ISAM2.h:190
Definition: FastList.h:38
bool verbose
Whether Dogleg prints iteration and convergence information.
Definition: ISAM2.h:64
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: ISAM2.h:67
bool enableRelinearization
Controls whether ISAM2 will ever relinearize any variables (default: true)
Definition: ISAM2.h:134
const Vector & gradientContribution() const
Access the gradient contribution.
Definition: ISAM2.h:406
bool evaluateNonlinearError
Whether to evaluate the nonlinear error before and after the update, to return in ISAM2Result from up...
Definition: ISAM2.h:136
boost::shared_ptr< Clique > sharedClique
Shared pointer to a clique.
Definition: BayesTree.h:72
boost::optional< DetailedResults > detail
Detailed results, if enabled by ISAM2Params::enableDetailedResults.
Definition: ISAM2.h:352
Definition: BayesTree.h:64
size_t factorsRecalculated
The number of factors that were included in reelimination of the Bayes&#39; tree.
Definition: ISAM2.h:313
Gaussian Bayes Tree, the result of eliminating a GaussianJunctionTree.
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
Base::FactorType::shared_ptr & cachedFactor()
Access the cached factor.
Definition: ISAM2.h:403
boost::optional< double > errorAfter
The nonlinear error of all of the factors computed after the current update, meaning that variables a...
Definition: ISAM2.h:292
FactorIndices newFactorsIndices
The indices of the newly-added factors, in 1-to-1 correspondence with the factors passed as newFactor...
Definition: ISAM2.h:322
ISAM2Clique()
Default constructor.
Definition: ISAM2.h:384
bool isRelinearizeInvolved
Whether the variable was below the relinearization threshold but was relinearized by being involved i...
Definition: ISAM2.h:336
VectorValues delta_
The linear delta from the last linear solution, an update to the estimate in theta.
Definition: ISAM2.h:451
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
bool exists(Key j) const
Check if a value exists with key j.
Definition: Values.cpp:97
Factorization factorization
Specifies whether to use QR or CHOESKY numerical factorization (default: CHOLESKY).
Definition: ISAM2.h:147
DoglegOptimizerImpl::TrustRegionAdaptationMode adaptationMode
See description in DoglegOptimizerImpl::TrustRegionAdaptationMode.
Definition: ISAM2.h:63
Definition: ISAM2.h:60
The VariableIndex class computes and stores the block column structure of a factor graph...
Definition: VariableIndex.h:42
GaussianFactorGraph linearFactors_
The current linear factors, which are only updated as needed.
Definition: ISAM2.h:470
size_t variablesRelinearized
The number of variables that were relinearized because their linear deltas exceeded the reslinearizat...
Definition: ISAM2.h:302
Template to create a binary predicate.
Definition: Testable.h:110
Incremental update functionality (ISAM2) for BayesTree, with fluid relinearization.
const VariableIndex & getVariableIndex() const
Access the nonlinear variable index.
Definition: ISAM2.h:615
RelinearizationThreshold relinearizeThreshold
Only relinearize variables whose linear delta magnitude is greater than this threshold (default: 0...
Definition: ISAM2.h:130
KeySet deltaReplacedMask_
A cumulative mask for the variables that were replaced and have not yet been updated in the linear so...
Definition: ISAM2.h:464
boost::optional< double > doglegDelta_
The current Dogleg Delta (trust region radius)
Definition: ISAM2.h:476
double wildfireThreshold
Continue updating the linear delta only when changes are above this threshold (default: 1e-5) ...
Definition: ISAM2.h:62
Nonlinear factor graph optimizer using Powell&#39;s Dogleg algorithm (detail implementation) ...
A struct holding detailed results, which must be enabled with ISAM2Params::enableDetailedResults.
Definition: ISAM2.h:327
const KeySet & getFixedVariables() const
Access the nonlinear variable index.
Definition: ISAM2.h:618
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianConditional.h:42
double wildfireThreshold
Continue updating the linear delta only when changes are above this threshold (default: 0...
Definition: ISAM2.h:37
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactorGraph.h:74
KeySet fixedVariables_
Set of variables that are involved with linear factors from marginalized variables and thus cannot ha...
Definition: ISAM2.h:480
bool enablePartialRelinearizationCheck
Check variables for relinearization in tree-order, stopping the check once a variable does not need t...
Definition: ISAM2.h:165
boost::variant< ISAM2GaussNewtonParams, ISAM2DoglegParams > OptimizationParams
Either ISAM2GaussNewtonParams or ISAM2DoglegParams.
Definition: ISAM2.h:104
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:90
TrustRegionAdaptationMode
Specifies how the trust region is adapted at each Dogleg iteration.
Definition: DoglegOptimizerImpl.h:53
size_t optimizeWildfire(const boost::shared_ptr< CLIQUE > &root, double threshold, const KeySet &keys, VectorValues &delta)
Optimize the BayesTree, starting from the root.
Definition: ISAM2-inl.h:254
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
const Values & getLinearizationPoint() const
Access the current linearization point.
Definition: ISAM2.h:559
const NonlinearFactorGraph & getFactorsUnsafe() const
Access the set of nonlinear factors.
Definition: ISAM2.h:612
Base::Clique Clique
A clique.
Definition: ISAM2.h:488
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:712
KeyFormatter keyFormatter
A KeyFormatter for when keys are printed during debugging (default: DefaultKeyFormatter) ...
Definition: ISAM2.h:156
boost::optional< double > errorBefore
The nonlinear error of all of the factors, including new factors and variables added during the curre...
Definition: ISAM2.h:281
VariableIndex variableIndex_
VariableIndex lets us look up factors by involved variable and keeps track of dimensions.
Definition: ISAM2.h:443
OptimizationParams optimizationParams
Optimization parameters, this both selects the nonlinear optimization method and specifies its parame...
Definition: ISAM2.h:113
A non-linear factor graph is a graph of non-Gaussian, i.e.
Definition: NonlinearFactorGraph.h:77
bool inRootClique
Whether the variable is in the root clique.
Definition: ISAM2.h:340
size_t variablesReeliminated
The number of variables that were reeliminated as parts of the Bayes&#39; Tree were recalculated, due to new factors.
Definition: ISAM2.h:310
BayesTree< ISAM2Clique > Base
The BayesTree base class.
Definition: ISAM2.h:487
size_t getVariablesRelinearized() const
Getters and Setters.
Definition: ISAM2.h:360
NonlinearFactorGraph nonlinearFactors_
All original nonlinear factors are stored here to use during relinearization.
Definition: ISAM2.h:467
Factor Graph Constsiting of non-linear factors.
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)
Specify parameters as constructor arguments.
Definition: ISAM2.h:173
Specialized Clique structure for ISAM2, incorporating caching and gradient contribution TODO: more do...
Definition: ISAM2.h:369
boost::function< EliminationResult(const FactorGraphType &, const Ordering &)> Eliminate
The function type that does a single dense elimination step on a subgraph.
Definition: EliminateableFactorGraph.h:89
ISAM2 This
This class.
Definition: ISAM2.h:486
Definition: ISAM2.h:103
ISAM2Clique & operator=(const ISAM2Clique &other)
Assignment operator, does not copy solution pointers as these are invalid in different trees...
Definition: ISAM2.h:391
The status of a single variable, this struct is stored in DetailedResults::variableStatus.
Definition: ISAM2.h:330
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition: GaussianFactorGraph.h:65
This is the interface class for any value that may be used as a variable assignment in a factor graph...
Definition: Value.h:83
int update_count_
Counter incremented every update(), used to determine periodic relinearization.
Definition: ISAM2.h:482
Base::Cliques Cliques
List of Clique typedef from base class.
Definition: ISAM2.h:490
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
This is the base class for BayesTree cliques.
Definition: BayesTreeCliqueBase.h:44
bool cacheLinearizedFactors
Whether to cache linear factors (default: true).
Definition: ISAM2.h:154
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
bool isReeliminated
Whether the variable was just reeliminated, due to being relinearized, observed, new, or on the path up to the root clique from another reeliminated variable.
Definition: ISAM2.h:334
Definition: FastMap.h:37