NestedDissection.h
Go to the documentation of this file.
1 /*
2  * NestedDissection.h
3  *
4  * Created on: Nov 27, 2010
5  * Author: nikai
6  * Description: apply nested dissection algorithm to the factor graph
7  */
8 
9 #pragma once
10 
11 #include <vector>
12 #include <boost/shared_ptr.hpp>
13 #include <gtsam/nonlinear/Ordering.h>
14 
15 namespace gtsam { namespace partition {
16 
20  template <class NLG, class SubNLG, class GenericGraph>
22  public:
23  typedef boost::shared_ptr<SubNLG> sharedSubNLG;
24 
25  private:
26  NLG fg_; // the original nonlinear factor graph
27  Ordering ordering_; // the variable ordering in the nonlinear factor graph
28  std::vector<Symbol> int2symbol_; // the mapping from integer key to symbol
29  sharedSubNLG root_; // the root of generated cluster tree
30 
31  public:
32  sharedSubNLG root() const { return root_; }
33 
34  public:
35  /* constructor with post-determined partitoning*/
36  NestedDissection(const NLG& fg, const Ordering& ordering, const int numNodeStopPartition, const int minNodesPerMap, const bool verbose = false);
37 
38  /* constructor with pre-determined cuts*/
39  NestedDissection(const NLG& fg, const Ordering& ordering, const boost::shared_ptr<Cuts>& cuts, const bool verbose = false);
40 
41  private:
42  /* convert generic subgraph to nonlinear subgraph */
43  sharedSubNLG makeSubNLG(const NLG& fg, const std::vector<size_t>& frontals, const std::vector<size_t>& sep, const boost::shared_ptr<SubNLG>& parent) const;
44 
45  void processFactor(const typename GenericGraph::value_type& factor, const std::vector<int>& partitionTable, // input
46  std::vector<GenericGraph>& frontalFactors, NLG& sepFactors, std::vector<std::set<size_t> >& childSeps, // output factor graphs
47  typename SubNLG::Weeklinks& weeklinks) const;
48 
49  /* recursively partition the generic graph */
51  const GenericGraph& fg, const GenericUnaryGraph& unaryFactors,
52  const std::vector<size_t>& keys, const std::vector<int>& partitionTable, const int numSubmaps, // input
53  std::vector<GenericGraph>& frontalFactors, vector<GenericUnaryGraph>& frontalUnaryFactors, NLG& sepFactors, // output factor graphs
54  std::vector<std::vector<size_t> >& childFrontals, std::vector<std::vector<size_t> >& childSeps, std::vector<size_t>& localFrontals, // output sub-orderings
55  typename SubNLG::Weeklinks& weeklinks) const;
56 
57  NLG collectOriginalFactors(const GenericGraph& gfg, const GenericUnaryGraph& unaryFactors) const;
58 
59  /* recursively partition the generic graph */
60  sharedSubNLG recursivePartition(const GenericGraph& gfg, const GenericUnaryGraph& unaryFactors, const std::vector<size_t>& frontals, const std::vector<size_t>& sep,
61  const int numNodeStopPartition, const int minNodesPerMap, const boost::shared_ptr<SubNLG>& parent, WorkSpace& workspace, const bool verbose) const;
62 
63  /* recursively partition the generic graph */
64  sharedSubNLG recursivePartition(const GenericGraph& gfg, const GenericUnaryGraph& unaryFactors, const std::vector<size_t>& frontals, const std::vector<size_t>& sep,
65  const boost::shared_ptr<Cuts>& cuts, const boost::shared_ptr<SubNLG>& parent, WorkSpace& workspace, const bool verbose) const;
66 
67  };
68 
69 }} //namespace
boost::shared_ptr< SubNLG > sharedSubNLG
static enum @843 ordering
NLG collectOriginalFactors(const GenericGraph &gfg, const GenericUnaryGraph &unaryFactors) const
std::vector< sharedGenericUnaryFactor > GenericUnaryGraph
Definition: GenericGraph.h:130
const bool verbose
sharedSubNLG recursivePartition(const GenericGraph &gfg, const GenericUnaryGraph &unaryFactors, const std::vector< size_t > &frontals, const std::vector< size_t > &sep, const int numNodeStopPartition, const int minNodesPerMap, const boost::shared_ptr< SubNLG > &parent, WorkSpace &workspace, const bool verbose) const
void processFactor(const typename GenericGraph::value_type &factor, const std::vector< int > &partitionTable, std::vector< GenericGraph > &frontalFactors, NLG &sepFactors, std::vector< std::set< size_t > > &childSeps, typename SubNLG::Weeklinks &weeklinks) const
traits
Definition: chartTesting.h:28
sharedSubNLG makeSubNLG(const NLG &fg, const std::vector< size_t > &frontals, const std::vector< size_t > &sep, const boost::shared_ptr< SubNLG > &parent) const
NestedDissection(const NLG &fg, const Ordering &ordering, const int numNodeStopPartition, const int minNodesPerMap, const bool verbose=false)
const KeyVector keys
void partitionFactorsAndVariables(const GenericGraph &fg, const GenericUnaryGraph &unaryFactors, const std::vector< size_t > &keys, const std::vector< int > &partitionTable, const int numSubmaps, std::vector< GenericGraph > &frontalFactors, vector< GenericUnaryGraph > &frontalUnaryFactors, NLG &sepFactors, std::vector< std::vector< size_t > > &childFrontals, std::vector< std::vector< size_t > > &childSeps, std::vector< size_t > &localFrontals, typename SubNLG::Weeklinks &weeklinks) const
std::string sep
Definition: IOFormat.cpp:1


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