aGrUM  0.14.2
structuralConstraintDAG.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_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 will 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  ***************************************************************************/
25 #ifndef GUM_LEARNING_STRUCTURAL_CONSTRAINT_DAG_H
26 #define GUM_LEARNING_STRUCTURAL_CONSTRAINT_DAG_H
27 
28 #include <agrum/agrum.h>
32 
33 namespace gum {
34 
35  namespace learning {
36 
47  : public virtual StructuralConstraintSetStatic<
48  StructuralConstraintDiGraph > {
49  public:
50  // ##########################################################################
52  // ##########################################################################
54 
57 
59  StructuralConstraintDAG(Size nb_nodes);
60 
62  StructuralConstraintDAG(const DAG& graph);
63 
66 
69 
71  virtual ~StructuralConstraintDAG();
72 
74 
75  // ##########################################################################
77  // ##########################################################################
79 
82 
85 
87 
88  // ##########################################################################
90  // ##########################################################################
92 
94  void setGraphAlone(const DiGraph& graph);
95 
97  void setGraphAlone(Size nb_nodes);
98 
100 
107  void modifyGraphAlone(const ArcAddition& change);
108 
110 
112  void modifyGraphAlone(const ArcDeletion& change);
113 
115 
122  void modifyGraphAlone(const ArcReversal& change);
123 
125 
132  void modifyGraphAlone(const GraphChange& change);
133 
135 
148  bool isAlwaysInvalidAlone(const GraphChange& change) const;
149 
151 
154  bool checkArcAdditionAlone(NodeId x, NodeId y) const;
155 
157  bool checkArcDeletionAlone(NodeId x, NodeId y) const;
158 
160 
163  bool checkArcReversalAlone(NodeId x, NodeId y) const;
164 
166 
168  bool checkModificationAlone(const ArcAddition& change) const;
169 
171 
172  bool checkModificationAlone(const ArcDeletion& change) const;
173 
175 
177  bool checkModificationAlone(const ArcReversal& change) const;
178 
180 
185  bool checkModificationAlone(const GraphChange& change) const;
186 
188  void setGraph(const DAG& graph);
189 
191  void setGraph(Size nb_nodes);
192 
194 
195 #ifndef DOXYGEN_SHOULD_SKIP_THIS
196 // include the set of methods that enable the structural constraint to
197 // be standalone, i.e., that it needs not be included into a
198 // StructuralConstraintSetStatic to be used by learning algorithms
199 # define GUM_CONSTRAINT_CLASS_NAME StructuralConstraintDAG
201 # undef GUM_CONSTRAINT_CLASS_NAME
202 #endif // DOXYGEN_SHOULD_SKIP_THIS
203 
204  protected:
207  };
208 
209  } /* namespace learning */
210 
211 } /* namespace gum */
212 
214 #ifndef GUM_NO_INLINE
216 #endif /* GUM_NO_INLINE */
217 
218 #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:147
the base class for structural constraints imposed by DAGs
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:213
the "meta-programming" class for storing several structural constraints
void modifyGraphAlone(const ArcAddition &change)
notify the constraint of a modification of the graph
gum is the global namespace for all aGrUM entities
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
the base class for structural constraints used by learning algorithms that learn a directed graph str...
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:108
A class for detecting directed cycles in DAGs when trying to apply many changes to the graph...
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:279
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
StructuralConstraintDAG & operator=(const StructuralConstraintDAG &from)
copy operator
Base class for dag.
Definition: DAG.h:99
Size NodeId
Type for node ids.
Definition: graphElements.h:97
DAGCycleDetector _DAG__cycle_detector
the cycle detector used to check quickly graph modifications
The base class for structural constraints imposed by DAGs.