![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
the structural constraint imposing a total order over some nodes More...
#include <structuralConstraintTotalOrder.h>
Public Types | |
| using | allConstraints = _ConstraintSet_< void > |
Public Member Functions | |
Constructors / Destructors | |
| StructuralConstraintTotalOrder () | |
| default constructor | |
| StructuralConstraintTotalOrder (const Sequence< NodeId > &order) | |
| constructor starting with an empty graph with a given number of nodes | |
| StructuralConstraintTotalOrder (const DiGraph &graph, const Sequence< NodeId > &order) | |
| constructor starting with a given graph | |
| StructuralConstraintTotalOrder (const StructuralConstraintTotalOrder &from) | |
| copy constructor | |
| StructuralConstraintTotalOrder (StructuralConstraintTotalOrder &&from) | |
| move constructor | |
| virtual | ~StructuralConstraintTotalOrder () |
| destructor | |
Operators | |
| StructuralConstraintTotalOrder & | operator= (const StructuralConstraintTotalOrder &from) |
| copy operator | |
| StructuralConstraintTotalOrder & | operator= (StructuralConstraintTotalOrder &&from) |
| move operator | |
Specific Accessors / Modifiers | |
| void | setTotalOrder (const Sequence< NodeId > &Total) |
| sets the Total order of all the nodes in the property | |
| const Sequence< NodeId > & | totalOrder () const |
| returns the current Total order | |
| void | setGraphAlone (const DiGraph &graph) |
| sets a new graph from which we will perform checkings | |
| void | modifyGraphAlone (const ArcAddition &change) |
| notify the constraint of a modification of the graph | |
| void | modifyGraphAlone (const ArcDeletion &change) |
| notify the constraint of a modification of the graph | |
| void | modifyGraphAlone (const ArcReversal &change) |
| notify the constraint of a modification of the graph | |
| void | modifyGraphAlone (const ArcTriangleDeletion1 &change) |
| notify the constraint of a modification of the graph | |
| void | modifyGraphAlone (const ArcTriangleDeletion2 &change) |
| notify the constraint of a modification of the graph | |
| void | modifyGraphAlone (const GraphChange &change) |
| notify the constraint of a modification of the graph | |
| 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 | checkArcDeletionAlone (NodeId x, NodeId y) const |
| checks whether the constraints enable to remove arc (x,y) | |
| bool | checkArcReversalAlone (NodeId x, NodeId y) const |
| checks whether the constraints enable to reverse arc (x,y) | |
| bool | checkArcTriangleDeletion1Alone (NodeId node1, NodeId node2, NodeId node3) const |
| checks whether the constraints enable to apply an ArcTriangleDeletion1 | |
| bool | checkArcTriangleDeletion2Alone (NodeId node1, NodeId node2, NodeId node3) const |
| checks whether the constraints enable to apply an ArcTriangleDeletion2 | |
| bool | checkModificationAlone (const ArcAddition &change) const |
| checks whether the constraints enable to add an arc | |
| bool | checkModificationAlone (const ArcDeletion &change) const |
| checks whether the constraints enable to remove an arc | |
| bool | checkModificationAlone (const ArcReversal &change) const |
| checks whether the constraints enable to reverse an arc | |
| bool | checkModificationAlone (const ArcTriangleDeletion1 &change) const |
| checks whether the constraints enable to apply an ArcTriangleDeletion1 | |
| bool | checkModificationAlone (const ArcTriangleDeletion2 &change) const |
| checks whether the constraints enable to apply an ArcTriangleDeletion2 | |
| bool | checkModificationAlone (const GraphChange &change) const |
| checks whether the constraints enable to perform a graph change | |
Protected Attributes | |
| Sequence< NodeId > | _total_order_ |
| the total ordering over the nodes | |
the structural constraint imposing a total order over some nodes
Definition at line 67 of file structuralConstraintTotalOrder.h.
|
inherited |
Definition at line 61 of file structuralConstraint.h.
| gum::learning::StructuralConstraintTotalOrder::StructuralConstraintTotalOrder | ( | ) |
default constructor
Definition at line 60 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder().
Referenced by StructuralConstraintTotalOrder(), StructuralConstraintTotalOrder(), StructuralConstraintTotalOrder(), StructuralConstraintTotalOrder(), StructuralConstraintTotalOrder(), ~StructuralConstraintTotalOrder(), operator=(), and operator=().
| gum::learning::StructuralConstraintTotalOrder::StructuralConstraintTotalOrder | ( | const Sequence< NodeId > & | order | ) |
constructor starting with an empty graph with a given number of nodes
param order the partial order
Definition at line 65 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder(), and _total_order_.
| gum::learning::StructuralConstraintTotalOrder::StructuralConstraintTotalOrder | ( | const DiGraph & | graph, |
| const Sequence< NodeId > & | order ) |
constructor starting with a given graph
Definition at line 71 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder(), and _total_order_.
| gum::learning::StructuralConstraintTotalOrder::StructuralConstraintTotalOrder | ( | const StructuralConstraintTotalOrder & | from | ) |
copy constructor
Definition at line 78 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder(), and _total_order_.
| gum::learning::StructuralConstraintTotalOrder::StructuralConstraintTotalOrder | ( | StructuralConstraintTotalOrder && | from | ) |
move constructor
Definition at line 84 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder(), and _total_order_.
|
virtual |
destructor
Definition at line 90 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder().
| bool gum::learning::StructuralConstraintTotalOrder::checkArcAdditionAlone | ( | NodeId | x, |
| NodeId | y ) const |
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 is not a backward-time arc.
Referenced by checkModificationAlone(), and isAlwaysInvalidAlone().
| bool gum::learning::StructuralConstraintTotalOrder::checkArcDeletionAlone | ( | NodeId | x, |
| NodeId | y ) const |
checks whether the constraints enable to remove arc (x,y)
an arc can be removed if and only if the arc exists.
Referenced by checkModificationAlone().
| bool gum::learning::StructuralConstraintTotalOrder::checkArcReversalAlone | ( | NodeId | x, |
| NodeId | y ) const |
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 and is not a backward-time arc.
Referenced by checkModificationAlone().
| bool gum::learning::StructuralConstraintTotalOrder::checkArcTriangleDeletion1Alone | ( | NodeId | node1, |
| NodeId | node2, | ||
| NodeId | node3 ) const |
checks whether the constraints enable to apply an ArcTriangleDeletion1
An arc triangle deletion1 substitutes triangle node1 -> node2 -> node3 + node1 -> node3 into v-structure node2 -> node1 <- node3
Referenced by checkModificationAlone(), and isAlwaysInvalidAlone().
| bool gum::learning::StructuralConstraintTotalOrder::checkArcTriangleDeletion2Alone | ( | NodeId | node1, |
| NodeId | node2, | ||
| NodeId | node3 ) const |
checks whether the constraints enable to apply an ArcTriangleDeletion2
An arc triangle deletion1 substitutes triangle node1 -> node2 -> node3 + node1 -> node3 into v-structure node1 -> node2 <- node3
Referenced by checkModificationAlone(), and isAlwaysInvalidAlone().
| bool gum::learning::StructuralConstraintTotalOrder::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 and is not a backward-time arc.
| bool gum::learning::StructuralConstraintTotalOrder::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::StructuralConstraintTotalOrder::checkModificationAlone | ( | const ArcReversal & | change | ) | const |
checks whether the constraints enable to reverse an arc
an arc can be reversed if and only if it exists and arc (y,x) does not and is not a backward-time arc.
| bool gum::learning::StructuralConstraintTotalOrder::checkModificationAlone | ( | const ArcTriangleDeletion1 & | change | ) | const |
checks whether the constraints enable to apply an ArcTriangleDeletion1
An arc triangle deletion1 substitutes triangle node1 -> node2 -> node3 + node1 -> node3 into v-structure node2 -> node1 <- node3
| bool gum::learning::StructuralConstraintTotalOrder::checkModificationAlone | ( | const ArcTriangleDeletion2 & | change | ) | const |
checks whether the constraints enable to apply an ArcTriangleDeletion2
An arc triangle deletion1 substitutes triangle node1 -> node2 -> node3 + node1 -> node3 into v-structure node1 -> node2 <- node3
| bool gum::learning::StructuralConstraintTotalOrder::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 is not a backward-time arc. 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 and is not a backward-time arc.
Definition at line 132 of file structuralConstraintTotalOrder.cpp.
References gum::learning::ARC_ADDITION, gum::learning::ARC_DELETION, gum::learning::ARC_REVERSAL, gum::learning::ARC_TRIANGLE_DELETION1, gum::learning::ARC_TRIANGLE_DELETION2, checkArcAdditionAlone(), checkArcDeletionAlone(), checkArcReversalAlone(), checkArcTriangleDeletion1Alone(), checkArcTriangleDeletion2Alone(), GUM_ERROR, gum::learning::GraphChange::node1(), gum::learning::GraphChange::node2(), gum::learning::GraphChange::node3(), and gum::learning::GraphChange::type().
| bool gum::learning::StructuralConstraintTotalOrder::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.
Definition at line 108 of file structuralConstraintTotalOrder.cpp.
References gum::learning::ARC_ADDITION, gum::learning::ARC_DELETION, gum::learning::ARC_REVERSAL, gum::learning::ARC_TRIANGLE_DELETION1, gum::learning::ARC_TRIANGLE_DELETION2, checkArcAdditionAlone(), checkArcTriangleDeletion1Alone(), checkArcTriangleDeletion2Alone(), GUM_ERROR, gum::learning::GraphChange::node1(), gum::learning::GraphChange::node2(), gum::learning::GraphChange::node3(), gum::learning::GraphChange::type(), and gum::learning::GraphChange::typeAsString().
| void gum::learning::StructuralConstraintTotalOrder::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 |
| InvalidArc | exception is thrown if any time-backward arc is created by the arc addition. |
| void gum::learning::StructuralConstraintTotalOrder::modifyGraphAlone | ( | const ArcDeletion & | change | ) |
notify the constraint of a modification of the graph
| void gum::learning::StructuralConstraintTotalOrder::modifyGraphAlone | ( | const ArcReversal & | 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 |
| InvalidArc | exception is thrown if any time-backward arc is created by the arc reversal. |
| void gum::learning::StructuralConstraintTotalOrder::modifyGraphAlone | ( | const ArcTriangleDeletion1 & | change | ) |
notify the constraint of a modification of the graph
An arc triangle deletion1 substitutes triangle node1 -> node2 -> node3 + node1 -> node3 into v-structure node2 -> node1 <- node3
| void gum::learning::StructuralConstraintTotalOrder::modifyGraphAlone | ( | const ArcTriangleDeletion2 & | change | ) |
notify the constraint of a modification of the graph
An arc triangle deletion1 substitutes triangle node1 -> node2 -> node3 + node1 -> node3 into v-structure node1 -> node2 <- node3
| void gum::learning::StructuralConstraintTotalOrder::modifyGraphAlone | ( | const GraphChange & | change | ) |
notify the constraint of a modification of the graph
| InvalidNode | exception is thrown if an arc (x,y) is added or reversed and x or y does not belong to the graph nodes |
| InvalidArc | exception is thrown if any time-backward arc is created by an arc addition or reversal. |
| StructuralConstraintTotalOrder & gum::learning::StructuralConstraintTotalOrder::operator= | ( | const StructuralConstraintTotalOrder & | from | ) |
copy operator
Definition at line 96 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder(), and _total_order_.
| StructuralConstraintTotalOrder & gum::learning::StructuralConstraintTotalOrder::operator= | ( | StructuralConstraintTotalOrder && | from | ) |
move operator
Definition at line 103 of file structuralConstraintTotalOrder.cpp.
References StructuralConstraintTotalOrder(), and _total_order_.
| void gum::learning::StructuralConstraintTotalOrder::setGraphAlone | ( | const DiGraph & | graph | ) |
sets a new graph from which we will perform checkings
| void gum::learning::StructuralConstraintTotalOrder::setTotalOrder | ( | const Sequence< NodeId > & | Total | ) |
sets the Total order of all the nodes in the property
Referenced by gum::learning::K2::learnBN(), and gum::learning::K2::learnStructure().
returns the current Total order
the total ordering over the nodes
Definition at line 259 of file structuralConstraintTotalOrder.h.
Referenced by StructuralConstraintTotalOrder(), StructuralConstraintTotalOrder(), StructuralConstraintTotalOrder(), StructuralConstraintTotalOrder(), operator=(), and operator=().