remove fixed values when keys are reintroduced in newFactors

release/4.3a0
Varun Agrawal 2025-03-17 15:39:56 -04:00
parent f401a9056e
commit 88fb8f7c65
2 changed files with 9 additions and 1 deletions

View File

@ -73,9 +73,10 @@ HybridBayesNet HybridBayesNet::prune(
if (conditional->isDiscrete()) continue;
// No-op if not a HybridGaussianConditional.
if (marginalThreshold)
if (marginalThreshold) {
conditional = std::static_pointer_cast<HybridConditional>(
conditional->restrict(fixed));
}
// Now decide on type what to do:
if (auto hgc = conditional->asHybrid()) {

View File

@ -118,6 +118,13 @@ void HybridSmoother::update(const HybridGaussianFactorGraph &newFactors,
}
#endif
// Remove fixed values for discrete keys which are introduced in newFactors
for (Key key : newFactors.discreteKeySet()) {
if (fixedValues_.find(key) != fixedValues_.end()) {
fixedValues_.erase(key);
}
}
#ifdef DEBUG_SMOOTHER
// Print discrete keys in the bayesNetFragment:
std::cout << "Discrete keys in bayesNetFragment: ";