aGrUM  0.16.0
graphChangesGenerator4K2.h
Go to the documentation of this file.
1 
61 #ifndef GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_K2_H
62 #define GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_K2_H
63 
64 #include <agrum/agrum.h>
65 #include <agrum/core/OMPThreads.h>
66 #include <agrum/core/sequence.h>
67 #include <agrum/core/set.h>
68 
69 #include <agrum/graphs/diGraph.h>
72 
73 namespace gum {
74 
75  namespace learning {
76 
77  // a dummy class used to check that the generator is adapted to K2
79 
120  template < typename STRUCT_CONSTRAINT >
124  public:
127 
130 
131  // ##########################################################################
133  // ##########################################################################
135 
137  GraphChangesGenerator4K2(STRUCT_CONSTRAINT& constraint);
138 
142 
146 
148  virtual ~GraphChangesGenerator4K2();
149 
151 
152  // ##########################################################################
154  // ##########################################################################
156 
159  operator=(const GraphChangesGenerator4K2< STRUCT_CONSTRAINT >& from);
160 
164 
166 
167  // ##########################################################################
169  // ##########################################################################
171 
173  iterator begin() const;
174 
176  const iterator& end() const;
177 
179 
180  // ##########################################################################
182  // ##########################################################################
184 
186  STRUCT_CONSTRAINT& constraint() const noexcept;
187 
190  void setGraph(const DiGraph& graph);
191 
193  void modifyGraph(const ArcAddition& change);
194 
196  void modifyGraph(const ArcDeletion& change);
197 
199  void modifyGraph(const ArcReversal& change);
200 
202  void modifyGraph(const GraphChange& change);
203 
205  void clearChanges() noexcept;
206 
208  void notifyGetCompleted();
209 
211  void setMaxNbThreads(Size nb) noexcept;
212 
214  void setOrder(const Sequence< NodeId >& order);
215 
217  void setOrder(const std::vector< NodeId >& order);
218 
220 
221  protected:
223  DiGraph _graph;
224 
226  STRUCT_CONSTRAINT* _constraint;
227 
229  Sequence< NodeId > _order;
230 
232  Set< GraphChange > _legal_changes;
233 
235  void _createChanges();
236 
237  private:
239 #if defined(_OPENMP) && !defined(GUM_DEBUG_MODE)
240  Size __max_threads_number{getMaxNumberOfThreads()};
241 #else
242  Size __max_threads_number{1};
243 #endif /* GUM_DEBUG_MODE */
244  };
245 
246  } /* namespace learning */
247 
248 } /* namespace gum */
249 
252 
253 #endif /* GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_K2_H */
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
The class for notifying learning algorithms of new arc additionsThis class is convenient to know at c...
Definition: graphChange.h:150
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1022
The class for notifying learning algorithms of arc removalsThis class is convenient to know at compil...
Definition: graphChange.h:216
STL namespace.
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:165
Base class for all oriented graphs.
Definition: diGraph.h:111
iterator const_iterator
the const iterator for parsing the list of graph change operators
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Unsafe iterators for the Set class.
Definition: set.h:1025
The class for notifying learning algorithms of arc reversalsThis class is convenient to know at compi...
Definition: graphChange.h:282
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
The basic class for computing the next graph changes possible in a structure learning algorithm...
Size NodeId
Type for node ids.
Definition: graphElements.h:98