cleanup some formatting and comments
parent
d5ec65e320
commit
c3045c097d
|
|
@ -10,7 +10,7 @@
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file SubgraphBuilder-inl.h
|
* @file kruskal-inl.h
|
||||||
* @date Dec 31, 2009
|
* @date Dec 31, 2009
|
||||||
* @author Frank Dellaert, Yong-Dian Jian
|
* @author Frank Dellaert, Yong-Dian Jian
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ PredecessorMap<KEY> findMinimumSpanningTree(const G& fg) {
|
||||||
// Convert to a graph that boost understands
|
// Convert to a graph that boost understands
|
||||||
SDGraph<KEY> g = gtsam::toBoostGraph<G, FACTOR2, KEY>(fg);
|
SDGraph<KEY> g = gtsam::toBoostGraph<G, FACTOR2, KEY>(fg);
|
||||||
|
|
||||||
// // find minimum spanning tree
|
// find minimum spanning tree
|
||||||
std::vector<typename SDGraph<KEY>::Vertex> p_map(boost::num_vertices(g));
|
std::vector<typename SDGraph<KEY>::Vertex> p_map(boost::num_vertices(g));
|
||||||
prim_minimum_spanning_tree(g, &p_map[0]);
|
prim_minimum_spanning_tree(g, &p_map[0]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -362,44 +362,44 @@ SubgraphBuilder::Weights SubgraphBuilder::weights(
|
||||||
using Weights = std::vector<double>;
|
using Weights = std::vector<double>;
|
||||||
|
|
||||||
const size_t m = gfg.size();
|
const size_t m = gfg.size();
|
||||||
Weights weights;
|
Weights weight;
|
||||||
weights.reserve(m);
|
weight.reserve(m);
|
||||||
|
|
||||||
for (const GaussianFactor::shared_ptr &gf : gfg) {
|
for (const GaussianFactor::shared_ptr &gf : gfg) {
|
||||||
switch (parameters_.skeletonWeight) {
|
switch (parameters_.skeletonWeight) {
|
||||||
case SubgraphBuilderParameters::EQUAL:
|
case SubgraphBuilderParameters::EQUAL:
|
||||||
weights.push_back(1.0);
|
weight.push_back(1.0);
|
||||||
break;
|
break;
|
||||||
case SubgraphBuilderParameters::RHS_2NORM: {
|
case SubgraphBuilderParameters::RHS_2NORM: {
|
||||||
if (JacobianFactor::shared_ptr jf =
|
if (JacobianFactor::shared_ptr jf =
|
||||||
std::dynamic_pointer_cast<JacobianFactor>(gf)) {
|
std::dynamic_pointer_cast<JacobianFactor>(gf)) {
|
||||||
weights.push_back(jf->getb().norm());
|
weight.push_back(jf->getb().norm());
|
||||||
} else if (HessianFactor::shared_ptr hf =
|
} else if (HessianFactor::shared_ptr hf =
|
||||||
std::dynamic_pointer_cast<HessianFactor>(gf)) {
|
std::dynamic_pointer_cast<HessianFactor>(gf)) {
|
||||||
weights.push_back(hf->linearTerm().norm());
|
weight.push_back(hf->linearTerm().norm());
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SubgraphBuilderParameters::LHS_FNORM: {
|
case SubgraphBuilderParameters::LHS_FNORM: {
|
||||||
if (JacobianFactor::shared_ptr jf =
|
if (JacobianFactor::shared_ptr jf =
|
||||||
std::dynamic_pointer_cast<JacobianFactor>(gf)) {
|
std::dynamic_pointer_cast<JacobianFactor>(gf)) {
|
||||||
weights.push_back(std::sqrt(jf->getA().squaredNorm()));
|
weight.push_back(std::sqrt(jf->getA().squaredNorm()));
|
||||||
} else if (HessianFactor::shared_ptr hf =
|
} else if (HessianFactor::shared_ptr hf =
|
||||||
std::dynamic_pointer_cast<HessianFactor>(gf)) {
|
std::dynamic_pointer_cast<HessianFactor>(gf)) {
|
||||||
weights.push_back(std::sqrt(hf->information().squaredNorm()));
|
weight.push_back(std::sqrt(hf->information().squaredNorm()));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case SubgraphBuilderParameters::RANDOM:
|
case SubgraphBuilderParameters::RANDOM:
|
||||||
weights.push_back(std::rand() % 100 + 1.0);
|
weight.push_back(std::rand() % 100 + 1.0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::invalid_argument(
|
throw std::invalid_argument(
|
||||||
"SubgraphBuilder::weights(): undefined weight scheme ");
|
"SubgraphBuilder::weights: undefined weight scheme ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return weights;
|
return weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
||||||
|
|
@ -167,12 +167,11 @@ class GTSAM_EXPORT SubgraphBuilder {
|
||||||
std::vector<size_t> unary(const GaussianFactorGraph &gfg) const;
|
std::vector<size_t> unary(const GaussianFactorGraph &gfg) const;
|
||||||
std::vector<size_t> natural_chain(const GaussianFactorGraph &gfg) const;
|
std::vector<size_t> natural_chain(const GaussianFactorGraph &gfg) const;
|
||||||
std::vector<size_t> bfs(const GaussianFactorGraph &gfg) const;
|
std::vector<size_t> bfs(const GaussianFactorGraph &gfg) const;
|
||||||
std::vector<size_t> sample(const std::vector<double> &weights,
|
|
||||||
const size_t t) const;
|
|
||||||
std::vector<size_t> kruskal(const GaussianFactorGraph &gfg,
|
std::vector<size_t> kruskal(const GaussianFactorGraph &gfg,
|
||||||
const std::vector<double> &weights) const;
|
const std::vector<double> &weights) const;
|
||||||
|
std::vector<size_t> sample(const std::vector<double> &weights,
|
||||||
|
const size_t t) const;
|
||||||
Weights weights(const GaussianFactorGraph &gfg) const ;
|
Weights weights(const GaussianFactorGraph &gfg) const ;
|
||||||
|
|
||||||
SubgraphBuilderParameters parameters_;
|
SubgraphBuilderParameters parameters_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -270,9 +270,8 @@ static VectorValues computeOrientations(const NonlinearFactorGraph& pose2Graph,
|
||||||
// Find a minimum spanning tree
|
// Find a minimum spanning tree
|
||||||
if (useOdometricPath)
|
if (useOdometricPath)
|
||||||
tree = findOdometricPath(pose2Graph);
|
tree = findOdometricPath(pose2Graph);
|
||||||
else {
|
else
|
||||||
tree = findMinimumSpanningTree(pose2Graph);
|
tree = findMinimumSpanningTree(pose2Graph);
|
||||||
}
|
|
||||||
|
|
||||||
// Create a linear factor graph (LFG) of scalars
|
// Create a linear factor graph (LFG) of scalars
|
||||||
key2doubleMap deltaThetaMap;
|
key2doubleMap deltaThetaMap;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue