30 #ifndef GUM_FUSION_CONTEXT_H 31 #define GUM_FUSION_CONTEXT_H 33 #include <agrum/tools/core/multiPriorityQueue.h> 35 #include <agrum/tools/graphs/graphElements.h> 37 #include <agrum/FMDP/learning/core/templateStrategy.h> 38 #include <agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h> 39 #include <agrum/FMDP/learning/datastructure/leaves/leafPair.h> 55 template <
bool isInitial =
false >
76 void*
operator new(size_t s) {
return SmallObjectAllocator::instance().allocate(s); }
78 SmallObjectAllocator::instance().deallocate(p,
sizeof(FusionContext));
93 return _containsAssociatedLeaf_(l, Int2Type< isInitial >());
98 return _leaf2Pair_.exists(l);
106 bool associateLeaf(AbstractLeaf* l) {
return _associateLeaf_(l, Int2Type< isInitial >()); }
118 return _updateAssociatedLeaf_(l, Int2Type< isInitial >());
127 return _updateAllAssociatedLeaves_(Int2Type< isInitial >());
141 bool deassociateLeaf(AbstractLeaf* l) {
return _deassociateLeaf_(l, Int2Type< isInitial >()); }
184 LeafPair*
top() {
return !_pairsHeap_.empty() ? _pairsHeap_.top() :
nullptr; }
189 double topLikelyhood() {
return !_pairsHeap_.empty() ? _pairsHeap_.topPriority() : 1.0; }
233 #include <agrum/FMDP/learning/datastructure/leaves/fusionContext_tpl.h> MultiPriorityQueue< LeafPair *, double, std::less< double > > _pairsHeap_
bool _containsAssociatedLeaf_(AbstractLeaf *, Int2Type< true >)
void operator delete(void *p)
Default constructor.
INLINE void emplace(Args &&... args)
bool removePair(LeafPair *p)
Set< LeafPair *> _associatedPairs_(Int2Type< true >)
void * operator new(size_t s)
Allocators and Deallocators redefinition.
bool _deassociateLeaf_(AbstractLeaf *, Int2Type< true >)
LeafPair * leafAssociatedPair(AbstractLeaf *l)
bool _updateAllAssociatedLeaves_(Int2Type< true >)
Set< LeafPair *> associatedPairs()
FusionContext(AbstractLeaf *)
Default constructor.
HashTable< AbstractLeaf *, LeafPair *> _leaf2Pair_
bool _associateLeaf_(AbstractLeaf *, Int2Type< true >)
bool _updateAssociatedLeaf_(AbstractLeaf *, Int2Type< true >)
bool addPair(LeafPair *p)
bool deassociateLeaf(AbstractLeaf *l)
bool containsAssociatedLeaf(AbstractLeaf *l)
bool updateAllAssociatedLeaves()
~FusionContext()
Default destructor.
bool associateLeaf(AbstractLeaf *l)
bool updateAssociatedLeaf(AbstractLeaf *l)
bool updatePair(LeafPair *p)
pair_iterator beginPairs()