aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
gum::learning::StructuralConstraintNoParentNodes Class Reference

the structural constraint for forbidding parents for some nodes More...

#include <structuralConstraintNoParentNodes.h>

Inheritance diagram for gum::learning::StructuralConstraintNoParentNodes:
Collaboration diagram for gum::learning::StructuralConstraintNoParentNodes:

Public Types

using allConstraints = _ConstraintSet_< void >

Public Member Functions

Constructors / Destructors
 StructuralConstraintNoParentNodes ()
 default constructor
 StructuralConstraintNoParentNodes (const DiGraph &graph)
 constructor starting with a given graph
 StructuralConstraintNoParentNodes (const StructuralConstraintNoParentNodes &from)
 copy constructor
 StructuralConstraintNoParentNodes (StructuralConstraintNoParentNodes &&from)
 move constructor
virtual ~StructuralConstraintNoParentNodes ()
 destructor
Operators
StructuralConstraintNoParentNodesoperator= (const StructuralConstraintNoParentNodes &from)
 copy operator
StructuralConstraintNoParentNodesoperator= (StructuralConstraintNoParentNodes &&from)
 move operator
Specific Accessors / Modifiers
void setNodes (const NodeSet &set)
 assign a set of nodes without parent
void addNode (NodeId node)
 assign a new node without parent
void eraseNode (NodeId node)
 remove a node without parent
const NodeSetnodes () const
 returns the set of nodes without parent
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 triangle deletion1
bool checkArcTriangleDeletion2Alone (NodeId node1, NodeId node2, NodeId node3) 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
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

Protected Attributes

NodeSet _noParentNodes_
 the ForbiddenArcs on which we perform checks

Detailed Description

the structural constraint for forbidding parents for some nodes

Definition at line 61 of file structuralConstraintNoParentNodes.h.

Member Typedef Documentation

◆ allConstraints

using gum::learning::StructuralConstraintEmpty::allConstraints = _ConstraintSet_< void >
inherited

Definition at line 61 of file structuralConstraint.h.

Constructor & Destructor Documentation

◆ StructuralConstraintNoParentNodes() [1/4]

gum::learning::StructuralConstraintNoParentNodes::StructuralConstraintNoParentNodes ( )

default constructor

Definition at line 60 of file structuralConstraintNoParentNodes.cpp.

References StructuralConstraintNoParentNodes().

Referenced by StructuralConstraintNoParentNodes(), StructuralConstraintNoParentNodes(), StructuralConstraintNoParentNodes(), StructuralConstraintNoParentNodes(), ~StructuralConstraintNoParentNodes(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StructuralConstraintNoParentNodes() [2/4]

gum::learning::StructuralConstraintNoParentNodes::StructuralConstraintNoParentNodes ( const DiGraph & graph)

constructor starting with a given graph

Definition at line 65 of file structuralConstraintNoParentNodes.cpp.

65 {
66 setGraph(graph);
67 GUM_CONSTRUCTOR(StructuralConstraintNoParentNodes);
68 }

References StructuralConstraintNoParentNodes().

Here is the call graph for this function:

◆ StructuralConstraintNoParentNodes() [3/4]

gum::learning::StructuralConstraintNoParentNodes::StructuralConstraintNoParentNodes ( const StructuralConstraintNoParentNodes & from)

copy constructor

Definition at line 71 of file structuralConstraintNoParentNodes.cpp.

72 : _noParentNodes_(from._noParentNodes_) {
74 }
NodeSet _noParentNodes_
the ForbiddenArcs on which we perform checks

References StructuralConstraintNoParentNodes(), and _noParentNodes_.

Here is the call graph for this function:

◆ StructuralConstraintNoParentNodes() [4/4]

gum::learning::StructuralConstraintNoParentNodes::StructuralConstraintNoParentNodes ( StructuralConstraintNoParentNodes && from)

move constructor

Definition at line 77 of file structuralConstraintNoParentNodes.cpp.

78 : _noParentNodes_(std::move(from._noParentNodes_)) {
80 }

References StructuralConstraintNoParentNodes(), and _noParentNodes_.

Here is the call graph for this function:

◆ ~StructuralConstraintNoParentNodes()

gum::learning::StructuralConstraintNoParentNodes::~StructuralConstraintNoParentNodes ( )
virtual

destructor

Definition at line 83 of file structuralConstraintNoParentNodes.cpp.

83 {
85 }

References StructuralConstraintNoParentNodes().

Here is the call graph for this function:

Member Function Documentation

◆ addNode()

void gum::learning::StructuralConstraintNoParentNodes::addNode ( NodeId node)

assign a new node without parent

◆ checkArcAdditionAlone()

bool gum::learning::StructuralConstraintNoParentNodes::checkArcAdditionAlone ( NodeId x,
NodeId y ) const

checks whether the constraints enable to add arc (x,y)

Referenced by checkModificationAlone().

Here is the caller graph for this function:

◆ checkArcDeletionAlone()

bool gum::learning::StructuralConstraintNoParentNodes::checkArcDeletionAlone ( NodeId x,
NodeId y ) const

checks whether the constraints enable to remove arc (x,y)

Referenced by checkModificationAlone().

Here is the caller graph for this function:

◆ checkArcReversalAlone()

bool gum::learning::StructuralConstraintNoParentNodes::checkArcReversalAlone ( NodeId x,
NodeId y ) const

checks whether the constraints enable to reverse arc (x,y)

Referenced by checkModificationAlone().

Here is the caller graph for this function:

◆ checkArcTriangleDeletion1Alone()

bool gum::learning::StructuralConstraintNoParentNodes::checkArcTriangleDeletion1Alone ( NodeId node1,
NodeId node2,
NodeId node3 ) const

checks whether the constraints enable triangle deletion1

An arc triangle deletion1 substitutes triangle node1 -> node2 -> node3 + node1 -> node3 into v-structure node2 -> node1 <- node3

Referenced by checkModificationAlone().

Here is the caller graph for this function:

◆ checkArcTriangleDeletion2Alone()

bool gum::learning::StructuralConstraintNoParentNodes::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().

Here is the caller graph for this function:

◆ checkModificationAlone() [1/6]

bool gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone ( const ArcAddition & change) const

checks whether the constraints enable to add an arc

◆ checkModificationAlone() [2/6]

bool gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone ( const ArcDeletion & change) const

checks whether the constraints enable to remove an arc

◆ checkModificationAlone() [3/6]

bool gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone ( const ArcReversal & change) const

checks whether the constraints enable to reverse an arc

◆ checkModificationAlone() [4/6]

bool gum::learning::StructuralConstraintNoParentNodes::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

◆ checkModificationAlone() [5/6]

bool gum::learning::StructuralConstraintNoParentNodes::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

◆ checkModificationAlone() [6/6]

bool gum::learning::StructuralConstraintNoParentNodes::checkModificationAlone ( const GraphChange & change) const

checks whether the constraints enable to perform a graph change

Definition at line 101 of file structuralConstraintNoParentNodes.cpp.

101 {
102 switch (change.type()) {
104 return checkArcAdditionAlone(change.node1(), change.node2());
105
107 return checkArcDeletionAlone(change.node1(), change.node2());
108
110 return checkArcReversalAlone(change.node1(), change.node2());
111
113 return checkArcTriangleDeletion1Alone(change.node1(), change.node2(), change.node3());
114
116 return checkArcTriangleDeletion2Alone(change.node1(), change.node2(), change.node3());
117
118 default :
119 GUM_ERROR(OperationNotAllowed,
120 "edge modifications are not "
121 "supported by the No-Parent Nodes structural constraint");
122 }
123 }
bool checkArcDeletionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to remove arc (x,y)
bool checkArcTriangleDeletion2Alone(NodeId node1, NodeId node2, NodeId node3) const
checks whether the constraints enable to apply an ArcTriangleDeletion2
bool checkArcTriangleDeletion1Alone(NodeId node1, NodeId node2, NodeId node3) const
checks whether the constraints enable triangle deletion1
bool checkArcReversalAlone(NodeId x, NodeId y) const
checks whether the constraints enable to reverse arc (x,y)
bool checkArcAdditionAlone(NodeId x, NodeId y) const
checks whether the constraints enable to add arc (x,y)
#define GUM_ERROR(type, msg)
Definition exceptions.h:76

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().

Here is the call graph for this function:

◆ eraseNode()

void gum::learning::StructuralConstraintNoParentNodes::eraseNode ( NodeId node)

remove a node without parent

◆ isAlwaysInvalidAlone()

bool gum::learning::StructuralConstraintNoParentNodes::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.

◆ modifyGraphAlone() [1/6]

void gum::learning::StructuralConstraintNoParentNodes::modifyGraphAlone ( const ArcAddition & change)

notify the constraint of a modification of the graph

◆ modifyGraphAlone() [2/6]

void gum::learning::StructuralConstraintNoParentNodes::modifyGraphAlone ( const ArcDeletion & change)

notify the constraint of a modification of the graph

◆ modifyGraphAlone() [3/6]

void gum::learning::StructuralConstraintNoParentNodes::modifyGraphAlone ( const ArcReversal & change)

notify the constraint of a modification of the graph

◆ modifyGraphAlone() [4/6]

void gum::learning::StructuralConstraintNoParentNodes::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

◆ modifyGraphAlone() [5/6]

void gum::learning::StructuralConstraintNoParentNodes::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

◆ modifyGraphAlone() [6/6]

void gum::learning::StructuralConstraintNoParentNodes::modifyGraphAlone ( const GraphChange & change)

notify the constraint of a modification of the graph

◆ nodes()

const NodeSet & gum::learning::StructuralConstraintNoParentNodes::nodes ( ) const

returns the set of nodes without parent

◆ operator=() [1/2]

StructuralConstraintNoParentNodes & gum::learning::StructuralConstraintNoParentNodes::operator= ( const StructuralConstraintNoParentNodes & from)

copy operator

Definition at line 89 of file structuralConstraintNoParentNodes.cpp.

89 {
90 if (this != &from) { _noParentNodes_ = from._noParentNodes_; }
91 return *this;
92 }

References StructuralConstraintNoParentNodes(), and _noParentNodes_.

Here is the call graph for this function:

◆ operator=() [2/2]

StructuralConstraintNoParentNodes & gum::learning::StructuralConstraintNoParentNodes::operator= ( StructuralConstraintNoParentNodes && from)

move operator

Definition at line 96 of file structuralConstraintNoParentNodes.cpp.

96 {
97 if (this != &from) { _noParentNodes_ = std::move(from._noParentNodes_); }
98 return *this;
99 }

References StructuralConstraintNoParentNodes(), and _noParentNodes_.

Here is the call graph for this function:

◆ setGraphAlone()

void gum::learning::StructuralConstraintNoParentNodes::setGraphAlone ( const DiGraph & graph)

sets a new graph from which we will perform checkings

◆ setNodes()

void gum::learning::StructuralConstraintNoParentNodes::setNodes ( const NodeSet & set)

assign a set of nodes without parent

Member Data Documentation

◆ _noParentNodes_

NodeSet gum::learning::StructuralConstraintNoParentNodes::_noParentNodes_
protected

the ForbiddenArcs on which we perform checks

Definition at line 216 of file structuralConstraintNoParentNodes.h.

Referenced by StructuralConstraintNoParentNodes(), StructuralConstraintNoParentNodes(), operator=(), and operator=().


The documentation for this class was generated from the following files: