30 template<
class BAYESTREE,
class GRAPH,
class ETREE_NODE>
45 parentData(_parentData) {
50 const boost::shared_ptr<ETREE_NODE>& node,
56 myData.
myJTNode = boost::make_shared<Node>(node->key, node->factors);
63 const boost::shared_ptr<ETREE_NODE>& ETreeNode,
79 symbolicFactors += ETreeNode->factors;
84 keyAsOrdering.push_back(ETreeNode->key);
88 symbolicFactors, keyAsOrdering);
97 node->problemSize_ = (
int) (myConditional->size() * symbolicFactors.
size());
101 const size_t myNrParents = myConditional->nrParents();
102 const size_t nrChildren = node->nrChildren();
103 assert(childConditionals.size() == nrChildren);
106 std::vector<size_t> nrFrontals = node->nrFrontalsOfChildren();
107 std::vector<bool> merge(nrChildren,
false);
108 size_t myNrFrontals = 1;
109 for (
size_t i = 0;
i<nrChildren;
i++){
111 if (myNrParents + myNrFrontals == childConditionals[
i]->nrParents()) {
113 myNrFrontals += nrFrontals[
i];
119 node->mergeChildren(merge);
124 template<
class BAYESTREE,
class GRAPH>
125 template<
class ETREE_BAYESNET,
class ETREE_GRAPH>
128 gttic(JunctionTree_FromEliminationTree);
141 rootData.myJTNode = boost::make_shared<typename Base::Node>();
144 Data::ConstructorTraversalVisitorPre,
145 Data::ConstructorTraversalVisitorPostAlg2);
148 this->addChildrenAsRoots(rootData.myJTNode);
JunctionTree< BAYESTREE, GRAPH >::sharedNode sharedNode
static void ConstructorTraversalVisitorPostAlg2(const boost::shared_ptr< ETREE_NODE > &ETreeNode, const ConstructorTraversalData &myData)
void DepthFirstForest(FOREST &forest, DATA &rootData, VISITOR_PRE &visitorPre, VISITOR_POST &visitorPost)
const FastVector< sharedFactor > & remainingFactors() const
boost::shared_ptr< This > shared_ptr
Typedef to the conditional base class.
JunctionTree< BAYESTREE, GRAPH >::Node Node
boost::shared_ptr< This > shared_ptr
ConstructorTraversalData(ConstructorTraversalData *_parentData)
A Cluster is just a collection of factors.
ConstructorTraversalData *const parentData
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
static ConstructorTraversalData ConstructorTraversalVisitorPre(const boost::shared_ptr< ETREE_NODE > &node, ConstructorTraversalData &parentData)
void reserve(size_t size)
FastVector< SymbolicConditional::shared_ptr > childSymbolicConditionals
std::pair< boost::shared_ptr< SymbolicConditional >, boost::shared_ptr< SymbolicFactor > > EliminateSymbolic(const FactorGraph< FACTOR > &factors, const Ordering &keys)
FastVector< SymbolicFactor::shared_ptr > childSymbolicFactors