gtsam 4.1.1
gtsam
NonlinearOptimizer.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#pragma once
20
23
24namespace gtsam {
25
26namespace internal { struct NonlinearOptimizerState; }
27
75class GTSAM_EXPORT NonlinearOptimizer {
76
77protected:
79
80 std::unique_ptr<internal::NonlinearOptimizerState> state_;
81
82public:
84 using shared_ptr = boost::shared_ptr<const NonlinearOptimizer>;
85
88
98 virtual const Values& optimize() { defaultOptimize(); return values(); }
99
106 const Values& optimizeSafely();
107
109 double error() const;
110
112 size_t iterations() const;
113
115 const Values &values() const;
116
118 const NonlinearFactorGraph &graph() const { return graph_; }
119
121
124
126 virtual ~NonlinearOptimizer();
127
129 virtual VectorValues solve(const GaussianFactorGraph &gfg,
130 const NonlinearOptimizerParams& params) const;
131
137
139
140protected:
144 void defaultOptimize();
145
146 virtual const NonlinearOptimizerParams& _params() const = 0;
147
150 std::unique_ptr<internal::NonlinearOptimizerState> state);
151};
152
157GTSAM_EXPORT bool checkConvergence(double relativeErrorTreshold,
158 double absoluteErrorTreshold, double errorThreshold,
159 double currentError, double newError, NonlinearOptimizerParams::Verbosity verbosity = NonlinearOptimizerParams::SILENT);
160
161GTSAM_EXPORT bool checkConvergence(const NonlinearOptimizerParams& params, double currentError,
162 double newError);
163
164} // gtsam
Parameters for nonlinear optimization.
Factor Graph consisting of non-linear factors.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
bool checkConvergence(double relativeErrorTreshold, double absoluteErrorTreshold, double errorThreshold, double currentError, double newError, NonlinearOptimizerParams::Verbosity verbosity)
Check whether the relative error decrease is less than relativeErrorTreshold, the absolute error decr...
Definition: NonlinearOptimizer.cpp:185
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition: GaussianFactorGraph.h:69
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactorGraph.h:75
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:74
A non-linear factor graph is a graph of non-Gaussian, i.e.
Definition: NonlinearFactorGraph.h:78
This is the abstract interface for classes that can optimize for the maximum-likelihood estimate of a...
Definition: NonlinearOptimizer.h:75
const NonlinearFactorGraph & graph() const
return the graph with nonlinear factors
Definition: NonlinearOptimizer.h:118
NonlinearFactorGraph graph_
The graph with nonlinear factors.
Definition: NonlinearOptimizer.h:78
virtual const Values & optimize()
Optimize for the maximum-likelihood estimate, returning a the optimized variable assignments.
Definition: NonlinearOptimizer.h:98
std::unique_ptr< internal::NonlinearOptimizerState > state_
PIMPL'd state.
Definition: NonlinearOptimizer.h:80
boost::shared_ptr< const NonlinearOptimizer > shared_ptr
A shared pointer to this class.
Definition: NonlinearOptimizer.h:84
virtual GaussianFactorGraph::shared_ptr iterate()=0
Perform a single iteration, returning GaussianFactorGraph corresponding to the linearized factor grap...
The common parameters for Nonlinear optimizers.
Definition: NonlinearOptimizerParams.h:34
Verbosity
See NonlinearOptimizerParams::verbosity.
Definition: NonlinearOptimizerParams.h:37
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:63