use DiscreteFactorGraph directly
parent
ccad6f6c48
commit
2007ef53de
|
|
@ -220,15 +220,16 @@ GaussianBayesNet HybridBayesNet::choose(
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
HybridValues HybridBayesNet::optimize() const {
|
HybridValues HybridBayesNet::optimize() const {
|
||||||
// Collect all the discrete factors to compute MPE
|
// Collect all the discrete factors to compute MPE
|
||||||
DiscreteBayesNet discrete_bn;
|
DiscreteFactorGraph discrete_fg;
|
||||||
|
|
||||||
for (auto &&conditional : *this) {
|
for (auto &&conditional : *this) {
|
||||||
if (conditional->isDiscrete()) {
|
if (conditional->isDiscrete()) {
|
||||||
discrete_bn.push_back(conditional->asDiscrete());
|
discrete_fg.push_back(conditional->asDiscrete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Solve for the MPE
|
// Solve for the MPE
|
||||||
DiscreteValues mpe = DiscreteFactorGraph(discrete_bn).optimize();
|
DiscreteValues mpe = discrete_fg.optimize();
|
||||||
|
|
||||||
// Given the MPE, compute the optimal continuous values.
|
// Given the MPE, compute the optimal continuous values.
|
||||||
return HybridValues(optimize(mpe), mpe);
|
return HybridValues(optimize(mpe), mpe);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue