Go to the documentation of this file.
35 template class BayesTreeCliqueBase<HybridBayesTreeClique,
36 HybridGaussianFactorGraph>;
37 template class BayesTree<HybridBayesTreeClique>;
54 if (root_conditional->isDiscrete()) {
55 discrete_fg.
push_back(root_conditional->asDiscrete());
58 throw std::runtime_error(
59 "HybridBayesTree root is not discrete-only. Please check elimination "
60 "ordering or use continuous factor graph.");
92 : assignment_(assignment),
93 parentClique_(parentClique),
94 gaussianbayesTree_(gbt),
120 conditional = std::make_shared<GaussianConditional>();
126 clique = std::make_shared<GaussianBayesTree::Node>(conditional);
128 parentData.gaussianbayesTree_->addClique(clique,
148 treeTraversal::no_op visitorPost;
171 if (gbt.
size() == 0) {
182 auto discreteProbs = this->
roots_.at(0)->conditional()->asDiscrete();
185 discreteProbs->
root_ = prunedDiscreteProbs.
root_;
188 struct HybridPrunerData {
193 : prunedDiscreteProbs(prunedDiscreteProbs) {}
203 static HybridPrunerData AssignmentPreOrderVisitor(
210 if (conditional->isHybrid()) {
211 auto hybridGaussianCond = conditional->asHybrid();
214 clique->conditional() = std::make_shared<HybridConditional>(
215 hybridGaussianCond->prune(
parentData.prunedDiscreteProbs));
221 HybridPrunerData rootData(prunedDiscreteProbs, 0);
223 treeTraversal::no_op visitorPost;
227 *
this, rootData, HybridPrunerData::AssignmentPreOrderVisitor,
std::shared_ptr< This > shared_ptr
shared_ptr to this class
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.
DecisionTreeFactor prune(size_t maxNrAssignments) const
Prune the decision tree of discrete variables.
A Bayes net of Gaussian Conditionals indexed by discrete keys.
double error(const HybridValues &values) const
const DiscreteValues assignment_
bool isHybrid() const
True is this is a Discrete-Continuous factor.
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.
NodePtr root_
A DecisionTree just contains the root. TODO(dellaert): make protected.
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.
bool isContinuous() const
True if this is a factor of continuous variables only.
VectorValues optimize() const
GaussianBayesTree * gaussianbayesTree_
GaussianBayesTree choose(const DiscreteValues &assignment) const
Get the Gaussian Bayes Tree which corresponds to a specific discrete value assignment.
void DepthFirstForestParallel(FOREST &forest, DATA &rootData, VISITOR_PRE &visitorPre, VISITOR_POST &visitorPost, int problemSizeThreshold=10)
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
const HybridGaussianConditional hybrid_conditional(mode, conditionals)
std::shared_ptr< This > shared_ptr
shared_ptr to this class
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.
DiscreteValues optimize(OptionalOrderingType orderingType={}) const
Find the maximum probable explanation (MPE) by doing max-product.
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 Sat Nov 16 2024 04:02:26