![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The base class for structural constraints used by learning algorithms that learn a directed graph structure. More...
#include <structuralConstraintDiGraph.h>
Public Member Functions | |
Constructors / Destructors | |
StructuralConstraintDiGraph () | |
default constructor More... | |
StructuralConstraintDiGraph (Size nb_nodes) | |
constructor starting with an empty graph with a given number of nodes More... | |
StructuralConstraintDiGraph (const DiGraph &graph) | |
constructor starting with a given graph More... | |
StructuralConstraintDiGraph (const StructuralConstraintDiGraph &from) | |
copy constructor More... | |
StructuralConstraintDiGraph (StructuralConstraintDiGraph &&from) | |
move constructor More... | |
virtual | ~StructuralConstraintDiGraph () |
destructor More... | |
Operators | |
StructuralConstraintDiGraph & | operator= (const StructuralConstraintDiGraph &from) |
copy operator More... | |
StructuralConstraintDiGraph & | operator= (StructuralConstraintDiGraph &&from) |
move operator More... | |
Specific Accessors / Modifiers | |
void | setGraph (Size nb_nodes) |
sets a new empty graph from which we will perform checkings More... | |
void | setGraphAlone (const DiGraph &graph) |
sets a new graph from which we will perform checkings More... | |
void | modifyGraphAlone (const ArcAddition &change) |
notify the constraint of a modification of the graph More... | |
void | modifyGraphAlone (const ArcDeletion &change) |
notify the constraint of a modification of the graph More... | |
void | modifyGraphAlone (const ArcReversal &change) |
notify the constraint of a modification of the graph More... | |
void | modifyGraphAlone (const GraphChange &change) |
notify the constraint of a modification of the graph More... | |
bool | isAlwaysInvalidAlone (const GraphChange &change) const |
indicates whether a change will always violate the constraint More... | |
bool | checkArcAdditionAlone (NodeId x, NodeId y) const |
checks whether the constraints enable to add arc (x,y) More... | |
bool | checkArcDeletionAlone (NodeId x, NodeId y) const |
checks whether the constraints enable to remove arc (x,y) More... | |
bool | checkArcReversalAlone (NodeId x, NodeId y) const |
checks whether the constraints enable to reverse arc (x,y) More... | |
bool | checkModificationAlone (const GraphChange &change) const |
checks whether the constraints enable to perform a graph change More... | |
bool | checkModificationAlone (const ArcAddition &change) const |
checks whether the constraints enable to add an arc More... | |
bool | checkModificationAlone (const ArcDeletion &change) const |
checks whether the constraints enable to remove an arc More... | |
bool | checkModificationAlone (const ArcReversal &change) const |
checks whether the constraints enable to reverse an arc More... | |
Public Types | |
using | allConstraints = _ConstraintSet_< void > |
Protected Attributes | |
DiGraph | _DiGraph_graph_ |
the DiGraph on which we perform checks More... | |
The base class for structural constraints used by learning algorithms that learn a directed graph structure.
This base should always be a virtual parents of the structural constraints classes. This will allow to combine different constraints into a single class
Definition at line 50 of file structuralConstraintDiGraph.h.
|
inherited |
Definition at line 41 of file structuralConstraint.h.
gum::learning::StructuralConstraintDiGraph::StructuralConstraintDiGraph | ( | ) |
default constructor
Definition at line 41 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDiGraph::StructuralConstraintDiGraph | ( | Size | nb_nodes | ) |
constructor starting with an empty graph with a given number of nodes
Definition at line 46 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDiGraph::StructuralConstraintDiGraph | ( | const DiGraph & | graph | ) |
constructor starting with a given graph
Definition at line 52 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDiGraph::StructuralConstraintDiGraph | ( | const StructuralConstraintDiGraph & | from | ) |
copy constructor
Definition at line 58 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDiGraph::StructuralConstraintDiGraph | ( | StructuralConstraintDiGraph && | from | ) |
move constructor
Definition at line 65 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
|
virtual |
destructor
Definition at line 71 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
checks whether the constraints enable to add arc (x,y)
an arc can be added if and only if its extremal nodes belong to the graph and the arc does not already exist.
checks whether the constraints enable to remove arc (x,y)
an arc can be removed if and only if the arc exists.
checks whether the constraints enable to reverse arc (x,y)
an arc can be reversed if and only if it exists and arc (y,x) does not.
bool gum::learning::StructuralConstraintDiGraph::checkModificationAlone | ( | const GraphChange & | change | ) | const |
checks whether the constraints enable to perform a graph change
An arc can be added if and only if its extremal nodes belong to the graph and the arc does not already exist. An arc can be removed if and only if the arc exists. An arc (x,y) can be reversed if and only if it exists and arc (y,x) does not.
bool gum::learning::StructuralConstraintDiGraph::checkModificationAlone | ( | const ArcAddition & | change | ) | const |
checks whether the constraints enable to add an arc
an arc can be added if and only if its extremal nodes belong to the graph and the arc does not already exist.
bool gum::learning::StructuralConstraintDiGraph::checkModificationAlone | ( | const ArcDeletion & | change | ) | const |
checks whether the constraints enable to remove an arc
an arc can be removed if and only if the arc exists.
bool gum::learning::StructuralConstraintDiGraph::checkModificationAlone | ( | const ArcReversal & | change | ) | const |
checks whether the constraints enable to reverse an arc
an arc (x,y) can be reversed if and only if it exists and arc (y,x) does not.
bool gum::learning::StructuralConstraintDiGraph::isAlwaysInvalidAlone | ( | const GraphChange & | change | ) | const |
indicates whether a change will always violate the constraint
Some learning algorithms need examine several times whether a given graph change can be applied. For instance, the first time arc (X,Y) addition is considered, the learning algorithm may discard this change because it violates the structural constraint (e.g., if the latter enforces a DAG structure, this arc addition might induce a directed cycle), but, later on, other arc removal may induce that the arc addition is now possible. Such change is thus not always invalid. Conversely, there are changes that can be discarded once and for all. For instance, in a 2TBN structure, it is always impossible to add a backward-time arc. Such graph changes are always invalid and are therefore tagged as such by the isAlwaysInvalid method.
void gum::learning::StructuralConstraintDiGraph::modifyGraphAlone | ( | const ArcAddition & | change | ) |
notify the constraint of a modification of the graph
InvalidNode | exception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes |
void gum::learning::StructuralConstraintDiGraph::modifyGraphAlone | ( | const ArcDeletion & | change | ) |
notify the constraint of a modification of the graph
void gum::learning::StructuralConstraintDiGraph::modifyGraphAlone | ( | const ArcReversal & | change | ) |
notify the constraint of a modification of the graph
InvalidNode | exception is thrown if at least one extremity of the arc does not belong to the graph nodes |
void gum::learning::StructuralConstraintDiGraph::modifyGraphAlone | ( | const GraphChange & | change | ) |
notify the constraint of a modification of the graph
InvalidNode | exception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes |
StructuralConstraintDiGraph & gum::learning::StructuralConstraintDiGraph::operator= | ( | const StructuralConstraintDiGraph & | from | ) |
copy operator
Definition at line 77 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
StructuralConstraintDiGraph & gum::learning::StructuralConstraintDiGraph::operator= | ( | StructuralConstraintDiGraph && | from | ) |
move operator
Definition at line 84 of file structuralConstraintDiGraph.cpp.
References gum::learning::genericBNLearner::Database::Database().
void gum::learning::StructuralConstraintDiGraph::setGraph | ( | Size | nb_nodes | ) |
sets a new empty graph from which we will perform checkings
void gum::learning::StructuralConstraintDiGraph::setGraphAlone | ( | const DiGraph & | graph | ) |
sets a new graph from which we will perform checkings
|
protected |
the DiGraph on which we perform checks
Definition at line 192 of file structuralConstraintDiGraph.h.