aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
leafAggregator.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Headers of the Leaf Aggregator class.
25  *
26  * @author Jean-Christophe MAGNAN
27  */
28 
29 // =========================================================================
30 #ifndef GUM_LEAF_AGGREGATOR_H
31 #define GUM_LEAF_AGGREGATOR_H
32 // =========================================================================
33 #include <agrum/tools/core/hashTable.h>
34 #include <agrum/tools/core/multiPriorityQueue.h>
35 #include <agrum/tools/core/sequence.h>
36 // =========================================================================
37 #include <agrum/tools/graphs/graphElements.h>
38 #include <agrum/tools/graphs/parts/nodeGraphPart.h>
39 // =========================================================================
40 #include <agrum/tools/multidim/utils/FunctionGraphUtilities/link.h>
41 // =========================================================================
42 #include <agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
43 #include <agrum/FMDP/learning/datastructure/leaves/concreteLeaf.h>
44 #include <agrum/FMDP/learning/datastructure/leaves/fusionContext.h>
45 #include <agrum/FMDP/learning/datastructure/leaves/leafPair.h>
46 // =========================================================================
47 
48 namespace gum {
49 
50  /**
51  * @class LeafAggregator leafAggregator.h
52  * <agrum/FMDP/learning/FunctionGraph/leafAggregator.h>
53  * @brief Gather together leaves with similar distributions
54  * @ingroup fmdp_group
55  *
56  */
57 
58 
60  public:
61  // ==========================================================================
62  /// @name Constructor & destructor.
63  // ==========================================================================
64  /// @{
65 
66  // ###################################################################
67  /// Default constructor
68  // ###################################################################
69  LeafAggregator(NodeGraphPart* idSource, double similarityThreshold);
70 
71  // ###################################################################
72  /// Default destructor
73  // ###################################################################
74  ~LeafAggregator();
75 
76  /// @}
77 
78  // ==========================================================================
79  /// @name Leaf Handling methods
80  // ==========================================================================
81  /// @{
82 
83  // ###################################################################
84  ///
85  // ###################################################################
86  void addLeaf(AbstractLeaf*);
87 
88  // ###################################################################
89  ///
90  // ###################################################################
91  bool updateLeaf(AbstractLeaf*);
92 
93  // ###################################################################
94  ///
95  // ###################################################################
96  void removeLeaf(AbstractLeaf*);
97 
98  /// @}
99 
100  // ==========================================================================
101  /// @name
102  // ==========================================================================
103  /// @{
104 
105  // ###################################################################
106  ///
107  // ###################################################################
108  void begin();
109 
110  // ###################################################################
111  ///
112  // ###################################################################
113  bool hasNext();
114 
115  // ###################################################################
116  ///
117  // ###################################################################
118  double next();
119 
120  /// @}
121 
122  void update();
123 
124  bool needsUpdate() { return _needsUpdate_; }
125 
127 
128  std::string toString();
129 
130  private:
131  void _removeContext_(Idx);
132  void _addInitialPair_(LeafPair*);
135 
137 
139 
141 
143 
146  };
147 
148 
149 } /* namespace gum */
150 
151 
152 #endif // GUM_LEAF_AGGREGATOR_H
std::string toString()
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
HashTable< AbstractLeaf *, Set< LeafPair *> *> _leaf2Pair_
FusionContext< true > * _initialContext_
NodeGraphPart * _leavesCpt_
~LeafAggregator()
Default destructor.
LeafAggregator(NodeGraphPart *idSource, double similarityThreshold)
Default constructor.
HashTable< NodeId, AbstractLeaf *> leavesMap()
void _removeInitialPair_(LeafPair *)
void _addInitialPair_(LeafPair *)
void removeLeaf(AbstractLeaf *)
void _updateInitialPair_(LeafPair *)
bool updateLeaf(AbstractLeaf *)
void addLeaf(AbstractLeaf *)