diff --git a/gtsam/hybrid/HybridSmoother.cpp b/gtsam/hybrid/HybridSmoother.cpp index 918b20341..45320896a 100644 --- a/gtsam/hybrid/HybridSmoother.cpp +++ b/gtsam/hybrid/HybridSmoother.cpp @@ -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. diff --git a/gtsam/hybrid/HybridSmoother.h b/gtsam/hybrid/HybridSmoother.h index b34801922..96c8391b4 100644 --- a/gtsam/hybrid/HybridSmoother.h +++ b/gtsam/hybrid/HybridSmoother.h @@ -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 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 deadModeThreshold) + : deadModeThreshold_(deadModeThreshold) {} /** * Given new factors, perform an incremental update.