Loading...
Searching...
No Matches
HybridGaussianFactorGraph.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/hybrid/GaussianMixtureFactor.h>
#include <gtsam/hybrid/HybridFactor.h>
#include <gtsam/hybrid/HybridFactorGraph.h>
#include <gtsam/inference/EliminateableFactorGraph.h>
#include <gtsam/inference/FactorGraph.h>
#include <gtsam/inference/Ordering.h>
#include <gtsam/linear/GaussianFactor.h>
#include <gtsam/linear/VectorValues.h>
namespace gtsam {
// Forward declarations
class HybridGaussianFactorGraph;
class HybridConditional;
class HybridBayesNet;
class HybridEliminationTree;
class HybridBayesTree;
class HybridJunctionTree;
class DecisionTreeFactor;
class JacobianFactor;
class HybridValues;
GTSAM_EXPORT
std::pair<boost::shared_ptr<HybridConditional>, boost::shared_ptr<Factor>>
EliminateHybrid(const HybridGaussianFactorGraph& factors, const Ordering& keys);
GTSAM_EXPORT const Ordering
HybridOrdering(const HybridGaussianFactorGraph& graph);
/* ************************************************************************* */
template <>
struct EliminationTraits<HybridGaussianFactorGraph> {
typedef Factor FactorType;
typedef HybridGaussianFactorGraph
FactorGraphType;
typedef HybridConditional
ConditionalType;
typedef HybridBayesNet
BayesNetType;
typedef HybridEliminationTree
EliminationTreeType;
typedef HybridBayesTree BayesTreeType;
typedef HybridJunctionTree JunctionTreeType;
static std::pair<boost::shared_ptr<ConditionalType>,
boost::shared_ptr<FactorType>>
DefaultEliminate(const FactorGraphType& factors, const Ordering& keys) {
return EliminateHybrid(factors, keys);
}
static Ordering DefaultOrderingFunc(
const FactorGraphType& graph,
boost::optional<const VariableIndex&> variableIndex) {
return HybridOrdering(graph);
}
};
class GTSAM_EXPORT HybridGaussianFactorGraph
: public HybridFactorGraph,
public EliminateableFactorGraph<HybridGaussianFactorGraph> {
protected:
template <typename FACTOR>
using IsGaussian = typename std::enable_if<
std::is_base_of<GaussianFactor, FACTOR>::value>::type;
public:
using Base = HybridFactorGraph;
using This = HybridGaussianFactorGraph;
using BaseEliminateable =
EliminateableFactorGraph<This>;
using shared_ptr = boost::shared_ptr<This>;
using Values = gtsam::Values;
using Indices = KeyVector;
HybridGaussianFactorGraph() = default;
template <class DERIVEDFACTOR>
HybridGaussianFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph)
: Base(graph) {}
// TODO(dellaert): customize print and equals.
// void print(const std::string& s = "HybridGaussianFactorGraph",
// const KeyFormatter& keyFormatter = DefaultKeyFormatter) const
// override;
// bool equals(const This& fg, double tol = 1e-9) const override;
using Base::error; // Expose error(const HybridValues&) method..
AlgebraicDecisionTree<Key> error(const VectorValues& continuousValues) const;
AlgebraicDecisionTree<Key> probPrime(
const VectorValues& continuousValues) const;
double probPrime(const HybridValues& values) const;
GaussianFactorGraphTree assembleGraphTree() const;
};
} // namespace gtsam
HybridFactorGraph.h
Factor graph with utilities for hybrid factors.
HybridFactor.h
GaussianMixtureFactor.h
A set of GaussianFactors, indexed by a set of discrete keys.
Ordering.h
Variable ordering for the elimination algorithm.
FactorGraph.h
Factor Graph Base Class.
EliminateableFactorGraph.h
Variable elimination algorithms for factor graphs.
VectorValues.h
Factor Graph Values.
GaussianFactor.h
A factor with a quadratic error function - a Gaussian.
gtsam::EliminateHybrid
std::pair< HybridConditional::shared_ptr, boost::shared_ptr< Factor > > EliminateHybrid(const HybridGaussianFactorGraph &factors, const Ordering &frontalKeys)
Main elimination function for HybridGaussianFactorGraph.
Definition HybridGaussianFactorGraph.cpp:320
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition Key.h:86
gtsam::HybridOrdering
const Ordering HybridOrdering(const HybridGaussianFactorGraph &graph)
Return a Colamd constrained ordering where the discrete keys are eliminated after the continuous keys...
Definition HybridGaussianFactorGraph.cpp:72
gtsam::GaussianFactorGraphTree
DecisionTree< Key, GaussianFactorGraph > GaussianFactorGraphTree
Alias for DecisionTree of GaussianFactorGraphs.
Definition HybridFactor.h:34
gtsam::AlgebraicDecisionTree
An algebraic decision tree fixes the range of a DecisionTree to double.
Definition AlgebraicDecisionTree.h:38
gtsam::DecisionTreeFactor
A discrete probabilistic factor.
Definition DecisionTreeFactor.h:45
gtsam::HybridBayesNet
A hybrid Bayes net is a collection of HybridConditionals, which can have discrete conditionals,...
Definition HybridBayesNet.h:35
gtsam::HybridBayesTree
A Bayes tree representing a Hybrid density.
Definition HybridBayesTree.h:64
gtsam::HybridConditional
Hybrid Conditional Density.
Definition HybridConditional.h:62
gtsam::HybridEliminationTree
Elimination Tree type for Hybrid Factor Graphs.
Definition HybridEliminationTree.h:32
gtsam::HybridFactorGraph::HybridFactorGraph
HybridFactorGraph()=default
Default constructor.
gtsam::EliminationTraits< HybridGaussianFactorGraph >::DefaultEliminate
static std::pair< boost::shared_ptr< ConditionalType >, boost::shared_ptr< FactorType > > DefaultEliminate(const FactorGraphType &factors, const Ordering &keys)
The default dense elimination function.
Definition HybridGaussianFactorGraph.h:82
gtsam::EliminationTraits< HybridGaussianFactorGraph >::ConditionalType
HybridConditional ConditionalType
Type of conditionals from elimination.
Definition HybridGaussianFactorGraph.h:72
gtsam::EliminationTraits< HybridGaussianFactorGraph >::FactorGraphType
HybridGaussianFactorGraph FactorGraphType
Type of the factor graph (e.g.
Definition HybridGaussianFactorGraph.h:69
gtsam::EliminationTraits< HybridGaussianFactorGraph >::JunctionTreeType
HybridJunctionTree JunctionTreeType
Type of Junction tree.
Definition HybridGaussianFactorGraph.h:78
gtsam::EliminationTraits< HybridGaussianFactorGraph >::EliminationTreeType
HybridEliminationTree EliminationTreeType
Type of elimination tree.
Definition HybridGaussianFactorGraph.h:76
gtsam::EliminationTraits< HybridGaussianFactorGraph >::DefaultOrderingFunc
static Ordering DefaultOrderingFunc(const FactorGraphType &graph, boost::optional< const VariableIndex & > variableIndex)
The default ordering generation function.
Definition HybridGaussianFactorGraph.h:86
gtsam::EliminationTraits< HybridGaussianFactorGraph >::FactorType
Factor FactorType
Type of factors in factor graph.
Definition HybridGaussianFactorGraph.h:67
gtsam::EliminationTraits< HybridGaussianFactorGraph >::BayesTreeType
HybridBayesTree BayesTreeType
Type of Bayes tree.
Definition HybridGaussianFactorGraph.h:77
gtsam::EliminationTraits< HybridGaussianFactorGraph >::BayesNetType
HybridBayesNet BayesNetType
Type of Bayes net from sequential elimination.
Definition HybridGaussianFactorGraph.h:74
gtsam::HybridGaussianFactorGraph
Definition HybridGaussianFactorGraph.h:102
gtsam::HybridGaussianFactorGraph::shared_ptr
boost::shared_ptr< This > shared_ptr
shared_ptr to This
Definition HybridGaussianFactorGraph.h:114
gtsam::HybridGaussianFactorGraph::This
HybridGaussianFactorGraph This
this class
Definition HybridGaussianFactorGraph.h:111
gtsam::HybridGaussianFactorGraph::Indices
KeyVector Indices
map from keys to values
Definition HybridGaussianFactorGraph.h:117
gtsam::HybridGaussianFactorGraph::Values
gtsam::Values Values
backwards compatibility
Definition HybridGaussianFactorGraph.h:116
gtsam::HybridGaussianFactorGraph::IsGaussian
typename std::enable_if< std::is_base_of< GaussianFactor, FACTOR >::value >::type IsGaussian
Check if FACTOR type is derived from GaussianFactor.
Definition HybridGaussianFactorGraph.h:106
gtsam::HybridGaussianFactorGraph::HybridGaussianFactorGraph
HybridGaussianFactorGraph()=default
Default constructor.
gtsam::HybridGaussianFactorGraph::HybridGaussianFactorGraph
HybridGaussianFactorGraph(const FactorGraph< DERIVEDFACTOR > &graph)
Implicit copy/downcast constructor to override explicit template container constructor.
Definition HybridGaussianFactorGraph.h:131
gtsam::HybridGaussianFactorGraph::BaseEliminateable
EliminateableFactorGraph< This > BaseEliminateable
for elimination
Definition HybridGaussianFactorGraph.h:112
gtsam::HybridJunctionTree
An EliminatableClusterTree, i.e., a set of variable clusters with factors, arranged in a tree,...
Definition HybridJunctionTree.h:53
gtsam::HybridValues
HybridValues represents a collection of DiscreteValues and VectorValues.
Definition HybridValues.h:38
gtsam::FactorGraph
A factor graph is a bipartite graph with factor nodes connected to variable nodes.
Definition FactorGraph.h:97
gtsam::EliminationTraits
Traits class for eliminateable factor graphs, specifies the types that result from elimination,...
Definition EliminateableFactorGraph.h:36
gtsam::EliminateableFactorGraph
EliminateableFactorGraph is a base class for factor graphs that contains elimination algorithms.
Definition EliminateableFactorGraph.h:57
gtsam::Factor
Definition Factor.h:68
gtsam::Ordering
Definition Ordering.h:34
gtsam::JacobianFactor
A Gaussian factor in the squared-error form.
Definition JacobianFactor.h:91
gtsam::VectorValues
VectorValues represents a collection of vector-valued variables associated each with a unique integer...
Definition VectorValues.h:74
gtsam::Values
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65