Go to the documentation of this file.
36 template class BayesTreeCliqueBase<HybridBayesTreeClique,
37 HybridGaussianFactorGraph>;
38 template class BayesTree<HybridBayesTreeClique>;
52 if (
auto tf = std::dynamic_pointer_cast<TableFactor>(
product)) {
71 if (root_conditional->isDiscrete()) {
143 conditional = std::make_shared<GaussianConditional>();
149 clique = std::make_shared<GaussianBayesTree::Node>(conditional);
151 parentData.gaussianbayesTree_->addClique(clique,
171 treeTraversal::no_op visitorPost;
194 if (gbt.
size() == 0) {
205 if (!this->
roots_.at(0)->conditional()->asDiscrete()) {
210 auto prunedDiscreteProbs =
214 prunedDiscreteProbs->
prune(maxNrLeaves);
217 struct HybridPrunerData {
222 : prunedDiscreteProbs(prunedDiscreteProbs) {}
232 static HybridPrunerData AssignmentPreOrderVisitor(
239 if (conditional->isHybrid()) {
240 auto hybridGaussianCond = conditional->asHybrid();
242 if (!hybridGaussianCond->pruned()) {
244 clique->conditional() = std::make_shared<HybridConditional>(
245 hybridGaussianCond->prune(*
parentData.prunedDiscreteProbs));
252 HybridPrunerData rootData(prunedDiscreteProbs, 0);
254 treeTraversal::no_op visitorPost;
258 *
this, rootData, HybridPrunerData::AssignmentPreOrderVisitor,
std::shared_ptr< This > shared_ptr
shared_ptr to this class
DiscreteValues argmax() const
Return assignment that maximizes value.
double error(const HybridValues &values) const
HybridAssignmentData(const DiscreteValues &assignment, const GaussianBayesTree::sharedNode &parentClique, GaussianBayesTree *gbt, bool valid=true)
Construct a new Hybrid Assignment Data object.
DiscreteValues discreteMaxProduct(const DiscreteFactorGraph &dfg) const
A Bayes net of Gaussian Conditionals indexed by discrete keys.
double error(const HybridValues &values) const
const DiscreteValues assignment_
DiscreteFactor::shared_ptr scaledProduct() const
Return product of all factors as a single factor, which is scaled by the max value to prevent underfl...
static HybridAssignmentData AssignmentPreOrderVisitor(const HybridBayesTree::sharedNode &node, HybridAssignmentData &parentData)
A function used during tree traversal that operates on each node before visiting the node's children.
DiscreteValues mpe() const
Compute the Most Probable Explanation (MPE) of the discrete variables.
const sharedClique & clique(Key j) const
HybridValues optimize() const
Optimize the hybrid Bayes tree by computing the MPE for the current set of discrete variables and usi...
Hybrid Bayes Tree, the result of eliminating a HybridJunctionTree.
VectorValues optimize() const
GaussianBayesTree * gaussianbayesTree_
GaussianBayesTree choose(const DiscreteValues &assignment) const
Get the Gaussian Bayes Tree which corresponds to a specific discrete value assignment.
std::shared_ptr< This > shared_ptr
shared_ptr to this class
void DepthFirstForestParallel(FOREST &forest, DATA &rootData, VISITOR_PRE &visitorPre, VISITOR_POST &visitorPost, int problemSizeThreshold=10)
std::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
virtual void prune(size_t maxNrAssignments) override
Prune the conditional.
const HybridGaussianConditional hybrid_conditional(mode, conditionals)
std::shared_ptr< This > shared_ptr
shared_ptr to this class
void product(const MatrixType &m)
Helper class for Depth First Forest traversal on the HybridBayesTree.
sharedClique sharedNode
Synonym for sharedClique (TODO: remove)
void prune(const size_t maxNumberLeaves)
Prune the underlying Bayes tree.
bool equals(const This &other, double tol=1e-9) const
Base class for cliques of a BayesTree.
Bayes Tree is a tree of cliques of a Bayes Chain.
GaussianBayesTree::sharedNode parentClique_
bool equals(const This &other, double tol=1e-9) const
gtsam
Author(s):
autogenerated on Wed Mar 19 2025 03:01:48