added comments and minor refactor
parent
8272854378
commit
0fb67995c6
|
|
@ -242,7 +242,7 @@ GaussianBayesNet HybridBayesNet::choose(
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
HybridValues HybridBayesNet::optimize() const {
|
HybridValues HybridBayesNet::optimize() const {
|
||||||
// Solve for the MPE
|
// Collect all the discrete factors to compute MPE
|
||||||
DiscreteBayesNet discrete_bn;
|
DiscreteBayesNet discrete_bn;
|
||||||
for (auto &&conditional : *this) {
|
for (auto &&conditional : *this) {
|
||||||
if (conditional->isDiscrete()) {
|
if (conditional->isDiscrete()) {
|
||||||
|
|
@ -250,11 +250,11 @@ HybridValues HybridBayesNet::optimize() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Solve for the MPE
|
||||||
DiscreteValues mpe = DiscreteFactorGraph(discrete_bn).optimize();
|
DiscreteValues mpe = DiscreteFactorGraph(discrete_bn).optimize();
|
||||||
|
|
||||||
// Given the MPE, compute the optimal continuous values.
|
// Given the MPE, compute the optimal continuous values.
|
||||||
GaussianBayesNet gbn = this->choose(mpe);
|
return HybridValues(mpe, this->optimize(mpe));
|
||||||
return HybridValues(mpe, gbn.optimize());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,7 @@ HybridSmoother::addConditionals(const HybridGaussianFactorGraph &originalGraph,
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
GaussianMixture::shared_ptr HybridSmoother::gaussianMixture(
|
GaussianMixture::shared_ptr HybridSmoother::gaussianMixture(
|
||||||
size_t index) const {
|
size_t index) const {
|
||||||
return boost::dynamic_pointer_cast<GaussianMixture>(
|
return hybridBayesNet_.atMixture(index);
|
||||||
hybridBayesNet_.at(index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue