aGrUM  0.16.0
graphChangesGeneratorOnSubDiGraph.h
Go to the documentation of this file.
1 
50 #ifndef GUM_LEARNING_GRAPH_CHANGES_GENERATOR_ON_SUBDIGRAPH_H
51 #define GUM_LEARNING_GRAPH_CHANGES_GENERATOR_ON_SUBDIGRAPH_H
52 
53 #include <agrum/agrum.h>
54 #include <agrum/core/OMPThreads.h>
55 #include <agrum/core/set.h>
56 #include <agrum/graphs/diGraph.h>
59 
60 namespace gum {
61 
62  namespace learning {
63 
94  template < typename STRUCT_CONSTRAINT >
97  public:
100 
103 
104  // ##########################################################################
106  // ##########################################################################
108 
110  GraphChangesGeneratorOnSubDiGraph(STRUCT_CONSTRAINT& constraint);
111 
115 
119 
122 
124 
125  // ##########################################################################
127  // ##########################################################################
129 
133 
137 
139 
140  // ##########################################################################
142  // ##########################################################################
144 
146  iterator begin() const;
147 
149  const iterator& end() const;
150 
152 
153  // ##########################################################################
155  // ##########################################################################
157 
159  STRUCT_CONSTRAINT& constraint() const noexcept;
160 
162  void setGraph(const DiGraph& graph);
163 
165  void setTargets(const NodeSet& nodes);
166 
168  void addTarget(NodeId node);
169 
171  void eraseTarget(NodeId node);
172 
174  void setTails(const NodeSet& nodes);
175 
177  void setTails(Size nb_nodes);
178 
180  void addTail(NodeId node);
181 
183  void eraseTail(NodeId node);
184 
186  void modifyGraph(const ArcAddition& change);
187 
189  void modifyGraph(const ArcDeletion& change);
190 
192  void modifyGraph(const ArcReversal& change);
193 
195  void modifyGraph(const GraphChange& change);
196 
198  void clearChanges() noexcept;
199 
201  void notifyGetCompleted();
202 
204  void setMaxNbThreads(Size nb) noexcept;
205 
207 
208  protected:
210  STRUCT_CONSTRAINT* _constraint;
211 
214 
217 
220 
222  void _createChanges();
223 
224  private:
226 #if defined(_OPENMP) && !defined(GUM_DEBUG_MODE)
228 #else
230 #endif /* GUM_DEBUG_MODE */
231  };
232 
233  } /* namespace learning */
234 
235 } /* namespace gum */
236 
239 
240 #endif /* GUM_LEARNING_GRAPH_CHANGES_GENERATOR_ON_SUBDIGRAPH_H */
GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & operator=(const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > &from)
copy operator
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.
NodeSet _tail_nodes
the tail nodes (other extremities than the targets)
STRUCT_CONSTRAINT & constraint() const noexcept
returns the constraint that is used by the generator
The basic class for computing the next graph changes possible in a structure learning algorithm...
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
Set< GraphChange > _legal_changes
the current set of operators
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void eraseTarget(NodeId node)
removes a target
GraphChangesGeneratorOnSubDiGraph(STRUCT_CONSTRAINT &constraint)
default constructor
void eraseTail(NodeId node)
removes a tail node
The class for notifying learning algorithms of arc removalsThis class is convenient to know at compil...
Definition: graphChange.h:216
unsigned int getMaxNumberOfThreads()
Returns the maximum number of threads at any time.
const iterator & end() const
returns an (unsafe) iterator on the end of the list of operators
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
void setTails(const NodeSet &nodes)
assign a set of "tail" nodes
void modifyGraph(const ArcAddition &change)
notify the operator set of a change applied to the graph
void clearChanges() noexcept
empty the set of possible change operators that can be applied
Size __max_threads_number
the max number of threads authorized
void setGraph(const DiGraph &graph)
sets a new graph from which the operator will compute possible changes
iterator const_iterator
the const iterator for parsing the list of graph change operators
void _createChanges()
create the set of legal and illegal changes from a given graph
iterator begin() const
returns an (unsafe) iterator on the beginning of the list of operators
Base class for all oriented graphs.
Definition: diGraph.h:111
STRUCT_CONSTRAINT * _constraint
a reference on the structural constraint used to restrict the changes
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
void setMaxNbThreads(Size nb) noexcept
sets the maximum number of threads used to compute the set of changes
The class for notifying learning algorithms of arc reversalsThis class is convenient to know at compi...
Definition: graphChange.h:282
void setTargets(const NodeSet &nodes)
assign a set of target nodes
void addTarget(NodeId node)
adds a new target node
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
void addTail(NodeId node)
adds a new "tail" node
Size NodeId
Type for node ids.
Definition: graphElements.h:98
typename Set< GraphChange >::const_iterator iterator
the iterator for parsing the list of possible graph change operators
void notifyGetCompleted()
notifies the generator that we have parsed all its legal changes