33 #include <agrum/tools/core/hashTable.h> 34 #include <agrum/tools/core/set.h> 36 #include <agrum/PRM/PRM.h> 37 #include <agrum/PRM/inference/PRMInference.h> 39 #ifndef GUM_STRUCTURED_BB_H 40 # define GUM_STRUCTURED_BB_H 49 template <
typename GUM_SCALAR >
50 class StructuredBayesBall {
58 StructuredBayesBall(
const PRMInference< GUM_SCALAR >& inference);
61 ~StructuredBayesBall();
70 const std::string& key(
const PRMInstance< GUM_SCALAR >* i)
const;
73 const std::string& key(
const PRMInstance< GUM_SCALAR >& i)
const;
77 requisiteNodes(
const PRMInstance< GUM_SCALAR >* i)
const;
81 requisiteNodes(
const PRMInstance< GUM_SCALAR >& i)
const;
85 Size occurrence(
const std::string& key)
const;
89 float liftRatio()
const;
92 bool exists(
const PRMInstance< GUM_SCALAR >* i)
const;
95 bool exists(
const PRMInstance< GUM_SCALAR >& i)
const;
102 void compute(
const PRMInstance< GUM_SCALAR >* i, NodeId n);
107 void compute(
const PRMInstance< GUM_SCALAR >& i, NodeId n);
110 bool isHardEvidence__(
const PRMInstance< GUM_SCALAR >* i, NodeId n);
114 StructuredBayesBall(
const StructuredBayesBall& source);
117 StructuredBayesBall& operator=(
const StructuredBayesBall& source);
120 typedef HashTable< NodeId, std::pair<
bool,
bool > > MarkMap;
122 typedef HashTable<
const PRMInstance< GUM_SCALAR >*, MarkMap* > InstanceMap;
124 std::pair<
bool,
bool >& getMark__(InstanceMap& marks,
125 const PRMInstance< GUM_SCALAR >* i,
128 const PRMSlotChain< GUM_SCALAR >& getSC__(
const PRMInstance< GUM_SCALAR >* i,
135 void compute__(
const PRMInstance< GUM_SCALAR >* i, NodeId n);
138 void fromChild__(
const PRMInstance< GUM_SCALAR >* i,
143 void fromParent__(
const PRMInstance< GUM_SCALAR >* i,
148 void fillMaps__(InstanceMap& marks);
151 std::string buildHashKey__(
const PRMInstance< GUM_SCALAR >* i,
152 Set< NodeId >& req_nodes);
155 const PRMInference< GUM_SCALAR >* inf__;
161 HashTable<
const PRMInstance< GUM_SCALAR >*,
162 std::pair< std::string, Set< NodeId >* > >
167 HashTable< std::string, std::pair< Set< NodeId >*, Size > > reqMap__;
171 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 172 extern template class StructuredBayesBall<
double >;
179 # include <agrum/PRM/inference/structuredBayesBall_tpl.h>