gtsam  4.0.0
gtsam
SubgraphSolver.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 
20 #pragma once
21 
24 
25 #include <map>
26 #include <utility> // pair
27 
28 namespace gtsam {
29 
30 // Forward declarations
31 class GaussianFactorGraph;
32 class GaussianBayesNet;
33 class SubgraphPreconditioner;
34 
35 struct GTSAM_EXPORT SubgraphSolverParameters
37  SubgraphBuilderParameters builderParams;
39  : builderParams(p) {}
40  void print() const { Base::print(); }
41  virtual void print(std::ostream &os) const {
42  Base::print(os);
43  }
44 };
45 
76 class GTSAM_EXPORT SubgraphSolver : public IterativeSolver {
77  public:
79 
80  protected:
81  Parameters parameters_;
82  boost::shared_ptr<SubgraphPreconditioner> pc_;
83 
84  public:
87 
93  SubgraphSolver(const GaussianFactorGraph &A, const Parameters &parameters,
94  const Ordering &ordering);
95 
103  const boost::shared_ptr<GaussianFactorGraph> &Ab2,
104  const Parameters &parameters, const Ordering &ordering);
109  SubgraphSolver(const boost::shared_ptr<GaussianBayesNet> &Rc1,
110  const boost::shared_ptr<GaussianFactorGraph> &Ab2,
111  const Parameters &parameters);
112 
114  virtual ~SubgraphSolver() {}
115 
119 
121  VectorValues optimize() const;
122 
125  const KeyInfo &keyInfo,
126  const std::map<Key, Vector> &lambda,
127  const VectorValues &initial) override;
128 
132 
134  std::pair < boost::shared_ptr<GaussianFactorGraph>,
135  boost::shared_ptr<GaussianFactorGraph> > splitGraph(
136  const GaussianFactorGraph &gfg);
137 
139 
140 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4
141  SubgraphSolver(const boost::shared_ptr<GaussianFactorGraph> &A,
144  const Parameters &parameters, const Ordering &ordering)
145  : SubgraphSolver(*A, parameters, ordering) {}
146  SubgraphSolver(const GaussianFactorGraph &, const GaussianFactorGraph &,
147  const Parameters &, const Ordering &);
148  SubgraphSolver(const boost::shared_ptr<GaussianFactorGraph> &Ab1,
149  const boost::shared_ptr<GaussianFactorGraph> &Ab2,
150  const Parameters &parameters, const Ordering &ordering)
151  : SubgraphSolver(*Ab1, Ab2, parameters, ordering) {}
152  SubgraphSolver(const boost::shared_ptr<GaussianBayesNet> &,
153  const GaussianFactorGraph &, const Parameters &);
155 #endif
156 };
157 
158 } // namespace gtsam
parameters for the conjugate gradient method
Definition: ConjugateGradientSolver.h:29
Base class for Iterative Solvers like SubgraphSolver.
Definition: IterativeSolver.h:86
Point3 optimize(const NonlinearFactorGraph &graph, const Values &values, Key landmarkKey)
Optimize for triangulation.
Definition: triangulation.cpp:73
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
Definition: SubgraphSolver.h:35
virtual ~SubgraphSolver()
Destructor.
Definition: SubgraphSolver.h:114
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition: GaussianFactorGraph.h:65
Handy data structure for iterative solvers.
Definition: IterativeSolver.h:126
This class represents a collection of vector-valued variables associated each with a unique integer i...
Definition: VectorValues.h:73
Implementation of Conjugate Gradient solver for a linear system.
Definition: SubgraphBuilder.h:95
This class implements the linear SPCG solver presented in Dellaert et al in IROS'10.
Definition: SubgraphSolver.h:76
boost::shared_ptr< SubgraphPreconditioner > pc_
preconditioner object
Definition: SubgraphSolver.h:82
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Definition: Ordering.h:34