aGrUM  0.16.0
structuralConstraintForbiddenArcs_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 !_ForbiddenArcs__forbidden_arcs.exists(Arc(x, y));
44  }
45 
47  INLINE bool
49  NodeId y) const {
50  return true;
51  }
52 
54  INLINE bool
56  NodeId y) const {
57  return !_ForbiddenArcs__forbidden_arcs.exists(Arc(y, x));
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 StructuralConstraintForbiddenArcs");
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()) {
119  return !checkArcAdditionAlone(change.node1(), change.node2());
120 
121  case GraphChangeType::ARC_DELETION: return false;
122 
124  return !checkArcAdditionAlone(change.node2(), change.node1());
125 
126  default:
127  GUM_ERROR(OperationNotAllowed,
128  "edge modifications are not supported "
129  "by StructuralConstraintForbiddenArcs");
130  }
131  }
132 
134  INLINE void StructuralConstraintForbiddenArcs::setArcs(const ArcSet& set) {
136  }
137 
139  INLINE void StructuralConstraintForbiddenArcs::addArc(const Arc& arc) {
141  }
142 
144  INLINE void StructuralConstraintForbiddenArcs::eraseArc(const Arc& arc) {
146  }
147 
149  INLINE const ArcSet& StructuralConstraintForbiddenArcs::arcs() const {
151  }
152 
153 // include all the methods applicable to the whole class hierarchy
154 # define GUM_CONSTRAINT_CLASS_NAME StructuralConstraintForbiddenArcs
156 # undef GUM_CONSTRAINT_CLASS_NAME
157 
158  } /* namespace learning */
159 
160 } /* namespace gum */
161 
162 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
void addArc(const Arc &arc)
assign a new forbidden arc
bool checkModificationAlone(const GraphChange &change) const
checks whether the constraints enable to perform a graph change
ArcSet _ForbiddenArcs__forbidden_arcs
the ForbiddenArcs on which we perform checks
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
void setArcs(const ArcSet &set)
assign a set of forbidden arcs
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
void setGraphAlone(const DiGraph &graph)
sets a new graph from which we will perform checkings
bool exists(const Key &k) const
Indicates whether a given elements belong to the set.
Definition: set_tpl.h:607
void eraseArc(const Arc &arc)
remove a forbidden arc
const ArcSet & arcs() const
returns the set of mandatory arcs
bool isAlwaysInvalidAlone(const GraphChange &change) const
indicates whether a change will always violate the constraint
bool checkArcAdditionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to add arc (x,y)
bool checkArcReversalAlone(NodeId x, NodeId y) const
checks whether the constraints enable to reverse arc (x,y)
void modifyGraphAlone(const ArcAddition &change)
notify the constraint of a modification of the graph
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 checkArcDeletionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to remove arc (x,y)