From 90ca1d46f564da671c4daea1e3ad147cd642a626 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 9 Oct 2012 00:18:22 +0000 Subject: [PATCH] Removed obsolete code for avoiding partial elimination in BayesTreeCliqueBase::shortcut and GenericSequentialSolver::conditionalBayesNet --- gtsam/inference/BayesTreeCliqueBase-inl.h | 9 --------- gtsam/inference/GenericSequentialSolver-inl.h | 20 ------------------- 2 files changed, 29 deletions(-) diff --git a/gtsam/inference/BayesTreeCliqueBase-inl.h b/gtsam/inference/BayesTreeCliqueBase-inl.h index 1b79fb096..ed25f5a9b 100644 --- a/gtsam/inference/BayesTreeCliqueBase-inl.h +++ b/gtsam/inference/BayesTreeCliqueBase-inl.h @@ -196,15 +196,6 @@ namespace gtsam { gttic(BayesTreeCliqueBase_shortcut_cachemiss); p_Cp_B.push_back(parent->conditional()->toFactor()); // P(Fp|Sp) - // Add the root conditional - // TODO: this is needed because otherwise we will be solving singular - // systems and exceptions are thrown. However, we should be able to omit - // this if we can get ATTEMPT_AT_NOT_ELIMINATING_ALL in - // GenericSequentialSolver.* working... -#ifndef ATTEMPT_AT_NOT_ELIMINATING_ALL - p_Cp_B.push_back(B->conditional()->toFactor()); // P(B) -#endif - // Determine the variables we want to keepSet, S union B std::vector keep = shortcut_indices(B, p_Cp_B); diff --git a/gtsam/inference/GenericSequentialSolver-inl.h b/gtsam/inference/GenericSequentialSolver-inl.h index ec7052b94..5382bc494 100644 --- a/gtsam/inference/GenericSequentialSolver-inl.h +++ b/gtsam/inference/GenericSequentialSolver-inl.h @@ -138,12 +138,6 @@ namespace gtsam { Permutation::shared_ptr permutation( inference::PermutationCOLAMD(*structure_, js, true)); -#ifdef ATTEMPT_AT_NOT_ELIMINATING_ALL - // TODO Frank says: this was my attempt at eliminating exactly - // as many variables as we need. Unfortunately, in some cases - // (see testSymbolicSequentialSolver::problematicConditional) - // my trick below (passing nrToEliminate to eliminate) sometimes leads - // to a disconnected graph. // Eliminate only variables J \cup F from P(J,F,S) to get P(F|S) size_t nrVariables = structure_->size(); size_t nrMarginalized = nrVariables - js.size(); @@ -152,20 +146,6 @@ namespace gtsam { // Get rid of conditionals on variables that we want to marginalize out for (int i = 0; i < nrMarginalized; i++) bayesNet->pop_front(); -#else - // Eliminate all variables - sharedBayesNet fullBayesNet = eliminate(*permutation, function); - - // Get rid of conditionals we do not need (front and back) - size_t nrMarginalized = fullBayesNet->size() - js.size(); - sharedBayesNet bayesNet(new BayesNet()); - size_t i = 1; - BOOST_FOREACH(sharedConditional c, *fullBayesNet) { - if (i > nrMarginalized && i - nrMarginalized <= nrFrontals) - bayesNet->push_back(c); - i += 1; - } -#endif return bayesNet; }