update HybridSmoother to use std::optional deadModeThreshold

release/4.3a0
Varun Agrawal 2025-01-24 23:15:40 -05:00
parent 1764b58e8c
commit 4fcfe6493f
2 changed files with 5 additions and 9 deletions

View File

@ -81,8 +81,7 @@ void HybridSmoother::update(const HybridGaussianFactorGraph &graph,
if (maxNrLeaves) {
// `pruneBayesNet` sets the leaves with 0 in discreteFactor to nullptr in
// all the conditionals with the same keys in bayesNetFragment.
bayesNetFragment = bayesNetFragment.prune(*maxNrLeaves, removeDeadModes_,
deadModeThreshold_);
bayesNetFragment = bayesNetFragment.prune(*maxNrLeaves, deadModeThreshold_);
}
// Add the partial bayes net to the posterior bayes net.

View File

@ -29,10 +29,8 @@ class GTSAM_EXPORT HybridSmoother {
HybridBayesNet hybridBayesNet_;
HybridGaussianFactorGraph remainingFactorGraph_;
/// Flag indicating that we should remove dead discrete modes.
bool removeDeadModes_;
/// The threshold above which we make a decision about a mode.
double deadModeThreshold_;
std::optional<double> deadModeThreshold_;
public:
/**
@ -40,11 +38,10 @@ class GTSAM_EXPORT HybridSmoother {
*
* @param removeDeadModes Flag indicating whether to remove dead modes.
* @param deadModeThreshold The threshold above which a mode gets assigned a
* value and is considered "dead".
* value and is considered "dead". 0.99 is a good starting value.
*/
HybridSmoother(bool removeDeadModes = false, double deadModeThreshold = 0.99)
: removeDeadModes_(removeDeadModes),
deadModeThreshold_(deadModeThreshold) {}
HybridSmoother(const std::optional<double> deadModeThreshold)
: deadModeThreshold_(deadModeThreshold) {}
/**
* Given new factors, perform an incremental update.