34 typedef std::shared_ptr<ConcurrentBatchFilter> shared_ptr;
57 size_t getLambdas()
const {
return lambdas; }
58 size_t getNonlinearVariables()
const {
return nonlinearVariables; }
59 size_t getLinearVariables()
const {
return linearVariables; }
60 double getError()
const {
return error; }
107 template<
class VALUE>
109 const Vector delta =
delta_.at(key);
110 return theta_.at<VALUE>(key).retract(delta);
127 const std::optional<
FastList<Key> >& keysToMove = {},
const std::optional< std::vector<size_t> >& removeFactorIndices = {});
133 void presync()
override;
142 void getSummarizedFactors(NonlinearFactorGraph& filterSummarization, Values& filterSummarizationValues)
override;
152 void getSmootherFactors(NonlinearFactorGraph& smootherFactors, Values& smootherValues)
override;
159 void synchronize(
const NonlinearFactorGraph& smootherSummarization,
const Values& smootherSummarizationValues)
override;
165 void postsync()
override;
200 void removeFactors(
const std::vector<size_t>& slots);
203 void reorder(
const std::optional<
FastList<Key> >& keysToMove = {});
218 static void PrintNonlinearFactor(
const NonlinearFactor::shared_ptr& factor,
226 static void PrintNonlinearFactorGraph(
const NonlinearFactorGraph& factors,
const std::vector<size_t>& slots,
238 template<
class Container>
239 static void PrintKeys(
const Container& keys,
const std::string& indent,
const std::string& title,
const KeyFormatter& keyFormatter =
DefaultKeyFormatter);
244template<
class Container>
245void ConcurrentBatchFilter::PrintKeys(
const Container& keys,
const std::string& indent,
const std::string& title,
const KeyFormatter& keyFormatter) {
246 std::cout << indent << title;
248 std::cout <<
" " << keyFormatter(key);
250 std::cout << std::endl;
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Base classes for the 'filter' and 'smoother' portion of the Concurrent Filtering and Smoothing archit...
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
ConcurrentBatchFilter::Result ConcurrentBatchFilterResult
Typedef for Matlab wrapping.
Definition ConcurrentBatchFilter.h:254
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition triangulation.cpp:178
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
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
FastList is a thin wrapper around std::list that uses the boost fast_pool_allocator instead of the de...
Definition FastList.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition GaussianFactor.h:42
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition GaussianFactorGraph.h:77
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:73
Parameters for Levenberg-Marquardt optimization.
Definition LevenbergMarquardtParams.h:36
Definition NonlinearFactorGraph.h:57
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65
A Levenberg-Marquardt Batch Filter that implements the Concurrent Filtering and Smoother interface.
Definition ConcurrentBatchFilter.h:31
VALUE calculateEstimate(Key key) const
Compute the current best estimate of a single variable.
Definition ConcurrentBatchFilter.h:108
std::vector< size_t > separatorSummarizationSlots_
The slots in factor graph that correspond to the current smoother summarization on the current separa...
Definition ConcurrentBatchFilter.h:176
const VectorValues & getDelta() const
Access the current set of deltas to the linearization point.
Definition ConcurrentBatchFilter.h:91
NonlinearFactorGraph factors_
The set of all factors currently in the filter.
Definition ConcurrentBatchFilter.h:170
LevenbergMarquardtParams parameters_
LM parameters.
Definition ConcurrentBatchFilter.h:169
Values theta_
Current linearization point of all variables in the filter.
Definition ConcurrentBatchFilter.h:171
NonlinearFactorGraph filterSummarization_
A temporary holding place for calculated filter summarization factors to be sent to the smoother.
Definition ConcurrentBatchFilter.h:183
~ConcurrentBatchFilter() override=default
Default destructor.
ConcurrentFilter Base
typedef for base class
Definition ConcurrentBatchFilter.h:35
NonlinearFactorGraph smootherSummarization_
The smoother summarization on the old separator sent by the smoother during the last synchronization.
Definition ConcurrentBatchFilter.h:179
bool equals(const ConcurrentFilter &rhs, double tol=1e-9) const override
Check if two Concurrent Filters are equal.
Definition ConcurrentBatchFilter.cpp:107
Values smootherValues_
A temporary holding place for the linearization points of all keys being sent to the smoother.
Definition ConcurrentBatchFilter.h:185
void print(const std::string &s="Concurrent Batch Filter:\n", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Implement a GTSAM standard 'print' function.
Definition ConcurrentBatchFilter.cpp:98
const Ordering & getOrdering() const
Access the current ordering.
Definition ConcurrentBatchFilter.h:86
VectorValues delta_
The current set of linear deltas from the linearization point.
Definition ConcurrentBatchFilter.h:173
const NonlinearFactorGraph & getFactors() const
Access the current set of factors.
Definition ConcurrentBatchFilter.h:76
Values calculateEstimate() const
Compute the current best estimate of all variables and return a full Values structure.
Definition ConcurrentBatchFilter.h:98
std::queue< size_t > availableSlots_
The set of available factor graph slots caused by deleting factors.
Definition ConcurrentBatchFilter.h:174
ConcurrentBatchFilter(const LevenbergMarquardtParams ¶meters=LevenbergMarquardtParams())
Default constructor.
Definition ConcurrentBatchFilter.h:64
Ordering ordering_
The current ordering used to calculate the linear deltas.
Definition ConcurrentBatchFilter.h:172
NonlinearFactorGraph smootherFactors_
A temporary holding place for the set of full nonlinear factors being sent to the smoother.
Definition ConcurrentBatchFilter.h:184
NonlinearFactorGraph smootherShortcut_
A set of conditional factors from the old separator to the current separator (recursively calculated ...
Definition ConcurrentBatchFilter.h:180
Values separatorValues_
The linearization points of the separator variables. These should not be updated during optimization.
Definition ConcurrentBatchFilter.h:175
const Values & getLinearizationPoint() const
Access the current linearization point.
Definition ConcurrentBatchFilter.h:81
Meta information returned about the update.
Definition ConcurrentBatchFilter.h:38
size_t lambdas
The number of different L-M lambda factors that were tried during optimization.
Definition ConcurrentBatchFilter.h:40
double error
The final factor graph error.
Definition ConcurrentBatchFilter.h:50
size_t nonlinearVariables
The number of variables that can be relinearized.
Definition ConcurrentBatchFilter.h:41
std::vector< size_t > newFactorsIndices
The indices of the newly-added factors, in 1-to-1 correspondence with the factors passed as newFactor...
Definition ConcurrentBatchFilter.h:48
size_t getIterations() const
Getter methods.
Definition ConcurrentBatchFilter.h:56
size_t iterations
The number of optimizer iterations performed.
Definition ConcurrentBatchFilter.h:39
Result()
Constructor.
Definition ConcurrentBatchFilter.h:53
size_t linearVariables
The number of variables that must keep a constant linearization point.
Definition ConcurrentBatchFilter.h:42
ConcurrentFilter()=default
Default constructor.