aGrUM  0.16.0
structuralConstraintIndegree.h
Go to the documentation of this file.
1 
29 #ifndef GUM_LEARNING_STRUCTURAL_CONSTRAINT_INDEGREE_H
30 #define GUM_LEARNING_STRUCTURAL_CONSTRAINT_INDEGREE_H
31 
32 #include <limits>
33 
34 #include <agrum/agrum.h>
37 
38 namespace gum {
39 
40  namespace learning {
41 
50  : protected virtual StructuralConstraintSetStatic<
51  StructuralConstraintDiGraph > {
52  public:
53  // ##########################################################################
55  // ##########################################################################
57 
60 
62  StructuralConstraintIndegree(Size nb_nodes, Size max_indegree);
63 
65  StructuralConstraintIndegree(const DiGraph& graph, Size max_indegree);
66 
69 
72 
75 
77 
78  // ##########################################################################
80  // ##########################################################################
82 
86 
89 
91 
92  // ##########################################################################
94  // ##########################################################################
96 
98  void setIndegree(const NodeProperty< Size >& max_indegree);
99 
102  void setMaxIndegree(Size max_indegree, bool update_all_node = false);
103 
105  void setGraphAlone(const DiGraph& graph);
106 
108 
114  void modifyGraphAlone(const ArcAddition& change);
115 
117 
119  void modifyGraphAlone(const ArcDeletion& change);
120 
122 
128  void modifyGraphAlone(const ArcReversal& change);
129 
131 
137  void modifyGraphAlone(const GraphChange& change);
138 
140 
153  bool isAlwaysInvalidAlone(const GraphChange& change) const;
154 
156 
159  bool checkArcAdditionAlone(NodeId x, NodeId y) const;
160 
162 
163  bool checkArcDeletionAlone(NodeId x, NodeId y) const;
164 
166 
169  bool checkArcReversalAlone(NodeId x, NodeId y) const;
170 
172 
175  bool checkModificationAlone(const ArcAddition& change) const;
176 
178 
179  bool checkModificationAlone(const ArcDeletion& change) const;
180 
182 
185  bool checkModificationAlone(const ArcReversal& change) const;
186 
188 
195  bool checkModificationAlone(const GraphChange& change) const;
196 
198 
199 #ifndef DOXYGEN_SHOULD_SKIP_THIS
200 // include the set of methods that enable the structural constraint to
201 // be standalone, i.e., that it needs not be included into a
202 // StructuralConstraintSetStatic to be used by learning algorithms
203 # define GUM_CONSTRAINT_CLASS_NAME StructuralConstraintIndegree
205 # undef GUM_CONSTRAINT_CLASS_NAME
206 #endif // DOXYGEN_SHOULD_SKIP_THIS
207 
208  protected:
211 
213  Size _Indegree__max_indegree{std::numeric_limits< Size >::max()};
214  };
215 
216  } /* namespace learning */
217 
218 } /* namespace gum */
219 
221 #ifndef GUM_NO_INLINE
223 #endif /* GUM_NO_INLINE */
224 
225 #endif /* GUM_LEARNING_STRUCTURAL_CONSTRAINT_INDEGREE_H */
void setIndegree(const NodeProperty< Size > &max_indegree)
sets the default max indegree for all the nodes in the property
the class for structural constraints limiting the number of parents of nodes in a directed graph ...
bool checkModificationAlone(const ArcAddition &change) const
checks whether the constraints enable to add an arc
The class for notifying learning algorithms of new arc additionsThis class is convenient to know at c...
Definition: graphChange.h:150
void setMaxIndegree(Size max_indegree, bool update_all_node=false)
resets the default max indegree and possibly updates the indegree of all nodes
The class for notifying learning algorithms of arc removalsThis class is convenient to know at compil...
Definition: graphChange.h:216
bool isAlwaysInvalidAlone(const GraphChange &change) const
indicates whether a change will always violate the constraint
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.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
Size _Indegree__max_indegree
a default max indegree to assign for nodes without specified indegree
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
the "meta-programming" class for storing structural constraintsIn aGrUM, there are two ways to store ...
bool checkArcDeletionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to remove arc (x,y)
bool checkArcAdditionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to add arc (x,y)
Base class for all oriented graphs.
Definition: diGraph.h:111
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
NodeProperty< Size > _Indegree__max_parents
the max number of parents per node
The class for notifying learning algorithms of arc reversalsThis class is convenient to know at compi...
Definition: graphChange.h:282
void modifyGraphAlone(const ArcAddition &change)
notify the constraint of a modification of the graph
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
void setGraphAlone(const DiGraph &graph)
sets a new graph from which we will perform checkings
StructuralConstraintIndegree & operator=(const StructuralConstraintIndegree &from)
copy operator
Size NodeId
Type for node ids.
Definition: graphElements.h:98
bool checkArcReversalAlone(NodeId x, NodeId y) const
checks whether the constraints enable to reverse arc (x,y)