gtsam  4.0.0
gtsam
gtsam::SubgraphSolver Class Reference

Detailed Description

This class implements the SPCG solver presented in Dellaert et al in IROS'10.

Given a linear least-squares problem \( f(x) = |A x - b|^2 \). We split the problem into \( f(x) = |A_t - b_t|^2 + |A_c - b_c|^2 \) where \( A_t \) denotes the "tree" part, and \( A_c \) denotes the "constraint" part. \( A_t \) is factorized into \( Q_t R_t \), and we compute \( c_t = Q_t^{-1} b_t \), and \( x_t = R_t^{-1} c_t \) accordingly. Then we solve a reparametrized problem \( f(y) = |y|^2 + |A_c R_t^{-1} y - \bar{b_y}|^2 \), where \( y = R_t(x - x_t) \), and \( \bar{b_y} = (b_c - A_c x_t) \)

In the matrix form, it is equivalent to solving \( [A_c R_t^{-1} ; I ] y = [\bar{b_y} ; 0] \). We can solve it with the least-squares variation of the conjugate gradient method.

To use it in nonlinear optimization, please see the following example

LevenbergMarquardtParams parameters; parameters.linearSolverType = NonlinearOptimizerParams::CONJUGATE_GRADIENT; parameters.iterativeParams = boost::make_shared<SubgraphSolverParameters>(); LevenbergMarquardtOptimizer optimizer(graph, initialEstimate, parameters); Values result = optimizer.optimize();

+ Inheritance diagram for gtsam::SubgraphSolver:

Public Member Functions

 SubgraphSolver (const GaussianFactorGraph &A, const Parameters &parameters, const Ordering &ordering)
 Given a gaussian factor graph, split it into a spanning tree (A1) + others (A2) for SPCG.
 
 SubgraphSolver (const boost::shared_ptr< GaussianFactorGraph > &A, const Parameters &parameters, const Ordering &ordering)
 Shared pointer version.
 
 SubgraphSolver (const GaussianFactorGraph &Ab1, const GaussianFactorGraph &Ab2, const Parameters &parameters, const Ordering &ordering)
 The user specify the subgraph part and the constraint part may throw exception if A1 is underdetermined.
 
 SubgraphSolver (const boost::shared_ptr< GaussianFactorGraph > &Ab1, const boost::shared_ptr< GaussianFactorGraph > &Ab2, const Parameters &parameters, const Ordering &ordering)
 Shared pointer version.
 
 SubgraphSolver (const boost::shared_ptr< GaussianBayesNet > &Rc1, const GaussianFactorGraph &Ab2, const Parameters &parameters, const Ordering &ordering)
 
 SubgraphSolver (const boost::shared_ptr< GaussianBayesNet > &Rc1, const boost::shared_ptr< GaussianFactorGraph > &Ab2, const Parameters &parameters, const Ordering &ordering)
 Shared pointer version.
 
virtual ~SubgraphSolver ()
 Destructor.
 
VectorValues optimize ()
 Optimize from zero.
 
VectorValues optimize (const VectorValues &initial)
 Optimize from given initial values.
 
virtual VectorValues optimize (const GaussianFactorGraph &gfg, const KeyInfo &keyInfo, const std::map< Key, Vector > &lambda, const VectorValues &initial)
 Interface that IterativeSolver subclasses have to implement.
 
- Public Member Functions inherited from gtsam::IterativeSolver
VectorValues optimize (const GaussianFactorGraph &gfg, boost::optional< const KeyInfo & >=boost::none, boost::optional< const std::map< Key, Vector > & > lambda=boost::none)
 
VectorValues optimize (const GaussianFactorGraph &gfg, const KeyInfo &keyInfo, const std::map< Key, Vector > &lambda)
 

Public Types

typedef SubgraphSolverParameters Parameters
 
- Public Types inherited from gtsam::IterativeSolver
typedef boost::shared_ptr< IterativeSolvershared_ptr
 

Protected Member Functions

void initialize (const GaussianFactorGraph &jfg)
 
void initialize (const boost::shared_ptr< GaussianBayesNet > &Rc1, const boost::shared_ptr< GaussianFactorGraph > &Ab2)
 
boost::tuple< boost::shared_ptr< GaussianFactorGraph >, boost::shared_ptr< GaussianFactorGraph > > splitGraph (const GaussianFactorGraph &gfg)
 

Protected Attributes

Parameters parameters_
 
Ordering ordering_
 
boost::shared_ptr< SubgraphPreconditionerpc_
 preconditioner object
 

The documentation for this class was generated from the following files: