Removed obsolete code for avoiding partial elimination in BayesTreeCliqueBase::shortcut and GenericSequentialSolver::conditionalBayesNet
parent
df9a86d340
commit
90ca1d46f5
|
|
@ -196,15 +196,6 @@ namespace gtsam {
|
||||||
gttic(BayesTreeCliqueBase_shortcut_cachemiss);
|
gttic(BayesTreeCliqueBase_shortcut_cachemiss);
|
||||||
p_Cp_B.push_back(parent->conditional()->toFactor()); // P(Fp|Sp)
|
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
|
// Determine the variables we want to keepSet, S union B
|
||||||
std::vector<Index> keep = shortcut_indices(B, p_Cp_B);
|
std::vector<Index> keep = shortcut_indices(B, p_Cp_B);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,12 +138,6 @@ namespace gtsam {
|
||||||
Permutation::shared_ptr permutation(
|
Permutation::shared_ptr permutation(
|
||||||
inference::PermutationCOLAMD(*structure_, js, true));
|
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)
|
// Eliminate only variables J \cup F from P(J,F,S) to get P(F|S)
|
||||||
size_t nrVariables = structure_->size();
|
size_t nrVariables = structure_->size();
|
||||||
size_t nrMarginalized = nrVariables - js.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
|
// Get rid of conditionals on variables that we want to marginalize out
|
||||||
for (int i = 0; i < nrMarginalized; i++)
|
for (int i = 0; i < nrMarginalized; i++)
|
||||||
bayesNet->pop_front();
|
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<Conditional>());
|
|
||||||
size_t i = 1;
|
|
||||||
BOOST_FOREACH(sharedConditional c, *fullBayesNet) {
|
|
||||||
if (i > nrMarginalized && i - nrMarginalized <= nrFrontals)
|
|
||||||
bayesNet->push_back(c);
|
|
||||||
i += 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return bayesNet;
|
return bayesNet;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue