89 pairIter != leafIter.val()->endSafe();
93 leafIter.val()->erase(curPair);
96 delete leafIter.val();
125 (leafIter.val())->insert(p);
147 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())) {
152 if ((*fusIter)->addPair(*pairIter))
_removeContext_(fusIter.pos() + 1);
157 bag << (*fusIter)->leafAssociatedPair(l);
172 (*pairIter)->updateLikelyhood();
182 if ((*fusIter)->leaf()->contains(curLeaf->
id())) {
184 if ((*fusIter)->updateAllAssociatedLeaves())
_removeContext_(fusIter.pos() + 1);
185 bag = (*fusIter)->associatedPairs();
186 curLeaf = (*fusIter)->leaf();
192 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())
193 || (*fusIter)->leaf()->contains((*pairIter)->firstLeaf()->id())) {
198 if ((*fusIter)->updatePair(*pairIter))
_removeContext_(fusIter.pos() + 1);
200 if ((*fusIter)->updateAssociatedLeaf(curLeaf))
_removeContext_(fusIter.pos() + 1);
201 bag << (*fusIter)->leafAssociatedPair(curLeaf);
217 (*
_leaf2Pair_[(*pairIter)->otherLeaf(l)]) >> *pairIter;
228 if ((*fusIter)->leaf()->contains((*pairIter)->secondLeaf()->id())
229 || (*fusIter)->leaf()->contains((*pairIter)->firstLeaf()->id())) {
234 if ((*fusIter)->removePair(*pairIter)) {
_removeContext_(fusIter.pos() + 1); }
237 bag << (*fusIter)->leafAssociatedPair(l);
238 toBeDeleted << (*fusIter)->leafAssociatedPair(l);
240 if ((*fusIter)->deassociateLeaf(l)) {
_removeContext_(fusIter.pos() + 1); }
244 pairIter != toBeDeleted.
endSafe();
276 for (
pair_iterator pairIter = pb; pairIter != pe; ++pairIter) {
277 if (!newLeaf->
contains(pairIter.key()->firstLeaf()->id())
278 && !newLeaf->
contains(pairIter.key()->secondLeaf()->id()))
279 newContext->
addPair(pairIter.key());
280 if (!newLeaf->
contains(pairIter.key()->firstLeaf()->id())
283 if (!newLeaf->
contains(pairIter.key()->secondLeaf()->id())
301 bool alreadyIn =
false;
305 if (mapIter.val()->contains((*fusIter)->leaf()->id())) {
309 if (!alreadyIn) retMap.
insert((*fusIter)->leaf()->id(), (*fusIter)->leaf());
319 if (mapIter.val()->contains(leafIter.key()->id())) {
320 retMap.
insert(leafIter.key()->id(), mapIter.val());
323 if (!retMap.
exists(leafIter.key()->id())) retMap.
insert(leafIter.key()->id(), leafIter.key());
331 = std::format(
"################\nTas Initial : \n{}\n",
_initialContext_->toString());
333 ss += std::format(
"################\nTas {} : \n{}", fusIter.pos(), (*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.
iterator_safe beginSafe()
Returns the safe iterator pointing to the beginning of 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.
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.
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 * otherLeaf(AbstractLeaf *l) const
void updateLikelyhood()
Updates GStatistic.
double likelyhood()
Updates GStatistic.
AbstractLeaf * convert2Leaf(NodeId leafId) const
Returns a leaf matching data and having given id as id.
Class for node sets in graph.
Safe iterators for Sequence.
Safe iterators for the Set class.
void clear()
Removes all the elements, if any, from the set.
void insert(const Key &k)
Inserts a new element into the set.
iterator_safe beginSafe() const
The usual safe begin iterator to parse the set.
static const iterator_safe & endSafe() noexcept
The usual safe end iterator to parse 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