aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
structuralConstraintPattern4UndiGraphHeader.h
Go to the documentation of this file.
1
/**
2
*
3
* Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4
* info_at_agrum_dot_org
5
*
6
* This library is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this library. If not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
22
// this file should be included at the end of all the StructuralConstraints
23
// header
24
// files (see StructuralConstraintUndiGraph to see how it should be included).
25
26
#
ifdef
GUM_CONSTRAINT_CLASS_NAME
27
28
// ##########################################################################
29
/// @name Accessors / Modifiers
30
// ##########################################################################
31
/// @{
32
33
/// sets a new graph from which we will perform checkings
34
void
setGraph(
const
UndiGraph& graph);
35
36
/// notify the constraint of a modification of the graph
37
/** @warning If an already existing edge is added nothing is done. In
38
* particular, no exception is raised. */
39
void
modifyGraph(
const
EdgeAddition& change);
40
41
/// notify the constraint of a modification of the graph
42
/** @warning If a nonexisting edge is removed, nothing is done. In
43
* particular, no exception is raised. */
44
void
modifyGraph(
const
EdgeDeletion& change);
45
46
/// notify the constraint of a modification of the graph
47
/** @warning If an already existing edge is added, or if a nonexisting edge
48
* is removed, nothing is done. In particular, no exception is raised. */
49
void
modifyGraph(
const
GraphChange& change);
50
51
/// indicates whether a change will always violate the constraint
52
/** Some learning algorithms need examine several times whether a given
53
* graph change can be applied. For instance, the first time edge (X,Y)
54
* addition is considered, the learning algorithm may discard this change
55
* because it violates the structural constraint, but, later on, other edge
56
* removals may induce that the edge addition is now possible. Such change
57
* is thus not always invalid. Conversely, there are changes that can be
58
* discarded once and for all. For instance,
59
* in a 2TBN structure, it is always impossible to add a backward-time arc.
60
* Such graph changes are always invalid and are therefore tagged as such
61
* by the isAlwaysInvalid method. */
62
bool
isAlwaysInvalid(
const
GraphChange& change)
const
;
63
64
/// checks whether the constraints enable to add edge (x,y)
65
bool
checkEdgeAddition(NodeId x, NodeId y)
const
;
66
67
/// checks whether the constraints enable to remove edge (x,y)
68
bool
checkEdgeDeletion(NodeId x, NodeId y)
const
;
69
70
/// checks whether the constraints enable to add an edge
71
bool
checkModification(
const
EdgeAddition& change)
const
;
72
73
/// checks whether the constraints enable to remove an edge
74
bool
checkModification(
const
EdgeDeletion& change)
const
;
75
76
/// checks whether the constraints enable to perform a graph change
77
bool
checkModification(
const
GraphChange& change)
const
;
78
79
/// @}
80
81
#
endif
/* GUM_CONSTRAINT_CLASS_NAME */