aGrUM  0.16.0
structuralConstraintMandatoryArcs_inl.h
Go to the documentation of this file.
1 
29 #ifndef DOXYGEN_SHOULD_SKIP_THIS
30 
31 namespace gum {
32 
33  namespace learning {
34 
36  INLINE void
38 
40  INLINE bool
42  NodeId y) const {
43  return true;
44  }
45 
47  INLINE bool
49  NodeId y) const {
50  return !_MandatoryArcs__mandatory_arcs.exists(Arc(x, y));
51  }
52 
54  INLINE bool
56  NodeId y) const {
57  return !_MandatoryArcs__mandatory_arcs.exists(Arc(x, y));
58  }
59 
62  const ArcAddition& change) const {
63  return checkArcAdditionAlone(change.node1(), change.node2());
64  }
65 
68  const ArcDeletion& change) const {
69  return checkArcDeletionAlone(change.node1(), change.node2());
70  }
71 
74  const ArcReversal& change) const {
75  return checkArcReversalAlone(change.node1(), change.node2());
76  }
77 
80  const GraphChange& change) const {
81  switch (change.type()) {
83  return checkArcAdditionAlone(change.node1(), change.node2());
84 
86  return checkArcDeletionAlone(change.node1(), change.node2());
87 
89  return checkArcReversalAlone(change.node1(), change.node2());
90 
91  default:
92  GUM_ERROR(OperationNotAllowed,
93  "edge modifications are not "
94  "supported by StructuralConstraintMandatoryArcs");
95  }
96  }
97 
100  const ArcAddition& change) {}
101 
104  const ArcDeletion& change) {}
105 
108  const ArcReversal& change) {}
109 
112  const GraphChange& change) {}
113 
116  const GraphChange& change) const {
117  switch (change.type()) {
118  case GraphChangeType::ARC_ADDITION: return false;
119 
121  return !checkArcDeletionAlone(change.node1(), change.node2());
122 
124  return !checkArcReversalAlone(change.node1(), change.node2());
125 
126  default:
127  GUM_ERROR(OperationNotAllowed,
128  "edge modifications are not supported "
129  "by StructuralConstraintMandatoryArcs");
130  }
131  }
132 
134  INLINE void StructuralConstraintMandatoryArcs::setArcs(const ArcSet& set) {
136  }
137 
139  INLINE void StructuralConstraintMandatoryArcs::addArc(const Arc& arc) {
141  }
142 
144  INLINE void StructuralConstraintMandatoryArcs::eraseArc(const Arc& arc) {
146  }
147 
149  INLINE const ArcSet& StructuralConstraintMandatoryArcs::arcs() const {
151  }
152 
153 // include all the methods applicable to the whole class hierarchy
154 # define GUM_CONSTRAINT_CLASS_NAME StructuralConstraintMandatoryArcs
156 # undef GUM_CONSTRAINT_CLASS_NAME
157 
158  } /* namespace learning */
159 
160 } /* namespace gum */
161 
162 #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:656
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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:607
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:98
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:613
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
bool checkModificationAlone(const GraphChange &change) const
checks whether the constraints enable to perform a graph change