gtsam
Loading...
Searching...
No Matches
DiscreteBoundaryFactor.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
17
18#pragma once
19
22
23namespace gtsam {
24
25/* ************************************************************************ */
35 const DiscreteKeys& discreteKeys, const AlgebraicDecisionTree<Key>& errors);
36
46class GTSAM_EXPORT DiscreteBoundaryFactor : public DecisionTreeFactor {
47 protected:
58 const DiscreteKeys& dkeys,
60 const gtsam::Values& values);
61
62 public:
63 // typedefs needed to play nice with gtsam
64 typedef DiscreteBoundaryFactor This;
66 typedef std::shared_ptr<DiscreteBoundaryFactor> shared_ptr;
67
70
73
75 DiscreteBoundaryFactor(const DiscreteKeys& keys, const ADT& potentials)
76 : DecisionTreeFactor(keys, potentials) {}
77
81 const gtsam::Values& continuousVals)
83 ComputeDiscreteBoundary(dkeys, factors, continuousVals)) {}
84
88
90 void print(
91 const std::string& s = "DiscreteBoundaryFactor:\n",
92 const KeyFormatter& formatter = DefaultKeyFormatter) const override;
93
97
98 using DecisionTreeFactor::operator*;
99
101 DiscreteFactor::shared_ptr operator*(double s) const override;
102
105
106 using DecisionTreeFactor::operator/;
107
117 DiscreteBoundaryFactor operator/(const DiscreteBoundaryFactor& f) const;
118
122
127 DiscreteBoundaryFactor apply(Unary op) const;
128
134 DiscreteBoundaryFactor apply(UnaryAssignment op) const;
135
142 Binary op) const;
143
145
146 private:
147#if GTSAM_ENABLE_BOOST_SERIALIZATION
149 friend class boost::serialization::access;
150 template <class ARCHIVE>
151 void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
152 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
153 }
154#endif
155};
156
157// traits
158template <>
160 : public Testable<DiscreteBoundaryFactor> {};
161} // namespace gtsam
A set of nonlinear factors indexed by a set of discrete keys.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
DecisionTreeFactor DiscreteFactorFromErrors(const DiscreteKeys &discreteKeys, const AlgebraicDecisionTree< Key > &errors)
Take negative log-values, shift them so that the minimum value is 0, and then exponentiate to create ...
Definition DiscreteBoundaryFactor.cpp:23
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition Point2.h:52
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
DecisionTree< L, Y > apply(const DecisionTree< L, Y > &f, const typename DecisionTree< L, Y >::Unary &op)
free versions of apply
Definition DecisionTree.h:467
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
An algebraic decision tree fixes the range of a DecisionTree to double.
Definition AlgebraicDecisionTree.h:41
A discrete probabilistic factor.
Definition DecisionTreeFactor.h:42
DecisionTreeFactor()
Default constructor for I/O.
Definition DecisionTreeFactor.cpp:34
std::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
Definition DiscreteFactor.h:46
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition DiscreteKey.h:41
A discrete probabilistic factor which computes its values from the continuous factors connected to it...
Definition DiscreteBoundaryFactor.h:46
static DecisionTreeFactor ComputeDiscreteBoundary(const DiscreteKeys &dkeys, const HybridNonlinearFactor::FactorValuePairs &factors, const gtsam::Values &values)
Helper method to compute the discrete values from continuous values.
Definition DiscreteBoundaryFactor.cpp:34
DiscreteBoundaryFactor(const DiscreteKeys &keys, const ADT &potentials)
Constructor from DiscreteKeys and AlgebraicDecisionTree.
Definition DiscreteBoundaryFactor.h:75
DiscreteBoundaryFactor(const DiscreteKeys &dkeys, const HybridNonlinearFactor::FactorValuePairs &factors, const gtsam::Values &continuousVals)
Constructor from DiscreteKeys and AlgebraicDecisionTree.
Definition DiscreteBoundaryFactor.h:79
DiscreteBoundaryFactor()
Default constructor for I/O.
Definition DiscreteBoundaryFactor.h:72
DecisionTreeFactor Base
Typedef to base class.
Definition DiscreteBoundaryFactor.h:65
DecisionTree< Key, NonlinearFactorValuePair > FactorValuePairs
typedef for DecisionTree which has Keys as node labels and pairs of NoiseModelFactor & an arbitrary s...
Definition HybridNonlinearFactor.h:69
const KeyVector & keys() const
Access the factor's involved variable keys.
Definition Factor.h:143
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65