50 const KeySet newFactorKeys = newFactors.
keys();
52 for (
auto& k : newFactorKeys) {
53 if (!allDiscrete.
exists(k)) {
54 newKeysDiscreteLast.push_back(k);
58 std::copy(allDiscrete.begin(), allDiscrete.end(),
59 std::back_inserter(newKeysDiscreteLast));
65 index,
KeyVector(newKeysDiscreteLast.begin(), newKeysDiscreteLast.end()),
74 const std::optional<size_t>& maxNrLeaves,
75 const std::optional<Ordering>&
ordering,
79 const KeySet newFactorKeys = newFactors.
keys();
81 KeyVector keyVector(newFactorKeys.begin(), newFactorKeys.end());
100 elimination_ordering =
GetOrdering(factors, newFactors);
108 bayesTree->prune(*maxNrLeaves);
112 this->
roots_.insert(this->
roots_.end(), bayesTree->roots().begin(),
113 bayesTree->roots().end());
114 this->
nodes_.insert(bayesTree->nodes().begin(), bayesTree->nodes().end());
119 const std::optional<size_t>& maxNrLeaves,
120 const std::optional<Ordering>&
ordering,
123 this->
updateInternal(newFactors, &orphans, maxNrLeaves, ordering,
function);
KeySet discreteKeySet() const
Get all the discrete keys in the factor graph, as a set.
void removeTop(const KeyVector &keys, BayesNetType *bn, Cliques *orphans)
FactorGraphType::Eliminate Eliminate
Incremental update functionality (iSAM) for BayesTree.
static Ordering GetOrdering(HybridGaussianFactorGraph &factors, const HybridGaussianFactorGraph &newFactors)
Helper method to get an ordering given the existing factors and any new factors added.
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
void update(const HybridGaussianFactorGraph &newFactors, const std::optional< size_t > &maxNrLeaves={}, const std::optional< Ordering > &ordering={}, const HybridBayesTree::Eliminate &function=HybridBayesTree::EliminationTraitsType::DefaultEliminate)
Perform update step with new factors.
std::shared_ptr< This > shared_ptr
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
bool exists(const VALUE &e) const
const GaussianFactorGraph factors
static enum @1107 ordering
std::shared_ptr< Clique > sharedClique
Shared pointer to a clique.
Hybrid Bayes Tree, the result of eliminating a HybridJunctionTree.
Linearized Hybrid factor graph that uses type erasure.
void updateInternal(const HybridGaussianFactorGraph &newFactors, HybridBayesTree::Cliques *orphans, const std::optional< size_t > &maxNrLeaves={}, const std::optional< Ordering > &ordering={}, const HybridBayesTree::Eliminate &function=HybridBayesTree::EliminationTraitsType::DefaultEliminate)
Internal method that performs the ISAM update.
std::shared_ptr< BayesTreeType > eliminateMultifrontal(OptionalOrderingType orderingType={}, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex={}) const
HybridBayesTreeClique ::BayesNetType BayesNetType
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
static Ordering ColamdConstrainedLast(const FACTOR_GRAPH &graph, const KeyVector &constrainLast, bool forceOrder=false)