LevenbergMarquardtOptimizer.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 
21 #pragma once
22 
26 #include <chrono>
27 
28 class NonlinearOptimizerMoreOptimizationTest;
29 
30 namespace gtsam {
31 
35 class GTSAM_EXPORT LevenbergMarquardtOptimizer: public NonlinearOptimizer {
36 
37 protected:
39 
40  // startTime_ is a chrono time point
41  std::chrono::time_point<std::chrono::high_resolution_clock> startTime_;
42 
43  void initTime();
44 
45 public:
46  typedef std::shared_ptr<LevenbergMarquardtOptimizer> shared_ptr;
47 
50 
59  LevenbergMarquardtOptimizer(const NonlinearFactorGraph& graph, const Values& initialValues,
61 
69  LevenbergMarquardtOptimizer(const NonlinearFactorGraph& graph, const Values& initialValues,
70  const Ordering& ordering,
72 
75  }
76 
78 
81 
83  double lambda() const;
84 
86  int getInnerIterations() const;
87 
89  void print(const std::string& str = "") const {
90  std::cout << str << "LevenbergMarquardtOptimizer" << std::endl;
91  this->params_.print(" parameters:\n");
92  }
93 
95 
98 
103  GaussianFactorGraph::shared_ptr iterate() override;
104 
107  return params_;
108  }
109 
110  void writeLogFile(double currentError);
111 
113  virtual GaussianFactorGraph::shared_ptr linearize() const;
114 
116  GaussianFactorGraph buildDampedSystem(const GaussianFactorGraph& linear,
117  const VectorValues& sqrtHessianDiagonal) const;
118 
120  bool tryLambda(const GaussianFactorGraph& linear, const VectorValues& sqrtHessianDiagonal);
121 
123 
124 protected:
125 
127  const NonlinearOptimizerParams& _params() const override {
128  return params_;
129  }
130 };
131 
132 }
gtsam::GaussianFactorGraph::shared_ptr
std::shared_ptr< This > shared_ptr
shared_ptr to this class
Definition: GaussianFactorGraph.h:82
gtsam::LevenbergMarquardtOptimizer::params
const LevenbergMarquardtParams & params() const
Definition: LevenbergMarquardtOptimizer.h:106
NonlinearOptimizer.h
Base class and parameters for nonlinear optimization algorithms.
vanilla::params
static const SmartProjectionParams params
Definition: smartFactorScenarios.h:69
LevenbergMarquardtParams.h
Parameters for Levenberg-Marquardt trust-region scheme.
gtsam::LevenbergMarquardtOptimizer::startTime_
std::chrono::time_point< std::chrono::high_resolution_clock > startTime_
time when optimization started
Definition: LevenbergMarquardtOptimizer.h:41
gtsam::LevenbergMarquardtOptimizer::_params
const NonlinearOptimizerParams & _params() const override
Definition: LevenbergMarquardtOptimizer.h:127
gtsam::LevenbergMarquardtOptimizer::params_
const LevenbergMarquardtParams params_
LM parameters.
Definition: LevenbergMarquardtOptimizer.h:38
gtsam::GaussianFactorGraph
Definition: GaussianFactorGraph.h:73
gtsam::NonlinearOptimizerParams
Definition: NonlinearOptimizerParams.h:35
gtsam::VectorValues
Definition: VectorValues.h:74
gtsam::NonlinearFactorGraph
Definition: NonlinearFactorGraph.h:55
gtsam::LevenbergMarquardtOptimizer
Definition: LevenbergMarquardtOptimizer.h:35
VectorValues.h
Factor Graph Values.
lambda
static double lambda[]
Definition: jv.c:524
ordering
static enum @1096 ordering
str
Definition: pytypes.h:1558
gtsam
traits
Definition: SFMdata.h:40
gtsam::LevenbergMarquardtParams::print
void print(const std::string &str="") const override
Definition: LevenbergMarquardtParams.cpp:93
gtsam::NonlinearOptimizer
Definition: NonlinearOptimizer.h:75
gtsam::Values
Definition: Values.h:65
gtsam::LevenbergMarquardtParams
Definition: LevenbergMarquardtParams.h:35
gtsam::LevenbergMarquardtOptimizer::print
void print(const std::string &str="") const
print
Definition: LevenbergMarquardtOptimizer.h:89
graph
NonlinearFactorGraph graph
Definition: doc/Code/OdometryExample.cpp:2
gtsam::Ordering
Definition: inference/Ordering.h:33
gtsam::LevenbergMarquardtOptimizer::~LevenbergMarquardtOptimizer
~LevenbergMarquardtOptimizer() override
Definition: LevenbergMarquardtOptimizer.h:74
gtsam::LevenbergMarquardtOptimizer::shared_ptr
std::shared_ptr< LevenbergMarquardtOptimizer > shared_ptr
Definition: LevenbergMarquardtOptimizer.h:46


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:42