formatting/spelling only
parent
25f90701c7
commit
5145b8c47a
|
@ -10,7 +10,7 @@
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file HybridGaussianISAM.h
|
* @file HybridGaussianISAM.cpp
|
||||||
* @date March 31, 2022
|
* @date March 31, 2022
|
||||||
* @author Fan Jiang
|
* @author Fan Jiang
|
||||||
* @author Frank Dellaert
|
* @author Frank Dellaert
|
||||||
|
|
|
@ -39,8 +39,8 @@ void HybridNonlinearISAM::update(const HybridNonlinearFactorGraph& newFactors,
|
||||||
if (newFactors.size() > 0) {
|
if (newFactors.size() > 0) {
|
||||||
// Reorder and relinearize every reorderInterval updates
|
// Reorder and relinearize every reorderInterval updates
|
||||||
if (reorderInterval_ > 0 && ++reorderCounter_ >= reorderInterval_) {
|
if (reorderInterval_ > 0 && ++reorderCounter_ >= reorderInterval_) {
|
||||||
// TODO(Varun) Relinearization doesn't take into account pruning
|
// TODO(Varun) Re-linearization doesn't take into account pruning
|
||||||
reorder_relinearize();
|
reorderRelinearize();
|
||||||
reorderCounter_ = 0;
|
reorderCounter_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ void HybridNonlinearISAM::update(const HybridNonlinearFactorGraph& newFactors,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void HybridNonlinearISAM::reorder_relinearize() {
|
void HybridNonlinearISAM::reorderRelinearize() {
|
||||||
if (factors_.size() > 0) {
|
if (factors_.size() > 0) {
|
||||||
// Obtain the new linearization point
|
// Obtain the new linearization point
|
||||||
const Values newLinPoint = estimate();
|
const Values newLinPoint = estimate();
|
||||||
|
@ -69,7 +69,7 @@ void HybridNonlinearISAM::reorder_relinearize() {
|
||||||
|
|
||||||
// Just recreate the whole BayesTree
|
// Just recreate the whole BayesTree
|
||||||
// TODO: allow for constrained ordering here
|
// TODO: allow for constrained ordering here
|
||||||
// TODO: decouple relinearization and reordering to avoid
|
// TODO: decouple re-linearization and reordering to avoid
|
||||||
isam_.update(*factors_.linearize(newLinPoint), {}, {},
|
isam_.update(*factors_.linearize(newLinPoint), {}, {},
|
||||||
eliminationFunction_);
|
eliminationFunction_);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class GTSAM_EXPORT HybridNonlinearISAM {
|
||||||
/// The discrete assignment
|
/// The discrete assignment
|
||||||
DiscreteValues assignment_;
|
DiscreteValues assignment_;
|
||||||
|
|
||||||
/** The original factors, used when relinearizing */
|
/** The original factors, used when re-linearizing */
|
||||||
HybridNonlinearFactorGraph factors_;
|
HybridNonlinearFactorGraph factors_;
|
||||||
|
|
||||||
/** The reordering interval and counter */
|
/** The reordering interval and counter */
|
||||||
|
@ -52,8 +52,8 @@ class GTSAM_EXPORT HybridNonlinearISAM {
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Periodically reorder and relinearize
|
* Periodically reorder and re-linearize
|
||||||
* @param reorderInterval is the number of updates between reorderings,
|
* @param reorderInterval is the number of updates between re-orderings,
|
||||||
* 0 never reorders (and is dangerous for memory consumption)
|
* 0 never reorders (and is dangerous for memory consumption)
|
||||||
* 1 (default) reorders every time, in worse case is batch every update
|
* 1 (default) reorders every time, in worse case is batch every update
|
||||||
* typical values are 50 or 100
|
* typical values are 50 or 100
|
||||||
|
@ -124,8 +124,8 @@ class GTSAM_EXPORT HybridNonlinearISAM {
|
||||||
const std::optional<size_t>& maxNrLeaves = {},
|
const std::optional<size_t>& maxNrLeaves = {},
|
||||||
const std::optional<Ordering>& ordering = {});
|
const std::optional<Ordering>& ordering = {});
|
||||||
|
|
||||||
/** Relinearization and reordering of variables */
|
/** Re-linearization and reordering of variables */
|
||||||
void reorder_relinearize();
|
void reorderRelinearize();
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
};
|
};
|
||||||
|
|
|
@ -339,12 +339,8 @@ TEST(HybridEstimation, Probability) {
|
||||||
HybridValues hybrid_values = bayesNet->optimize();
|
HybridValues hybrid_values = bayesNet->optimize();
|
||||||
|
|
||||||
// This is the correct sequence as designed
|
// This is the correct sequence as designed
|
||||||
DiscreteValues discrete_seq;
|
DiscreteValues expectedSequence{{M(0), 1}, {M(1), 1}, {M(2), 0}};
|
||||||
discrete_seq[M(0)] = 1;
|
EXPECT(assert_equal(expectedSequence, hybrid_values.discrete()));
|
||||||
discrete_seq[M(1)] = 1;
|
|
||||||
discrete_seq[M(2)] = 0;
|
|
||||||
|
|
||||||
EXPECT(assert_equal(discrete_seq, hybrid_values.discrete()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
@ -411,12 +407,8 @@ TEST(HybridEstimation, ProbabilityMultifrontal) {
|
||||||
HybridValues hybrid_values = discreteBayesTree->optimize();
|
HybridValues hybrid_values = discreteBayesTree->optimize();
|
||||||
|
|
||||||
// This is the correct sequence as designed
|
// This is the correct sequence as designed
|
||||||
DiscreteValues discrete_seq;
|
DiscreteValues expectedSequence{{M(0), 1}, {M(1), 1}, {M(2), 0}};
|
||||||
discrete_seq[M(0)] = 1;
|
EXPECT(assert_equal(expectedSequence, hybrid_values.discrete()));
|
||||||
discrete_seq[M(1)] = 1;
|
|
||||||
discrete_seq[M(2)] = 0;
|
|
||||||
|
|
||||||
EXPECT(assert_equal(discrete_seq, hybrid_values.discrete()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue