ConcurrentIncrementalSmoother.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 
19 // \callgraph
20 #pragma once
21 
23 #include <gtsam/nonlinear/ISAM2.h>
24 
25 namespace gtsam {
26 
30 class GTSAM_UNSTABLE_EXPORT ConcurrentIncrementalSmoother : public virtual ConcurrentSmoother {
31 
32 public:
33  typedef std::shared_ptr<ConcurrentIncrementalSmoother> shared_ptr;
35 
37  struct Result {
38  size_t iterations;
40  size_t linearVariables;
41  double error;
42 
44  Result() : iterations(0), nonlinearVariables(0), linearVariables(0), error(0) {}
45 
47  size_t getIterations() const { return iterations; }
48  size_t getNonlinearVariables() const { return nonlinearVariables; }
49  size_t getLinearVariables() const { return linearVariables; }
50  double getError() const { return error; }
51  };
52 
55 
58 
60  void print(const std::string& s = "Concurrent Incremental Smoother:\n", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const override;
61 
63  bool equals(const ConcurrentSmoother& rhs, double tol = 1e-9) const override;
64 
67  return isam2_.getFactorsUnsafe();
68  }
69 
71  const Values& getLinearizationPoint() const {
72  return isam2_.getLinearizationPoint();
73  }
74 
76  const VectorValues& getDelta() const {
77  return isam2_.getDelta();
78  }
79 
84  return isam2_.calculateEstimate();
85  }
86 
92  template<class VALUE>
94  return isam2_.calculateEstimate<VALUE>(key);
95  }
96 
111  Result update(const NonlinearFactorGraph& newFactors = NonlinearFactorGraph(), const Values& newTheta = Values(),
112  const std::optional<FactorIndices>& removeFactorIndices = {});
113 
118  void presync() override;
119 
126  void getSummarizedFactors(NonlinearFactorGraph& summarizedFactors, Values& separatorValues) override;
127 
137  void synchronize(const NonlinearFactorGraph& smootherFactors, const Values& smootherValues,
138  const NonlinearFactorGraph& summarizedFactors, const Values& separatorValues) override;
139 
144  void postsync() override;
145 
146 protected:
147 
149 
150  // Storage for information received from the filter during the last synchronization
157 
158  // Storage for information to be sent to the filter
160 
161 private:
162 
164  void updateSmootherSummarization();
165 
166 }; // ConcurrentBatchSmoother
167 
170 
172 template<>
173 struct traits<ConcurrentIncrementalSmoother> : public Testable<ConcurrentIncrementalSmoother> {
174 };
175 
176 } // \ namespace gtsam
gtsam::ConcurrentIncrementalSmoother::smootherValues_
Values smootherValues_
New variables to be added to the smoother during the next update.
Definition: ConcurrentIncrementalSmoother.h:152
gtsam::ISAM2Params
Definition: ISAM2Params.h:136
relicense.update
def update(text)
Definition: relicense.py:46
gtsam::ConcurrentIncrementalSmoother::filterSummarizationFactors_
NonlinearFactorGraph filterSummarizationFactors_
New filter summarization factors to replace the existing filter summarization during the next update.
Definition: ConcurrentIncrementalSmoother.h:153
gtsam::ConcurrentIncrementalSmoother::ConcurrentIncrementalSmoother
ConcurrentIncrementalSmoother(const ISAM2Params &parameters=ISAM2Params())
Definition: ConcurrentIncrementalSmoother.h:54
gtsam::ISAM2
Definition: ISAM2.h:45
gtsam::ConcurrentIncrementalSmoother::getDelta
const VectorValues & getDelta() const
Definition: ConcurrentIncrementalSmoother.h:76
gtsam::ConcurrentIncrementalSmoother::shared_ptr
std::shared_ptr< ConcurrentIncrementalSmoother > shared_ptr
Definition: ConcurrentIncrementalSmoother.h:33
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::synchronize
void synchronize(ConcurrentFilter &filter, ConcurrentSmoother &smoother)
Definition: ConcurrentFilteringAndSmoothing.cpp:28
Values
gtsam::ConcurrentIncrementalSmoother::Result::linearVariables
size_t linearVariables
The number of variables that must keep a constant linearization point.
Definition: ConcurrentIncrementalSmoother.h:40
gtsam::ConcurrentIncrementalSmoother::Result::Result
Result()
Constructor.
Definition: ConcurrentIncrementalSmoother.h:44
gtsam::ConcurrentIncrementalSmoother::getLinearizationPoint
const Values & getLinearizationPoint() const
Definition: ConcurrentIncrementalSmoother.h:71
gtsam::ConcurrentIncrementalSmoother
Definition: ConcurrentIncrementalSmoother.h:30
gtsam::ConcurrentIncrementalSmoother::getFactors
const NonlinearFactorGraph & getFactors() const
Definition: ConcurrentIncrementalSmoother.h:66
gtsam::DefaultKeyFormatter
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition: Key.cpp:30
gtsam::ConcurrentIncrementalSmoother::Result::error
double error
The final factor graph error.
Definition: ConcurrentIncrementalSmoother.h:41
gtsam::ConcurrentIncrementalSmoother::synchronizationUpdatesAvailable_
bool synchronizationUpdatesAvailable_
Flag indicating the currently stored synchronization updates have not been applied yet.
Definition: ConcurrentIncrementalSmoother.h:156
gtsam::ConcurrentIncrementalSmoother::Result
Definition: ConcurrentIncrementalSmoother.h:37
Eigen::internal::VALUE
@ VALUE
Definition: SpecialFunctionsImpl.h:729
gtsam::ConcurrentIncrementalSmootherResult
ConcurrentIncrementalSmoother::Result ConcurrentIncrementalSmootherResult
Typedef for Matlab wrapping.
Definition: ConcurrentIncrementalSmoother.h:169
gtsam::print
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
gtsam::ConcurrentIncrementalSmoother::separatorValues_
Values separatorValues_
The linearization points of the separator variables. These should not be changed during optimization.
Definition: ConcurrentIncrementalSmoother.h:154
gtsam::VectorValues
Definition: VectorValues.h:74
gtsam::ConcurrentIncrementalSmoother::smootherSummarization_
NonlinearFactorGraph smootherSummarization_
A temporary holding place for calculated smoother summarization.
Definition: ConcurrentIncrementalSmoother.h:159
gtsam::ConcurrentIncrementalSmoother::Result::iterations
size_t iterations
The number of optimizer iterations performed.
Definition: ConcurrentIncrementalSmoother.h:38
gtsam::KeyFormatter
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
gtsam::ConcurrentSmoother
Definition: ConcurrentFilteringAndSmoothing.h:101
parameters
static ConjugateGradientParameters parameters
Definition: testIterative.cpp:33
gtsam::NonlinearFactorGraph
Definition: NonlinearFactorGraph.h:55
gtsam::ConcurrentIncrementalSmoother::isam2_
ISAM2 isam2_
iSAM2 inference engine
Definition: ConcurrentIncrementalSmoother.h:148
gtsam::equals
Definition: Testable.h:112
key
const gtsam::Symbol key('X', 0)
gtsam::ConcurrentIncrementalSmoother::~ConcurrentIncrementalSmoother
~ConcurrentIncrementalSmoother() override
Definition: ConcurrentIncrementalSmoother.h:57
ISAM2.h
Incremental update functionality (ISAM2) for BayesTree, with fluid relinearization.
gtsam::ConcurrentIncrementalSmoother::filterSummarizationSlots_
FactorIndices filterSummarizationSlots_
The slots in factor graph that correspond to the current filter summarization factors.
Definition: ConcurrentIncrementalSmoother.h:155
Values
std::vector< float > Values
Definition: sparse_setter.cpp:45
gtsam
traits
Definition: chartTesting.h:28
gtsam::Testable
Definition: Testable.h:152
error
static double error
Definition: testRot3.cpp:37
gtsam::traits
Definition: Group.h:36
gtsam::ConcurrentIncrementalSmoother::calculateEstimate
VALUE calculateEstimate(Key key) const
Definition: ConcurrentIncrementalSmoother.h:93
gtsam::Values
Definition: Values.h:65
gtsam::ConcurrentIncrementalSmoother::smootherFactors_
NonlinearFactorGraph smootherFactors_
New factors to be added to the smoother during the next update.
Definition: ConcurrentIncrementalSmoother.h:151
ConcurrentFilteringAndSmoothing.h
Base classes for the 'filter' and 'smoother' portion of the Concurrent Filtering and Smoothing archit...
gtsam::ConcurrentIncrementalSmoother::Result::nonlinearVariables
size_t nonlinearVariables
The number of variables that can be relinearized.
Definition: ConcurrentIncrementalSmoother.h:39
gtsam::ConcurrentIncrementalSmoother::calculateEstimate
Values calculateEstimate() const
Definition: ConcurrentIncrementalSmoother.h:83
gtsam::ConcurrentIncrementalSmoother::Result::getLinearVariables
size_t getLinearVariables() const
Definition: ConcurrentIncrementalSmoother.h:49
gtsam::tol
const G double tol
Definition: Group.h:79
gtsam::ConcurrentIncrementalSmoother::Result::getIterations
size_t getIterations() const
Getter methods.
Definition: ConcurrentIncrementalSmoother.h:47
gtsam::ConcurrentIncrementalSmoother::Result::getNonlinearVariables
size_t getNonlinearVariables() const
Definition: ConcurrentIncrementalSmoother.h:48
gtsam::ConcurrentIncrementalSmoother::Result::getError
double getError() const
Definition: ConcurrentIncrementalSmoother.h:50
gtsam::ConcurrentIncrementalSmoother::Base
ConcurrentSmoother Base
typedef for base class
Definition: ConcurrentIncrementalSmoother.h:34
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
gtsam::Result
std::pair< std::shared_ptr< GaussianConditional >, GaussianMixtureFactor::sharedFactor > Result
Definition: HybridGaussianFactorGraph.cpp:280
gtsam::FactorIndices
FastVector< FactorIndex > FactorIndices
Define collection types:
Definition: Factor.h:36


gtsam
Author(s):
autogenerated on Thu Jun 13 2024 03:01:57