release/4.3a0
Frank Dellaert 2022-01-21 10:10:47 -05:00
parent d8abdc280d
commit 7e956d2bb7
3 changed files with 6 additions and 9 deletions

View File

@ -248,17 +248,17 @@ void DiscreteConditional::solveInPlace(DiscreteValues* values) const {
// Get all Possible Configurations // Get all Possible Configurations
const auto allPosbValues = frontalAssignments(); const auto allPosbValues = frontalAssignments();
// Find the MPE // Find the maximum
for (const auto& frontalVals : allPosbValues) { for (const auto& frontalVals : allPosbValues) {
double pValueS = pFS(frontalVals); // P(F=value|S=parentsValues) double pValueS = pFS(frontalVals); // P(F=value|S=parentsValues)
// Update MPE solution if better // Update maximum solution if better
if (pValueS > maxP) { if (pValueS > maxP) {
maxP = pValueS; maxP = pValueS;
mpe = frontalVals; mpe = frontalVals;
} }
} }
// set values (inPlace) to mpe // set values (inPlace) to maximum
for (Key j : frontals()) { for (Key j : frontals()) {
(*values)[j] = mpe[j]; (*values)[j] = mpe[j];
} }

View File

@ -182,7 +182,7 @@ class GTSAM_EXPORT DiscreteConditional
/** /**
* solve a conditional * solve a conditional
* @param parentsValues Known values of the parents * @param parentsValues Known values of the parents
* @return MPE value of the child (1 frontal variable). * @return maximum value for the (single) frontal variable.
*/ */
size_t solve(const DiscreteValues& parentsValues) const; size_t solve(const DiscreteValues& parentsValues) const;

View File

@ -25,15 +25,12 @@
namespace gtsam { namespace gtsam {
/** /**
* TODO: Update comments. The following comments are out of date!!! * Base class for conditional densities. This class iterators and
*
* Base class for conditional densities, templated on KEY type. This class
* provides storage for the keys involved in a conditional, and iterators and
* access to the frontal and separator keys. * access to the frontal and separator keys.
* *
* Derived classes *must* redefine the Factor and shared_ptr typedefs to refer * Derived classes *must* redefine the Factor and shared_ptr typedefs to refer
* to the associated factor type and shared_ptr type of the derived class. See * to the associated factor type and shared_ptr type of the derived class. See
* IndexConditional and GaussianConditional for examples. * SymbolicConditional and GaussianConditional for examples.
* \nosubgrouping * \nosubgrouping
*/ */
template<class FACTOR, class DERIVEDCONDITIONAL> template<class FACTOR, class DERIVEDCONDITIONAL>