gtsam  4.0.0
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 
23 namespace gtsam {
24 
25 class DoglegOptimizer;
26 
32 class GTSAM_EXPORT DoglegParams : public NonlinearOptimizerParams {
33 public:
35  enum VerbosityDL {
36  SILENT,
37  VERBOSE
38  };
39 
40  double deltaInitial;
42 
43  DoglegParams() :
44  deltaInitial(10.0), verbosityDL(SILENT) {}
45 
46  virtual ~DoglegParams() {}
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 
60 private:
61  VerbosityDL verbosityDLTranslator(const std::string& verbosityDL) const;
62  std::string verbosityDLTranslator(VerbosityDL verbosityDL) const;
63 };
64 
68 class GTSAM_EXPORT DoglegOptimizer : public NonlinearOptimizer {
69 
70 protected:
71  DoglegParams params_;
72 
73 public:
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  virtual ~DoglegOptimizer() {}
107 
112  GaussianFactorGraph::shared_ptr iterate() override;
113 
115  const DoglegParams& params() const { return params_; }
116 
118  double getDelta() const;
119 
121 
122 protected:
124  virtual const NonlinearOptimizerParams& _params() const override { return params_; }
125 
127  DoglegParams ensureHasOrdering(DoglegParams params, const NonlinearFactorGraph& graph) const;
128 };
129 
130 }
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
This is the abstract interface for classes that can optimize for the maximum-likelihood estimate of a...
Definition: NonlinearOptimizer.h:75
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactorGraph.h:74
VerbosityDL
See DoglegParams::dlVerbosity.
Definition: DoglegOptimizer.h:35
double deltaInitial
The initial trust region radius (default: 10.0)
Definition: DoglegOptimizer.h:40
virtual ~DoglegOptimizer()
Virtual destructor.
Definition: DoglegOptimizer.h:106
Base class and parameters for nonlinear optimization algorithms.
This class performs Dogleg nonlinear optimization.
Definition: DoglegOptimizer.h:68
virtual const NonlinearOptimizerParams & _params() const override
Access the parameters (base class version)
Definition: DoglegOptimizer.h:124
Parameters for Levenberg-Marquardt optimization.
Definition: DoglegOptimizer.h:32
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:77
VerbosityDL verbosityDL
The verbosity level for Dogleg (default: SILENT), see also NonlinearOptimizerParams::verbosity.
Definition: DoglegOptimizer.h:41
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
The common parameters for Nonlinear optimizers.
Definition: NonlinearOptimizerParams.h:34
Definition: Ordering.h:34