gtsam
Loading...
Searching...
No Matches
IterativeSolver.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
18
19#pragma once
20
21#include <gtsam/base/Vector.h>
23
24#include <memory>
25
26#include <iosfwd>
27#include <string>
28#include <map>
29#include <optional>
30
31namespace gtsam {
32
33// Forward declarations
35class Values;
36class VectorValues;
37
41class IterativeOptimizationParameters {
42 public:
43 typedef std::shared_ptr<IterativeOptimizationParameters> shared_ptr;
44 enum Verbosity { SILENT = 0, COMPLEXITY, ERROR };
45
46 protected:
47 Verbosity verbosity_;
48
49 public:
50
51 IterativeOptimizationParameters(Verbosity v = SILENT) :
52 verbosity_(v) {
53 }
54
55 virtual ~IterativeOptimizationParameters() {
56 }
57
58 /* utility */
59 inline Verbosity verbosity() const {
60 return verbosity_;
61 }
62 GTSAM_EXPORT std::string getVerbosity() const;
63 GTSAM_EXPORT void setVerbosity(const std::string &s);
64
65 /* matlab interface */
66 GTSAM_EXPORT void print() const;
67
68 /* virtual print function */
69 GTSAM_EXPORT virtual void print(std::ostream &os) const;
70
71 GTSAM_EXPORT virtual bool equals(const IterativeOptimizationParameters &other,
72 double tol = 1e-9) const;
73
74 /* for serialization */
75 GTSAM_EXPORT friend std::ostream &operator<<(
76 std::ostream &os, const IterativeOptimizationParameters &p);
77
78 GTSAM_EXPORT static Verbosity verbosityTranslator(const std::string &s);
79 GTSAM_EXPORT static std::string verbosityTranslator(Verbosity v);
80};
81
85class IterativeSolver {
86public:
87 typedef std::shared_ptr<IterativeSolver> shared_ptr;
88 IterativeSolver() {
89 }
90 virtual ~IterativeSolver() {
91 }
92
93 /* interface to the nonlinear optimizer, without metadata, damping and initial estimate */
94 GTSAM_EXPORT VectorValues optimize(const GaussianFactorGraph &gfg,
95 const KeyInfo* = nullptr,
96 const std::map<Key, Vector>* lambda = nullptr);
97
98 /* interface to the nonlinear optimizer, without initial estimate */
99 GTSAM_EXPORT VectorValues optimize(const GaussianFactorGraph &gfg, const KeyInfo &keyInfo,
100 const std::map<Key, Vector> &lambda);
101
102 /* interface to the nonlinear optimizer that the subclasses have to implement */
103 virtual VectorValues optimize(const GaussianFactorGraph &gfg,
104 const KeyInfo &keyInfo, const std::map<Key, Vector> &lambda,
105 const VectorValues &initial) = 0;
106
107};
108
109} // \ namespace gtsam
typedef and functions to augment Eigen's VectorXd
Ordered key dimensions and scalar offsets.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition GaussianFactorGraph.h:77
Ordered key dimensions and offsets in one flattened variable vector.
Definition KeyInfo.h:51
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:73
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65