aGrUM  0.14.2
structuralConstraintForbiddenArcs_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 !_ForbiddenArcs__forbidden_arcs.exists(Arc(x, y));
41  }
42 
44  INLINE bool
46  NodeId y) const {
47  return true;
48  }
49 
51  INLINE bool
53  NodeId y) const {
54  return !_ForbiddenArcs__forbidden_arcs.exists(Arc(y, x));
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 StructuralConstraintForbiddenArcs");
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()) {
116  return !checkArcAdditionAlone(change.node1(), change.node2());
117 
118  case GraphChangeType::ARC_DELETION: return false;
119 
121  return !checkArcAdditionAlone(change.node2(), change.node1());
122 
123  default:
124  GUM_ERROR(OperationNotAllowed,
125  "edge modifications are not supported "
126  "by StructuralConstraintForbiddenArcs");
127  }
128  }
129 
131  INLINE void StructuralConstraintForbiddenArcs::setArcs(const ArcSet& set) {
133  }
134 
136  INLINE void StructuralConstraintForbiddenArcs::addArc(const Arc& arc) {
138  }
139 
141  INLINE void StructuralConstraintForbiddenArcs::eraseArc(const Arc& arc) {
143  }
144 
146  INLINE const ArcSet& StructuralConstraintForbiddenArcs::arcs() const {
148  }
149 
150 // include all the methods applicable to the whole class hierarchy
151 # define GUM_CONSTRAINT_CLASS_NAME StructuralConstraintForbiddenArcs
153 # undef GUM_CONSTRAINT_CLASS_NAME
154 
155  } /* namespace learning */
156 
157 } /* namespace gum */
158 
159 #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:653
void setArcs(const ArcSet &set)
assign a set of forbidden arcs
gum is the global namespace for all aGrUM entities
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:604
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: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 checkArcDeletionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to remove arc (x,y)