27 #include <boost/make_shared.hpp> 32 template class FactorGraph<DiscreteFactor>;
33 template class EliminateableFactorGraph<DiscreteFactorGraph>;
45 if (factor) keys.insert(factor->begin(), factor->end());
53 if (factor) result = (*factor) *
result;
62 product *= (*factor)(
values);
69 std::cout << s << std::endl;
70 std::cout <<
"size: " <<
size() << std::endl;
73 ss <<
"factor " <<
i <<
": ";
99 gttic(DiscreteFactorGraph_optimize);
104 std::pair<DiscreteConditional::shared_ptr, DecisionTreeFactor::shared_ptr>
121 orderedKeys.insert(orderedKeys.end(), frontalKeys.begin(), frontalKeys.end());
122 orderedKeys.insert(orderedKeys.end(), sum->keys().begin(), sum->keys().end());
129 return std::make_pair(cond, sum);
friend const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t rnd_mode)
bool equals(const This &fg, double tol=1e-9) const
DiscreteFactor::sharedValues optimize() const
GaussianFactorGraph factors(list_of(factor1)(factor2)(factor3))
const KeyFormatter & formatter
bool equals(const This &fg, double tol=1e-9) const
boost::shared_ptr< DiscreteFactor > sharedFactor
Shared pointer to a factor.
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
Discrete Bayes Tree, the result of eliminating a DiscreteJunctionTree.
std::pair< DiscreteConditional::shared_ptr, DecisionTreeFactor::shared_ptr > EliminateDiscrete(const DiscreteFactorGraph &factors, const Ordering &frontalKeys)
boost::shared_ptr< This > shared_ptr
shared_ptr to this class
boost::shared_ptr< DiscreteFactor > shared_ptr
shared_ptr to this class
static std::stringstream ss
boost::shared_ptr< Values > sharedValues
boost::shared_ptr< DecisionTreeFactor > shared_ptr
boost::shared_ptr< BayesNetType > eliminateSequential(OptionalOrderingType orderingType=boost::none, const Eliminate &function=EliminationTraitsType::DefaultEliminate, OptionalVariableIndex variableIndex=boost::none) const
void print(const std::string &s="DiscreteFactorGraph", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
double operator()(const DiscreteFactor::Values &values) const
FastVector< sharedFactor > factors_
DecisionTreeFactor product() const