85 pairIter != leafIter.val()->endSafe();
89 leafIter.val()->erase(curPair);
92 delete leafIter.val();
121 (leafIter.val())->insert(p);
143 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())) {
148 if ((*fusIter)->addPair(*pairIter))
_removeContext_(fusIter.pos() + 1);
153 bag << (*fusIter)->leafAssociatedPair(l);
168 (*pairIter)->updateLikelyhood();
178 if ((*fusIter)->leaf()->contains(curLeaf->
id())) {
180 if ((*fusIter)->updateAllAssociatedLeaves())
_removeContext_(fusIter.pos() + 1);
181 bag = (*fusIter)->associatedPairs();
182 curLeaf = (*fusIter)->leaf();
188 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())
189 || (*fusIter)->leaf()->contains((*pairIter)->firstLeaf()->id())) {
194 if ((*fusIter)->updatePair(*pairIter))
_removeContext_(fusIter.pos() + 1);
196 if ((*fusIter)->updateAssociatedLeaf(curLeaf))
_removeContext_(fusIter.pos() + 1);
197 bag << (*fusIter)->leafAssociatedPair(curLeaf);
213 (*
_leaf2Pair_[(*pairIter)->otherLeaf(l)]) >> *pairIter;
224 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())
225 || (*fusIter)->leaf()->contains((*pairIter)->firstLeaf()->id())) {
230 if ((*fusIter)->removePair(*pairIter)) {
_removeContext_(fusIter.pos() + 1); }
233 bag << (*fusIter)->leafAssociatedPair(l);
234 toBeDeleted << (*fusIter)->leafAssociatedPair(l);
236 if ((*fusIter)->deassociateLeaf(l)) {
_removeContext_(fusIter.pos() + 1); }
240 pairIter != toBeDeleted.
endSafe();
272 for (
pair_iterator pairIter = pb; pairIter != pe; ++pairIter) {
273 if (!newLeaf->
contains(pairIter.key()->firstLeaf()->id())
274 && !newLeaf->
contains(pairIter.key()->secondLeaf()->id()))
275 newContext->
addPair(pairIter.key());
276 if (!newLeaf->
contains(pairIter.key()->firstLeaf()->id())
279 if (!newLeaf->
contains(pairIter.key()->secondLeaf()->id())
297 bool alreadyIn =
false;
301 if (mapIter.val()->contains((*fusIter)->leaf()->id())) {
305 if (!alreadyIn) retMap.
insert((*fusIter)->leaf()->id(), (*fusIter)->leaf());
315 if (mapIter.val()->contains(leafIter.key()->id())) {
316 retMap.
insert(leafIter.key()->id(), mapIter.val());
319 if (!retMap.
exists(leafIter.key()->id())) retMap.
insert(leafIter.key()->id(), leafIter.key());
326 std::stringstream ss;
327 ss <<
"################\nTas Initial : " << std::endl
331 ss <<
"################\nTas " << fusIter.pos() <<
" : " << std::endl
332 << (*fusIter)->toString();
Safe Iterators for hashtables.
<agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
virtual bool contains(NodeId testedId) const
Returns true if abstractleaf has leaf in it.
bool addPair(LeafPair *p)
bool containsAssociatedLeaf(AbstractLeaf *l)
bool associateLeaf(AbstractLeaf *l)
Safe Const Iterators for hashtables.
The class for generic Hash Tables.
const iterator_safe & endSafe() noexcept
Returns the safe iterator pointing to the end of the hashtable.
bool exists(const Key &key) const
Checks whether there exists an element with a given key in the hashtable.
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
iterator_safe beginSafe()
Returns the safe iterator pointing to the beginning of the hashtable.
Sequence< FusionContext< false > * > _fusionSeq_
void _addInitialPair_(LeafPair *)
void _updateInitialPair_(LeafPair *)
bool updateLeaf(AbstractLeaf *)
LeafAggregator(NodeGraphPart *idSource, double similarityThreshold)
Default constructor.
void _removeContext_(Idx)
void removeLeaf(AbstractLeaf *)
HashTable< AbstractLeaf *, Set< LeafPair * > * > _leaf2Pair_
~LeafAggregator()
Default destructor.
double _similarityThreshold_
NodeGraphPart * _leavesCpt_
FusionContext< true > * _initialContext_
void _removeInitialPair_(LeafPair *)
HashTable< NodeId, AbstractLeaf * > leavesMap()
void addLeaf(AbstractLeaf *)
<agrum/FMDP/learning/datastructure/leaves/leafPair.h>
AbstractLeaf * convert2Leaf(NodeId leafId) const
Returns a leaf matching data and having given id as id.
void updateLikelyhood()
Updates GStatistic.
AbstractLeaf * otherLeaf(AbstractLeaf *l) const
double likelyhood()
Updates GStatistic.
Class for node sets in graph.
Safe iterators for Sequence.
Safe iterators for the Set class.
iterator_safe beginSafe() const
The usual safe begin iterator to parse the set.
const iterator_safe & endSafe() const noexcept
The usual safe end iterator to parse the set.
void insert(const Key &k)
Inserts a new element into the set.
void clear()
Removes all the elements, if any, from the set.
Size Idx
Type for indexes.
Headers of the Leaf Aggregator class.
gum is the global namespace for all aGrUM entities
HashTableConstIteratorSafe< LeafPair *, std::vector< Size > > pair_iterator