aGrUM  0.14.2
graphChangesGenerator4DiGraph.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}@lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it wil be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
58 #ifndef GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_DIGRAPH_H
59 #define GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_DIGRAPH_H
60 
61 #include <agrum/agrum.h>
62 #include <agrum/core/OMPThreads.h>
63 #include <agrum/core/set.h>
64 #include <agrum/graphs/diGraph.h>
67 
68 namespace gum {
69 
70  namespace learning {
71 
113  template < typename STRUCT_CONSTRAINT >
115  public:
118 
121 
122  // ##########################################################################
124  // ##########################################################################
126 
128  GraphChangesGenerator4DiGraph(STRUCT_CONSTRAINT& constraint);
129 
133 
137 
140 
142 
143  // ##########################################################################
145  // ##########################################################################
147 
151 
155 
157 
158  // ##########################################################################
160  // ##########################################################################
162 
164  iterator begin() const;
165 
167  const iterator& end() const;
168 
170 
171  // ##########################################################################
173  // ##########################################################################
175 
177  STRUCT_CONSTRAINT& constraint() const noexcept;
178 
181  void setGraph(const DiGraph& graph);
182 
184  void modifyGraph(const ArcAddition& change);
185 
187  void modifyGraph(const ArcDeletion& change);
188 
190  void modifyGraph(const ArcReversal& change);
191 
193  void modifyGraph(const GraphChange& change);
194 
196  void clearChanges() noexcept;
197 
199  void notifyGetCompleted();
200 
202  void setMaxNbThreads(Size nb) noexcept;
203 
205 
206  protected:
209 
211  STRUCT_CONSTRAINT* _constraint;
212 
215 
217  void _createChanges();
218 
219  private:
221 #if defined(_OPENMP) && !defined(GUM_DEBUG_MODE)
223 #else
225 #endif /* GUM_DEBUG_MODE */
226  };
227 
228  } /* namespace learning */
229 
230 } /* namespace gum */
231 
234 
235 #endif /* GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_DIGRAPH_H */
The base class for all GraphChangesGenerators for directed structures.
Base classes for oriented graphs.
iterator const_iterator
the const iterator for parsing the list of graph change operators
Sets of elements (i.e.
the classes to account for structure changes in a graph
The class for notifying learning algorithms of new arc additionsThis class is convenient to know at c...
Definition: graphChange.h:147
Size __max_threads_number
the max number of threads authorized
void modifyGraph(const ArcAddition &change)
notify the generator of a change applied to the graph
The class for notifying learning algorithms of arc removalsThis class is convenient to know at compil...
Definition: graphChange.h:213
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
void setMaxNbThreads(Size nb) noexcept
sets the maximum number of threads used to compute the set of changes
void setGraph(const DiGraph &graph)
sets a new graph from which the generator will compute possible changes
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
const iterator & end() const
returns an (unsafe) iterator on the end of the list of operators
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
iterator begin() const
returns an (unsafe) iterator on the beginning of the list of operators
DiGraph _graph
the graph on which we generate operators
Set< GraphChange > _legal_changes
the current set of graph changes
Base class for all oriented graphs.
Definition: diGraph.h:108
virtual ~GraphChangesGenerator4DiGraph()
destructor
The basic class for computing the next graph changes possible in a structure learning algorithm...
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
STRUCT_CONSTRAINT & constraint() const noexcept
returns the constraint that is used by the generator
Wrappers for OpenMP.
GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT > & operator=(const GraphChangesGenerator4DiGraph< STRUCT_CONSTRAINT > &from)
copy operator
Unsafe iterators for the Set class.
Definition: set.h:1022
GraphChangesGenerator4DiGraph(STRUCT_CONSTRAINT &constraint)
default constructor
void clearChanges() noexcept
empty the set of possible change operators that can be applied
The class for notifying learning algorithms of arc reversalsThis class is convenient to know at compi...
Definition: graphChange.h:279
STRUCT_CONSTRAINT * _constraint
the structural constraint used to restrict the changes
The basic class for computing the next graph changes possible in a (directed) structure learning algo...
void _createChanges()
create the set of legal and illegal changes from a given graph
void notifyGetCompleted()
notifies the generator that we have parsed all its legal changes
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45