added comments and minor refactor

release/4.3a0
Varun Agrawal 2022-12-23 00:12:51 +05:30
parent 8272854378
commit 0fb67995c6
2 changed files with 4 additions and 5 deletions

View File

@ -242,7 +242,7 @@ GaussianBayesNet HybridBayesNet::choose(
/* ************************************************************************* */
HybridValues HybridBayesNet::optimize() const {
// Solve for the MPE
// Collect all the discrete factors to compute MPE
DiscreteBayesNet discrete_bn;
for (auto &&conditional : *this) {
if (conditional->isDiscrete()) {
@ -250,11 +250,11 @@ HybridValues HybridBayesNet::optimize() const {
}
}
// Solve for the MPE
DiscreteValues mpe = DiscreteFactorGraph(discrete_bn).optimize();
// Given the MPE, compute the optimal continuous values.
GaussianBayesNet gbn = this->choose(mpe);
return HybridValues(mpe, gbn.optimize());
return HybridValues(mpe, this->optimize(mpe));
}
/* ************************************************************************* */

View File

@ -100,8 +100,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &originalGraph,
/* ************************************************************************* */
GaussianMixture::shared_ptr HybridSmoother::gaussianMixture(
size_t index) const {
return boost::dynamic_pointer_cast<GaussianMixture>(
hybridBayesNet_.at(index));
return hybridBayesNet_.atMixture(index);
}
/* ************************************************************************* */