aGrUM  0.14.2
graphChangesGenerator4UndiGraph.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  ***************************************************************************/
53 #ifndef GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_UNDIGRAPH_H
54 #define GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_UNDIGRAPH_H
55 
56 #include <agrum/agrum.h>
57 #include <agrum/core/OMPThreads.h>
58 #include <agrum/core/set.h>
59 #include <agrum/graphs/undiGraph.h>
62 
63 namespace gum {
64 
65  namespace learning {
66 
107  template < typename STRUCT_CONSTRAINT >
110  public:
113 
116 
117  // ##########################################################################
119  // ##########################################################################
121 
123  GraphChangesGenerator4UndiGraph(STRUCT_CONSTRAINT& constraint);
124 
128 
132 
135 
137 
138  // ##########################################################################
140  // ##########################################################################
142 
146 
150 
152 
153  // ##########################################################################
155  // ##########################################################################
157 
159  iterator begin() const;
160 
162  const iterator& end() const;
163 
165 
166  // ##########################################################################
168  // ##########################################################################
170 
172  STRUCT_CONSTRAINT& constraint() const noexcept;
173 
175  void setGraph(const UndiGraph& graph);
176 
178  void modifyGraph(const EdgeAddition& change);
179 
181  void modifyGraph(const EdgeDeletion& change);
182 
184  void modifyGraph(const GraphChange& change);
185 
187  void clearChanges() noexcept;
188 
190  void notifyGetCompleted();
191 
193  void setMaxNbThreads(Size nb) noexcept;
194 
196 
197  protected:
200 
202  STRUCT_CONSTRAINT* _constraint;
203 
206 
208  void _createChanges();
209 
210  private:
212 #if defined(_OPENMP) && !defined(GUM_DEBUG_MODE)
214 #else
216 #endif /* GUM_DEBUG_MODE */
217  };
218 
219  } /* namespace learning */
220 
221 } /* namespace gum */
222 
225 
226 #endif /* GUM_LEARNING_GRAPH_CHANGES_GENERATOR_4_UNDIGRAPH_H */
The base class for all GraphChangesGenerators for undirected structures.
The basic class for computing the next graph changes possible in an undirected structure learning alg...
void _createChanges()
create the set of legal and illegal changes from a given graph
Sets of elements (i.e.
void notifyGetCompleted()
notifies the generator that we have parsed all its legal changes
the classes to account for structure changes in a graph
void setGraph(const UndiGraph &graph)
sets a new graph from which the operator will compute possible changes
iterator begin() const
returns an (unsafe) iterator on the beginning of the list of operators
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
STRUCT_CONSTRAINT * _constraint
a reference on the structural constraint used to restrict the changes
Base classes for undirected graphs.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
GraphChangesGenerator4UndiGraph(STRUCT_CONSTRAINT &constraint)
default constructor
iterator const_iterator
the const iterator for parsing the list of graph change operators
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
The class for notifying learning algorithms of edge removalsThis class is convenient to know at compi...
Definition: graphChange.h:411
UndiGraph _graph
the graph on which we generate operators
void clearChanges() noexcept
empty the set of possible change operators that can be applied
Set< GraphChange > _legal_changes
the current set of operators
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
The class for notifying learning algorithms of new edge additionsThis class is convenient to know at ...
Definition: graphChange.h:345
Size __max_threads_number
the max number of threads authorized
void setMaxNbThreads(Size nb) noexcept
sets the maximum number of threads used to compute the set of changes
Wrappers for OpenMP.
Unsafe iterators for the Set class.
Definition: set.h:1022
STRUCT_CONSTRAINT & constraint() const noexcept
returns the constraint that is used by the generator
Base class for undirected graphs.
Definition: undiGraph.h:106
GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT > & operator=(const GraphChangesGenerator4UndiGraph< STRUCT_CONSTRAINT > &from)
copy operator
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
void modifyGraph(const EdgeAddition &change)
notify the operator set of a change applied to the graph
The basic class for computing the next graph changes possible in an undirected structure learning alg...
const iterator & end() const
returns an (unsafe) iterator on the end of the list of operators