![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
the structural constraint imposing a partial order over nodes More...
#include <structuralConstraintSliceOrder.h>
Public Member Functions | |
Constructors / Destructors | |
StructuralConstraintSliceOrder () | |
default constructor More... | |
StructuralConstraintSliceOrder (const NodeProperty< NodeId > &order) | |
constructor starting with an empty graph with a given number of nodes More... | |
StructuralConstraintSliceOrder (const DiGraph &graph, const NodeProperty< NodeId > &order) | |
constructor starting with a given graph More... | |
StructuralConstraintSliceOrder (const StructuralConstraintSliceOrder &from) | |
copy constructor More... | |
StructuralConstraintSliceOrder (StructuralConstraintSliceOrder &&from) | |
move constructor More... | |
virtual | ~StructuralConstraintSliceOrder () |
destructor More... | |
Operators | |
StructuralConstraintSliceOrder & | operator= (const StructuralConstraintSliceOrder &from) |
copy operator More... | |
StructuralConstraintSliceOrder & | operator= (StructuralConstraintSliceOrder &&from) |
move operator More... | |
Specific Accessors / Modifiers | |
void | setSliceOrder (const NodeProperty< NodeId > &slice) |
sets the time slices of all the nodes in the property More... | |
const NodeProperty< NodeId > & | sliceOrder () const |
returns the current slice order More... | |
void | addNode (NodeId node, NodeId slice) |
adds a new node in the slice order More... | |
void | setDefaultSlice (NodeId slice) |
assign a given slice to all the nodes specified in the partial order 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 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... | |
Protected Attributes | |
NodeProperty< NodeId > | _SliceOrder_order_ |
slices to which belong the nodes More... | |
Protected Member Functions | |
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... | |
Protected Types | |
using | constraints = typename _StructuralConstraintSetStatic_< StructuralConstraintDiGraph, OTHER_CONSTRAINTS... >::minConstraints |
the structural constraint imposing a partial order over nodes
In DBNs, it is forbidden to add arcs from nodes at time slice t to nodes at time slice s, where s < t. This class allows for taking this kind of constraint into account by imposing a partial order over the nodes: arcs (X,Y) can then only be added if X <= Y in the partial order.
Definition at line 66 of file structuralConstraintSliceOrder.h.
|
inherited |
Definition at line 408 of file structuralConstraintSetStatic.h.
gum::learning::StructuralConstraintSliceOrder::StructuralConstraintSliceOrder | ( | ) |
default constructor
Definition at line 51 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintSliceOrder::StructuralConstraintSliceOrder | ( | const NodeProperty< NodeId > & | order | ) |
constructor starting with an empty graph with a given number of nodes
param order the partial order
Definition at line 56 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintSliceOrder::StructuralConstraintSliceOrder | ( | const DiGraph & | graph, |
const NodeProperty< NodeId > & | order | ||
) |
constructor starting with a given graph
Definition at line 67 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintSliceOrder::StructuralConstraintSliceOrder | ( | const StructuralConstraintSliceOrder & | from | ) |
copy constructor
Definition at line 76 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
gum::learning::StructuralConstraintSliceOrder::StructuralConstraintSliceOrder | ( | StructuralConstraintSliceOrder && | from | ) |
move constructor
Definition at line 84 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
|
virtual |
destructor
Definition at line 92 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
adds a new node in the slice order
|
inherited |
checks whether the constraints enable to add arc (x,y)
bool gum::learning::StructuralConstraintSliceOrder::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.
|
inherited |
checks whether the constraints enable to remove arc (x,y)
bool gum::learning::StructuralConstraintSliceOrder::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.
|
inherited |
checks whether the constraints enable to reverse arc (x,y)
bool gum::learning::StructuralConstraintSliceOrder::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.
|
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::StructuralConstraintSliceOrder::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::StructuralConstraintSliceOrder::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::StructuralConstraintSliceOrder::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::StructuralConstraintSliceOrder::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.
|
inherited |
indicates whether a change will always violate the constraint
bool gum::learning::StructuralConstraintSliceOrder::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::StructuralConstraintSliceOrder::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::StructuralConstraintSliceOrder::modifyGraphAlone | ( | const ArcDeletion & | change | ) |
notify the constraint of a modification of the graph
void gum::learning::StructuralConstraintSliceOrder::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::StructuralConstraintSliceOrder::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. |
StructuralConstraintSliceOrder & gum::learning::StructuralConstraintSliceOrder::operator= | ( | const StructuralConstraintSliceOrder & | from | ) |
copy operator
Definition at line 98 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
StructuralConstraintSliceOrder & gum::learning::StructuralConstraintSliceOrder::operator= | ( | StructuralConstraintSliceOrder && | from | ) |
move operator
Definition at line 108 of file structuralConstraintSliceOrder.cpp.
References gum::learning::genericBNLearner::Database::Database().
void gum::learning::StructuralConstraintSliceOrder::setDefaultSlice | ( | NodeId | slice | ) |
assign a given slice to all the nodes specified in the partial order
|
inherited |
sets a new graph from which we will perform checkings
void gum::learning::StructuralConstraintSliceOrder::setGraphAlone | ( | const DiGraph & | graph | ) |
sets a new graph from which we will perform checkings
void gum::learning::StructuralConstraintSliceOrder::setSliceOrder | ( | const NodeProperty< NodeId > & | slice | ) |
sets the time slices of all the nodes in the property
const NodeProperty< NodeId >& gum::learning::StructuralConstraintSliceOrder::sliceOrder | ( | ) | const |
returns the current slice order
|
protected |
slices to which belong the nodes
Definition at line 229 of file structuralConstraintSliceOrder.h.