SubgraphSolver.cpp
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 
27 
28 using namespace std;
29 
30 namespace gtsam {
31 
32 /**************************************************************************************************/
33 // Just taking system [A|b]
34 SubgraphSolver::SubgraphSolver(const GaussianFactorGraph &Ab,
35  const Parameters &parameters, const Ordering& ordering) :
36  parameters_(parameters) {
38  std::tie(Ab1, Ab2) = splitGraph(Ab);
39  if (parameters_.verbosity())
40  cout << "Split A into (A1) " << Ab1->size() << " and (A2) " << Ab2->size()
41  << " factors" << endl;
42 
43  auto Rc1 = Ab1->eliminateSequential(ordering, EliminateQR);
44  auto xbar = boost::make_shared<VectorValues>(Rc1->optimize());
45  pc_ = boost::make_shared<SubgraphPreconditioner>(Ab2, Rc1, xbar);
46 }
47 
48 /**************************************************************************************************/
49 // Taking eliminated tree [R1|c] and constraint graph [A2|b2]
52  const Parameters &parameters)
53  : parameters_(parameters) {
54  auto xbar = boost::make_shared<VectorValues>(Rc1->optimize());
55  pc_ = boost::make_shared<SubgraphPreconditioner>(Ab2, Rc1, xbar);
56 }
57 
58 /**************************************************************************************************/
59 // Taking subgraphs [A1|b1] and [A2|b2]
60 // delegate up
63  const Parameters &parameters,
64  const Ordering &ordering)
65  : SubgraphSolver(Ab1.eliminateSequential(ordering, EliminateQR), Ab2,
66  parameters) {}
67 
68 /**************************************************************************************************/
71  Errors>(*pc_, pc_->zero(), parameters_);
72  return pc_->x(ybar);
73 }
74 
76  const KeyInfo &keyInfo, const map<Key, Vector> &lambda,
77  const VectorValues &initial) {
78  return VectorValues();
79 }
80 /**************************************************************************************************/
81 pair<GaussianFactorGraph::shared_ptr, GaussianFactorGraph::shared_ptr> //
83 
84  /* identify the subgraph structure */
86  auto subgraph = builder(factorGraph);
87 
88  /* build factor subgraph */
89  return splitFactorGraph(factorGraph, subgraph);
90 }
91 
92 /****************************************************************************/
93 
94 } // \namespace gtsam
std::pair< boost::shared_ptr< GaussianFactorGraph >, boost::shared_ptr< GaussianFactorGraph > > splitGraph(const GaussianFactorGraph &gfg)
Split graph using Kruskal algorithm, treating binary factors as edges.
boost::shared_ptr< SubgraphPreconditioner > pc_
preconditioner object
static enum @843 ordering
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
Subgraph Solver from IROS 2010.
Definition: Half.h:150
V conjugateGradients(const S &Ab, V x, const ConjugateGradientParameters &parameters, bool steepest)
boost::shared_ptr< This > shared_ptr
std::pair< GaussianFactorGraph::shared_ptr, GaussianFactorGraph::shared_ptr > splitFactorGraph(const GaussianFactorGraph &factorGraph, const Subgraph &subgraph)
SubgraphBuilderParameters builderParams
VectorValues optimize() const
Optimize from zero.
Linear Factor Graph where all factors are Gaussians.
Iterative methods, template implementation.
static ConjugateGradientParameters parameters
cout<< "The eigenvalues of A are:"<< endl<< ces.eigenvalues()<< endl;cout<< "The matrix of eigenvectors, V, is:"<< endl<< ces.eigenvectors()<< endl<< endl;complex< float > lambda
traits
Definition: chartTesting.h:28
SubgraphSolver(const GaussianFactorGraph &A, const Parameters &parameters, const Ordering &ordering)
boost::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType=boost::none, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex=boost::none) const
Chordal Bayes Net, the result of eliminating a factor graph.
std::pair< GaussianConditional::shared_ptr, JacobianFactor::shared_ptr > EliminateQR(const GaussianFactorGraph &factors, const Ordering &keys)


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:44:50