aGrUM  0.14.2
structuralConstraintMandatoryArcs_inl.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  ***************************************************************************/
26 #ifndef DOXYGEN_SHOULD_SKIP_THIS
27 
28 namespace gum {
29 
30  namespace learning {
31 
33  INLINE void
35 
37  INLINE bool
39  NodeId y) const {
40  return true;
41  }
42 
44  INLINE bool
46  NodeId y) const {
47  return !_MandatoryArcs__mandatory_arcs.exists(Arc(x, y));
48  }
49 
51  INLINE bool
53  NodeId y) const {
54  return !_MandatoryArcs__mandatory_arcs.exists(Arc(x, y));
55  }
56 
59  const ArcAddition& change) const {
60  return checkArcAdditionAlone(change.node1(), change.node2());
61  }
62 
65  const ArcDeletion& change) const {
66  return checkArcDeletionAlone(change.node1(), change.node2());
67  }
68 
71  const ArcReversal& change) const {
72  return checkArcReversalAlone(change.node1(), change.node2());
73  }
74 
77  const GraphChange& change) const {
78  switch (change.type()) {
80  return checkArcAdditionAlone(change.node1(), change.node2());
81 
83  return checkArcDeletionAlone(change.node1(), change.node2());
84 
86  return checkArcReversalAlone(change.node1(), change.node2());
87 
88  default:
89  GUM_ERROR(OperationNotAllowed,
90  "edge modifications are not "
91  "supported by StructuralConstraintMandatoryArcs");
92  }
93  }
94 
97  const ArcAddition& change) {}
98 
101  const ArcDeletion& change) {}
102 
105  const ArcReversal& change) {}
106 
109  const GraphChange& change) {}
110 
113  const GraphChange& change) const {
114  switch (change.type()) {
115  case GraphChangeType::ARC_ADDITION: return false;
116 
118  return !checkArcDeletionAlone(change.node1(), change.node2());
119 
121  return !checkArcReversalAlone(change.node1(), change.node2());
122 
123  default:
124  GUM_ERROR(OperationNotAllowed,
125  "edge modifications are not supported "
126  "by StructuralConstraintMandatoryArcs");
127  }
128  }
129 
131  INLINE void StructuralConstraintMandatoryArcs::setArcs(const ArcSet& set) {
133  }
134 
136  INLINE void StructuralConstraintMandatoryArcs::addArc(const Arc& arc) {
138  }
139 
141  INLINE void StructuralConstraintMandatoryArcs::eraseArc(const Arc& arc) {
143  }
144 
146  INLINE const ArcSet& StructuralConstraintMandatoryArcs::arcs() const {
148  }
149 
150 // include all the methods applicable to the whole class hierarchy
151 # define GUM_CONSTRAINT_CLASS_NAME StructuralConstraintMandatoryArcs
153 # undef GUM_CONSTRAINT_CLASS_NAME
154 
155  } /* namespace learning */
156 
157 } /* namespace gum */
158 
159 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
bool checkArcReversalAlone(NodeId x, NodeId y) const
checks whether the constraints enable to reverse arc (x,y)
const ArcSet & arcs() const
returns the set of mandatory arcs
ArcSet _MandatoryArcs__mandatory_arcs
the MandatoryArcs on which we perform checks
bool isAlwaysInvalidAlone(const GraphChange &change) const
indicates whether a change will always violate the constraint
void setArcs(const ArcSet &set)
assign a set of forbidden arcs
void addArc(const Arc &arc)
assign a new forbidden arc
Set< Arc > ArcSet
Some typdefs and define for shortcuts ...
void erase(const Key &k)
Erases an element from the set.
Definition: set_tpl.h:653
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
bool checkArcDeletionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to remove arc (x,y)
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
Definition: set_tpl.h:604
void modifyGraphAlone(const ArcAddition &change)
notify the constraint of a modification of the graph
void eraseArc(const Arc &arc)
remove a forbidden arc
void setGraphAlone(const DiGraph &graph)
sets a new graph from which we will perform checkings
bool checkArcAdditionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to add arc (x,y)
Size NodeId
Type for node ids.
Definition: graphElements.h:97
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:610
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
bool checkModificationAlone(const GraphChange &change) const
checks whether the constraints enable to perform a graph change