gtsam 4.1.1
gtsam
DoglegOptimizer.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
22
23namespace gtsam {
24
25class DoglegOptimizer;
26
32class GTSAM_EXPORT DoglegParams : public NonlinearOptimizerParams {
33public:
36 SILENT,
37 VERBOSE
38 };
39
40 double deltaInitial;
42
43 DoglegParams() :
44 deltaInitial(1.0), verbosityDL(SILENT) {}
45
46 ~DoglegParams() override {}
47
48 void print(const std::string& str = "") const override {
49 NonlinearOptimizerParams::print(str);
50 std::cout << " deltaInitial: " << deltaInitial << "\n";
51 std::cout.flush();
52 }
53
54 double getDeltaInitial() const { return deltaInitial; }
55 std::string getVerbosityDL() const { return verbosityDLTranslator(verbosityDL); }
56
57 void setDeltaInitial(double deltaInitial) { this->deltaInitial = deltaInitial; }
58 void setVerbosityDL(const std::string& verbosityDL) { this->verbosityDL = verbosityDLTranslator(verbosityDL); }
59
60private:
61 VerbosityDL verbosityDLTranslator(const std::string& verbosityDL) const;
62 std::string verbosityDLTranslator(VerbosityDL verbosityDL) const;
63};
64
68class GTSAM_EXPORT DoglegOptimizer : public NonlinearOptimizer {
69
70protected:
71 DoglegParams params_;
72
73public:
74 typedef boost::shared_ptr<DoglegOptimizer> shared_ptr;
75
78
87 DoglegOptimizer(const NonlinearFactorGraph& graph, const Values& initialValues,
88 const DoglegParams& params = DoglegParams());
89
97 DoglegOptimizer(const NonlinearFactorGraph& graph, const Values& initialValues,
98 const Ordering& ordering);
99
101
104
106 ~DoglegOptimizer() override {}
107
112 GaussianFactorGraph::shared_ptr iterate() override;
113
115 const DoglegParams& params() const { return params_; }
116
118 double getDelta() const;
119
121
122protected:
124 const NonlinearOptimizerParams& _params() const override { return params_; }
125
127 DoglegParams ensureHasOrdering(DoglegParams params, const NonlinearFactorGraph& graph) const;
128};
129
130}
Base class and parameters for nonlinear optimization algorithms.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:155
Definition: Ordering.h:34
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactorGraph.h:75
Parameters for Levenberg-Marquardt optimization.
Definition: DoglegOptimizer.h:32
VerbosityDL
See DoglegParams::dlVerbosity.
Definition: DoglegOptimizer.h:35
VerbosityDL verbosityDL
The verbosity level for Dogleg (default: SILENT), see also NonlinearOptimizerParams::verbosity.
Definition: DoglegOptimizer.h:41
double deltaInitial
The initial trust region radius (default: 10.0)
Definition: DoglegOptimizer.h:40
This class performs Dogleg nonlinear optimization.
Definition: DoglegOptimizer.h:68
~DoglegOptimizer() override
Virtual destructor.
Definition: DoglegOptimizer.h:106
const NonlinearOptimizerParams & _params() const override
Access the parameters (base class version)
Definition: DoglegOptimizer.h:124
const DoglegParams & params() const
Read-only access the parameters.
Definition: DoglegOptimizer.h:115
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
The common parameters for Nonlinear optimizers.
Definition: NonlinearOptimizerParams.h:34
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:63