aGrUM  0.16.0
structuralConstraintDAG.h
Go to the documentation of this file.
1 
28 #ifndef GUM_LEARNING_STRUCTURAL_CONSTRAINT_DAG_H
29 #define GUM_LEARNING_STRUCTURAL_CONSTRAINT_DAG_H
30 
31 #include <agrum/agrum.h>
35 
36 namespace gum {
37 
38  namespace learning {
39 
50  : public virtual StructuralConstraintSetStatic<
51  StructuralConstraintDiGraph > {
52  public:
53  // ##########################################################################
55  // ##########################################################################
57 
60 
62  StructuralConstraintDAG(Size nb_nodes);
63 
65  StructuralConstraintDAG(const DAG& graph);
66 
69 
72 
74  virtual ~StructuralConstraintDAG();
75 
77 
78  // ##########################################################################
80  // ##########################################################################
82 
85 
88 
90 
91  // ##########################################################################
93  // ##########################################################################
95 
97  void setGraphAlone(const DiGraph& graph);
98 
100  void setGraphAlone(Size nb_nodes);
101 
103 
110  void modifyGraphAlone(const ArcAddition& change);
111 
113 
115  void modifyGraphAlone(const ArcDeletion& change);
116 
118 
125  void modifyGraphAlone(const ArcReversal& change);
126 
128 
135  void modifyGraphAlone(const GraphChange& change);
136 
138 
151  bool isAlwaysInvalidAlone(const GraphChange& change) const;
152 
154 
157  bool checkArcAdditionAlone(NodeId x, NodeId y) const;
158 
160  bool checkArcDeletionAlone(NodeId x, NodeId y) const;
161 
163 
166  bool checkArcReversalAlone(NodeId x, NodeId y) const;
167 
169 
171  bool checkModificationAlone(const ArcAddition& change) const;
172 
174 
175  bool checkModificationAlone(const ArcDeletion& change) const;
176 
178 
180  bool checkModificationAlone(const ArcReversal& change) const;
181 
183 
188  bool checkModificationAlone(const GraphChange& change) const;
189 
191  void setGraph(const DAG& graph);
192 
194  void setGraph(Size nb_nodes);
195 
197 
198 #ifndef DOXYGEN_SHOULD_SKIP_THIS
199 // include the set of methods that enable the structural constraint to
200 // be standalone, i.e., that it needs not be included into a
201 // StructuralConstraintSetStatic to be used by learning algorithms
202 # define GUM_CONSTRAINT_CLASS_NAME StructuralConstraintDAG
204 # undef GUM_CONSTRAINT_CLASS_NAME
205 #endif // DOXYGEN_SHOULD_SKIP_THIS
206 
207  protected:
210  };
211 
212  } /* namespace learning */
213 
214 } /* namespace gum */
215 
217 #ifndef GUM_NO_INLINE
219 #endif /* GUM_NO_INLINE */
220 
221 #endif /* GUM_LEARNING_STRUCTURAL_CONSTRAINT_DAG_H */
A class for detecting directed cycles in DAGs when trying to apply many changes to the graph...
bool checkModificationAlone(const ArcAddition &change) const
checks whether the constraints enable to add an arc
void setGraph(const DAG &graph)
sets a new graph from which we will perform checkings
The class for notifying learning algorithms of new arc additionsThis class is convenient to know at c...
Definition: graphChange.h:150
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void setGraphAlone(const DiGraph &graph)
sets a new graph from which we will perform checkings
The class for notifying learning algorithms of arc removalsThis class is convenient to know at compil...
Definition: graphChange.h:216
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void modifyGraphAlone(const ArcAddition &change)
notify the constraint of a modification of the graph
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
bool checkArcAdditionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to add arc (x,y)
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.
the "meta-programming" class for storing structural constraintsIn aGrUM, there are two ways to store ...
bool checkArcReversalAlone(NodeId x, NodeId y) const
checks whether the constraints enable to reverse 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.
bool checkArcDeletionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to remove arc (x,y)
The class for notifying learning algorithms of arc reversalsThis class is convenient to know at compi...
Definition: graphChange.h:282
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
StructuralConstraintDAG & operator=(const StructuralConstraintDAG &from)
copy operator
Base class for dag.
Definition: DAG.h:102
Size NodeId
Type for node ids.
Definition: graphElements.h:98
DAGCycleDetector _DAG__cycle_detector
the cycle detector used to check quickly graph modifications
The base class for structural constraints imposed by DAGs.