From 087c0cc5258bf1711f0c3f3aef74340d7de9355e Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sun, 26 Jan 2025 12:17:05 -0500 Subject: [PATCH] allow for only continuous variables in HybridBayesTree --- gtsam/hybrid/HybridBayesTree.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtsam/hybrid/HybridBayesTree.cpp b/gtsam/hybrid/HybridBayesTree.cpp index c74930a8e..fbf892235 100644 --- a/gtsam/hybrid/HybridBayesTree.cpp +++ b/gtsam/hybrid/HybridBayesTree.cpp @@ -202,6 +202,11 @@ VectorValues HybridBayesTree::optimize(const DiscreteValues& assignment) const { /* ************************************************************************* */ void HybridBayesTree::prune(const size_t maxNrLeaves) { + if (!this->roots_.at(0)->conditional()->asDiscrete()) { + // Root of the BayesTree is not a discrete clique, so we do nothing. + return; + } + auto prunedDiscreteProbs = this->roots_.at(0)->conditional()->asDiscrete();