From 4d62b87e3536b97fb86a5994ed793ba20a07e18b Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sun, 21 Jul 2024 11:44:21 -0400 Subject: [PATCH] kill DiscreteConditional::argmaxInPlace --- gtsam/discrete/DiscreteConditional.cpp | 27 -------------------------- gtsam/discrete/DiscreteConditional.h | 6 ------ 2 files changed, 33 deletions(-) diff --git a/gtsam/discrete/DiscreteConditional.cpp b/gtsam/discrete/DiscreteConditional.cpp index ec17e22f6..9cf19638c 100644 --- a/gtsam/discrete/DiscreteConditional.cpp +++ b/gtsam/discrete/DiscreteConditional.cpp @@ -257,33 +257,6 @@ size_t DiscreteConditional::argmax(const DiscreteValues& parentsValues) const { return maxValue; } -/* ************************************************************************** */ -void DiscreteConditional::argmaxInPlace(DiscreteValues* values) const { - ADT pFS = choose(*values, true); // P(F|S=parentsValues) - - // Initialize - DiscreteValues mpe; - double maxP = 0; - - // Get all Possible Configurations - const auto allPosbValues = frontalAssignments(); - - // Find the maximum - for (const auto& frontalVals : allPosbValues) { - double pValueS = pFS(frontalVals); // P(F=value|S=parentsValues) - // Update maximum solution if better - if (pValueS > maxP) { - maxP = pValueS; - mpe = frontalVals; - } - } - - // set values (inPlace) to maximum - for (Key j : frontals()) { - (*values)[j] = mpe[j]; - } -} - /* ************************************************************************** */ void DiscreteConditional::sampleInPlace(DiscreteValues* values) const { assert(nrFrontals() == 1); diff --git a/gtsam/discrete/DiscreteConditional.h b/gtsam/discrete/DiscreteConditional.h index eda838e91..4c7af1489 100644 --- a/gtsam/discrete/DiscreteConditional.h +++ b/gtsam/discrete/DiscreteConditional.h @@ -218,12 +218,6 @@ class GTSAM_EXPORT DiscreteConditional */ size_t argmax(const DiscreteValues& parentsValues = DiscreteValues()) const; - /** - * @brief Calculate assignment for frontal variables that maximizes value. - * @param (in/out) parentsValues Known assignments for the parents. - */ - void argmaxInPlace(DiscreteValues* parentsValues) const; - /// @} /// @name Advanced Interface /// @{