25 #include <boost/shared_ptr.hpp> 33 class DiscreteConditional;
45 typedef boost::shared_ptr<DecisionTreeFactor> shared_ptr;
59 template<
class SOURCE>
75 virtual void print(
const std::string& s =
"DecisionTreeFactor:\n",
76 const KeyFormatter& formatter = DefaultKeyFormatter)
const;
89 return apply(f, ADT::Ring::mul);
94 return apply(f, safe_div);
103 shared_ptr
sum(
size_t nrFrontals)
const {
104 return combine(nrFrontals, ADT::Ring::add);
109 return combine(keys, ADT::Ring::add);
113 shared_ptr
max(
size_t nrFrontals)
const {
114 return combine(nrFrontals, ADT::Ring::max);
134 shared_ptr combine(
size_t nrFrontals, ADT::Binary op)
const;
142 shared_ptr combine(
const Ordering& keys, ADT::Binary op)
const;
const double & operator()(const Assignment< Key > &x) const
evaluate
Definition: DecisionTree-inl.h:619
shared_ptr sum(size_t nrFrontals) const
Create new factor by summing all values with the same separator values.
Definition: DecisionTreeFactor.h:103
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
DiscreteFactor Base
Typedef to base class.
Definition: DecisionTreeFactor.h:44
A base class for both DiscreteFactor and DiscreteConditional.
Definition: Potentials.h:32
Discrete Conditional Density Derives from DecisionTreeFactor.
Definition: DiscreteConditional.h:33
Template to create a binary predicate.
Definition: Testable.h:110
Variable ordering for the elimination algorithm.
Base class for discrete probabilistic factors The most general one is the derived DecisionTreeFactor.
Definition: DiscreteFactor.h:34
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
An assignment from labels to value index (size_t).
Definition: Assignment.h:34
shared_ptr max(size_t nrFrontals) const
Create new factor by maximizing over all values with the same separator values.
Definition: DecisionTreeFactor.h:113
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
DecisionTree< L, Y > apply(const DecisionTree< L, Y > &f, const typename DecisionTree< L, Y >::Unary &op)
free versions of apply
Definition: DecisionTree.h:216
A discrete probabilistic factor.
Definition: DecisionTreeFactor.h:38
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
virtual double operator()(const Values &values) const
Value is just look up in AlgebraicDecisonTree.
Definition: DecisionTreeFactor.h:83
DecisionTreeFactor(const DiscreteKeys &keys, SOURCE table)
Constructor from Indices and (string or doubles)
Definition: DecisionTreeFactor.h:60
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
DecisionTreeFactor operator/(const DecisionTreeFactor &f) const
divide by factor f (safely)
Definition: DecisionTreeFactor.h:93
shared_ptr sum(const Ordering &keys) const
Create new factor by summing all values with the same separator values.
Definition: DecisionTreeFactor.h:108
Definition: Ordering.h:34
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:37
Point2 operator *(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:170
virtual DecisionTreeFactor toDecisionTreeFactor() const
Convert into a decisiontree.
Definition: DecisionTreeFactor.h:98