24 #include <boost/make_shared.hpp> 31 DecisionTreeFactor::DecisionTreeFactor() {
36 const ADT& potentials) :
47 if(!dynamic_cast<const DecisionTreeFactor*>(&other)) {
72 for(
const std::pair<const Key,size_t>&
key: cs)
84 if (nrFrontals >
size())
throw invalid_argument(
86 "DecisionTreeFactor::combine: invalid number of frontal keys %d, nr.keys=%d")
92 for (i = 0; i < nrFrontals; i++) {
99 for (; i <
keys().size(); i++) {
103 return boost::make_shared<DecisionTreeFactor>(dkeys,
result);
111 if (frontalKeys.size() >
size())
throw invalid_argument(
113 "DecisionTreeFactor::combine: invalid number of frontal keys %d, nr.keys=%d")
114 % frontalKeys.size() %
size()).
str());
119 for (i = 0; i < frontalKeys.size(); i++) {
120 Key j = frontalKeys[
i];
127 for (i = 0; i <
keys().size(); i++) {
130 if (std::find(frontalKeys.begin(), frontalKeys.end(),
j) != frontalKeys.end())
134 return boost::make_shared<DecisionTreeFactor>(dkeys,
result);
DecisionTree apply(const Unary &op) const
boost::function< double(const double &, const double &)> Binary
shared_ptr combine(size_t nrFrontals, ADT::Binary op) const
const KeyFormatter & formatter
DecisionTreeFactor apply(const DecisionTreeFactor &f, ADT::Binary op) const
DecisionTree combine(const L &label, size_t cardinality, const Binary &op) const
std::pair< Key, size_t > DiscreteKey
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
GTSAM_EXPORT bool equals(const Potentials &other, double tol=1e-9) const
size_t cardinality(Key j) const
const KeyVector & keys() const
Access the factor's involved variable keys.
boost::shared_ptr< DecisionTreeFactor > shared_ptr
GTSAM_EXPORT void print(const std::string &s="Potentials: ", const KeyFormatter &formatter=DefaultKeyFormatter) const
bool equals(const DiscreteFactor &other, double tol=1e-9) const override
equality
void print(const std::string &s="DecisionTreeFactor:\n", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
A thin wrapper around std::set that uses boost's fast_pool_allocator.
std::uint64_t Key
Integer nonlinear key type.
DiscreteKeys is a set of keys that can be assembled using the & operator.