![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The base class for structural constraints imposed by DAGs. More...
#include <structuralConstraintDAG.h>
Public Member Functions | |
Constructors / Destructors | |
StructuralConstraintDAG () | |
default constructor More... | |
StructuralConstraintDAG (Size nb_nodes) | |
constructor starting with an empty graph with a given number of nodes More... | |
StructuralConstraintDAG (const DAG &graph) | |
constructor starting with a given graph More... | |
StructuralConstraintDAG (const StructuralConstraintDAG &from) | |
copy constructor More... | |
StructuralConstraintDAG (StructuralConstraintDAG &&from) | |
move constructor More... | |
virtual | ~StructuralConstraintDAG () |
destructor More... | |
Operators | |
StructuralConstraintDAG & | operator= (const StructuralConstraintDAG &from) |
copy operator More... | |
StructuralConstraintDAG & | operator= (StructuralConstraintDAG &&from) |
move operator More... | |
Specific Accessors / Modifiers | |
void | setGraphAlone (const DiGraph &graph) |
sets a new graph from which we will perform checkings More... | |
void | setGraphAlone (Size nb_nodes) |
sets a new empty 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 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... | |
bool | checkModificationAlone (const GraphChange &change) const |
checks whether the constraints enable to perform a graph change More... | |
void | setGraph (const DAG &graph) |
sets a new graph from which we will perform checkings More... | |
void | setGraph (Size nb_nodes) |
sets a new empty graph from which we will perform checkings More... | |
Accessors / Modifiers | |
void | setGraph (const DiGraph &graph) |
sets a new graph from which we will perform checkings More... | |
void | modifyGraph (const ArcAddition &change) |
notify the constraint of a modification of the graph More... | |
void | modifyGraph (const ArcDeletion &change) |
notify the constraint of a modification of the graph More... | |
void | modifyGraph (const ArcReversal &change) |
notify the constraint of a modification of the graph More... | |
void | modifyGraph (const GraphChange &change) |
notify the constraint of a modification of the graph More... | |
bool | isAlwaysInvalid (const GraphChange &change) const |
indicates whether a change will always violate the constraint More... | |
bool | checkArcAddition (NodeId x, NodeId y) const |
checks whether the constraints enable to add arc (x,y) More... | |
bool | checkArcDeletion (NodeId x, NodeId y) const |
checks whether the constraints enable to remove arc (x,y) More... | |
bool | checkArcReversal (NodeId x, NodeId y) const |
checks whether the constraints enable to reverse arc (x,y) More... | |
bool | checkModification (const ArcAddition &change) const |
checks whether the constraints enable to add an arc More... | |
bool | checkModification (const ArcDeletion &change) const |
checks whether the constraints enable to remove an arc More... | |
bool | checkModification (const ArcReversal &change) const |
checks whether the constraints enable to reverse an arc More... | |
bool | checkModification (const GraphChange &change) const |
checks whether the constraints enable to perform a graph change More... | |
Public Types | |
using | constraints = typename _StructuralConstraintSetStatic_< StructuralConstraintDiGraph, OTHER_CONSTRAINTS... >::minConstraints |
Protected Attributes | |
DAGCycleDetector | _DAG_cycle_detector_ |
the cycle detector used to check quickly graph modifications More... | |
The base class for structural constraints imposed by DAGs.
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 48 of file structuralConstraintDAG.h.
|
inherited |
Definition at line 408 of file structuralConstraintSetStatic.h.
gum::learning::StructuralConstraintDAG::StructuralConstraintDAG | ( | ) |
default constructor
Definition at line 39 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDAG::StructuralConstraintDAG | ( | Size | nb_nodes | ) |
constructor starting with an empty graph with a given number of nodes
Definition at line 42 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDAG::StructuralConstraintDAG | ( | const DAG & | graph | ) |
constructor starting with a given graph
Definition at line 56 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDAG::StructuralConstraintDAG | ( | const StructuralConstraintDAG & | from | ) |
copy constructor
Definition at line 64 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintDAG::StructuralConstraintDAG | ( | StructuralConstraintDAG && | from | ) |
move constructor
Definition at line 70 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
|
virtual |
destructor
Definition at line 77 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
|
inherited |
checks whether the constraints enable to add arc (x,y)
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 and would not create a cycle
|
inherited |
checks whether the constraints enable to remove arc (x,y)
checks whether the constraints enable to remove arc (x,y)
|
inherited |
checks whether the constraints enable to reverse arc (x,y)
checks whether the constraints enable to reverse arc (x,y)
An arc (x,y) can be reversed if and only if it exists and, after deleting it, the addition of arc (y,x) does not induce a directed cycle.
|
inherited |
checks whether the constraints enable to add an arc
|
inherited |
checks whether the constraints enable to remove an arc
|
inherited |
checks whether the constraints enable to reverse an arc
|
inherited |
checks whether the constraints enable to perform a graph change
bool gum::learning::StructuralConstraintDAG::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::StructuralConstraintDAG::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::StructuralConstraintDAG::checkModificationAlone | ( | const ArcReversal & | change | ) | const |
checks whether the constraints enable to reverse an arc
An arc can be reversed if, after deleting arc (x,y), the addition of arc (y,x) does not induce a directed cycle.
bool gum::learning::StructuralConstraintDAG::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 and would not create a cycle. An arc can be removed if and only if the arc exists. An arc can be reversed if, after deleting arc (x,y), the addition of arc (y,x) does not induce a directed cycle.
|
inherited |
indicates whether a change will always violate the constraint
bool gum::learning::StructuralConstraintDAG::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.
|
inherited |
notify the constraint of a modification of the graph
|
inherited |
notify the constraint of a modification of the graph
|
inherited |
notify the constraint of a modification of the graph
|
inherited |
notify the constraint of a modification of the graph
void gum::learning::StructuralConstraintDAG::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 |
InvalidDirectedCycle | exception is thrown if any (directed) cycle is created by the arc addition. |
void gum::learning::StructuralConstraintDAG::modifyGraphAlone | ( | const ArcDeletion & | change | ) |
notify the constraint of a modification of the graph
void gum::learning::StructuralConstraintDAG::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 |
InvalidDirectedCycle | exception is thrown if any (directed) cycle is created by the arc reversal. |
void gum::learning::StructuralConstraintDAG::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 |
InvalidDirectedCycle | exception is thrown if any (directed) cycle is created by an arc addition or reversal. |
StructuralConstraintDAG & gum::learning::StructuralConstraintDAG::operator= | ( | const StructuralConstraintDAG & | from | ) |
copy operator
Definition at line 81 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
StructuralConstraintDAG & gum::learning::StructuralConstraintDAG::operator= | ( | StructuralConstraintDAG && | from | ) |
move operator
Definition at line 90 of file structuralConstraintDAG.cpp.
References gum::learning::genericBNLearner::Database::Database().
void gum::learning::StructuralConstraintDAG::setGraph | ( | const DAG & | graph | ) |
sets a new graph from which we will perform checkings
void gum::learning::StructuralConstraintDAG::setGraph | ( | Size | nb_nodes | ) |
sets a new empty graph from which we will perform checkings
|
inherited |
sets a new graph from which we will perform checkings
void gum::learning::StructuralConstraintDAG::setGraphAlone | ( | const DiGraph & | graph | ) |
sets a new graph from which we will perform checkings
void gum::learning::StructuralConstraintDAG::setGraphAlone | ( | Size | nb_nodes | ) |
sets a new empty graph from which we will perform checkings
|
protected |
the cycle detector used to check quickly graph modifications
Definition at line 207 of file structuralConstraintDAG.h.