aGrUM  0.16.0
gum::learning::StructuralConstraintPossibleEdges Class Reference

the structural constraint for forbidding the creation of some arcs except those defined in the class during structure learning More...

#include <structuralConstraintPossibleEdges.h>

+ Inheritance diagram for gum::learning::StructuralConstraintPossibleEdges:
+ Collaboration diagram for gum::learning::StructuralConstraintPossibleEdges:

Public Member Functions

Constructors / Destructors
 StructuralConstraintPossibleEdges ()
 default constructor More...
 
 StructuralConstraintPossibleEdges (const DiGraph &graph)
 constructor starting with a given graph More...
 
 StructuralConstraintPossibleEdges (const StructuralConstraintPossibleEdges &from)
 copy constructor More...
 
 StructuralConstraintPossibleEdges (StructuralConstraintPossibleEdges &&from)
 move constructor More...
 
virtual ~StructuralConstraintPossibleEdges ()
 destructor More...
 
Operators
StructuralConstraintPossibleEdgesoperator= (const StructuralConstraintPossibleEdges &from)
 copy operator More...
 
StructuralConstraintPossibleEdgesoperator= (StructuralConstraintPossibleEdges &&from)
 move operator More...
 
Specific Accessors / Modifiers
void setEdges (const EdgeSet &set)
 assign a set of forbidden arcs More...
 
void addEdge (const Edge &edge)
 assign a new forbidden arc More...
 
void eraseEdge (const Edge &edge)
 remove a forbidden arc More...
 
const EdgeSetedges () const
 returns the set of mandatory arcs 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

EdgeSet _PossibleEdges__possible_edges
 the PossibleEdges on which we perform checks More...
 

Detailed Description

the structural constraint for forbidding the creation of some arcs except those defined in the class during structure learning

Definition at line 46 of file structuralConstraintPossibleEdges.h.

Member Typedef Documentation

◆ allConstraints

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

Definition at line 42 of file structuralConstraint.h.

Constructor & Destructor Documentation

◆ StructuralConstraintPossibleEdges() [1/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( )

default constructor

Definition at line 42 of file structuralConstraintPossibleEdges.cpp.

42  {
43  GUM_CONSTRUCTOR(StructuralConstraintPossibleEdges);
44  }

◆ StructuralConstraintPossibleEdges() [2/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( const DiGraph graph)

constructor starting with a given graph

Definition at line 47 of file structuralConstraintPossibleEdges.cpp.

48  {
49  setGraph(graph);
50  GUM_CONSTRUCTOR(StructuralConstraintPossibleEdges);
51  }

◆ StructuralConstraintPossibleEdges() [3/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( const StructuralConstraintPossibleEdges from)

copy constructor

Definition at line 54 of file structuralConstraintPossibleEdges.cpp.

55  :
56  _PossibleEdges__possible_edges(from._PossibleEdges__possible_edges) {
58  }
EdgeSet _PossibleEdges__possible_edges
the PossibleEdges on which we perform checks

◆ StructuralConstraintPossibleEdges() [4/4]

gum::learning::StructuralConstraintPossibleEdges::StructuralConstraintPossibleEdges ( StructuralConstraintPossibleEdges &&  from)

move constructor

Definition at line 61 of file structuralConstraintPossibleEdges.cpp.

62  :
64  std::move(from._PossibleEdges__possible_edges)) {
66  }
EdgeSet _PossibleEdges__possible_edges
the PossibleEdges on which we perform checks

◆ ~StructuralConstraintPossibleEdges()

gum::learning::StructuralConstraintPossibleEdges::~StructuralConstraintPossibleEdges ( )
virtual

destructor

Definition at line 69 of file structuralConstraintPossibleEdges.cpp.

References operator=().

69  {
70  GUM_DESTRUCTOR(StructuralConstraintPossibleEdges);
71  }
+ Here is the call graph for this function:

Member Function Documentation

◆ addEdge()

void gum::learning::StructuralConstraintPossibleEdges::addEdge ( const Edge edge)

assign a new forbidden arc

Referenced by gum::learning::genericBNLearner::addPossibleEdge().

+ Here is the caller graph for this function:

◆ checkArcAdditionAlone()

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

◆ checkArcDeletionAlone()

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

◆ checkArcReversalAlone()

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

◆ checkModificationAlone() [1/4]

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

◆ checkModificationAlone() [2/4]

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

◆ checkModificationAlone() [3/4]

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

◆ checkModificationAlone() [4/4]

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

◆ edges()

const EdgeSet& gum::learning::StructuralConstraintPossibleEdges::edges ( ) const

returns the set of mandatory arcs

◆ eraseEdge()

void gum::learning::StructuralConstraintPossibleEdges::eraseEdge ( const Edge edge)

remove a forbidden arc

Referenced by gum::learning::genericBNLearner::erasePossibleEdge().

+ Here is the caller graph for this function:

◆ isAlwaysInvalidAlone()

bool gum::learning::StructuralConstraintPossibleEdges::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/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const ArcAddition change)

notify the constraint of a modification of the graph

Warning
If an already existing arc is added nothing is done. In particular, no exception is raised.
Exceptions
InvalidNodeexception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes

◆ modifyGraphAlone() [2/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const ArcDeletion change)

notify the constraint of a modification of the graph

Warning
If a nonexisting arc is removed, nothing is done. In particular, no exception is raised.

◆ modifyGraphAlone() [3/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const ArcReversal change)

notify the constraint of a modification of the graph

Warning
If an already existing arc is added, or if a nonexisting arc is removed, nothing is done. In particular, no exception is raised.
Exceptions
InvalidNodeexception is thrown if at least one extremity of the arc does not belong to the graph nodes

◆ modifyGraphAlone() [4/4]

void gum::learning::StructuralConstraintPossibleEdges::modifyGraphAlone ( const GraphChange change)

notify the constraint of a modification of the graph

Warning
If an already existing arc is added, or if a nonexisting arc is removed, nothing is done. In particular, no exception is raised.
Exceptions
InvalidNodeexception is thrown if an arc (x,y) is added and x or y does not belong to the graph nodes

◆ operator=() [1/2]

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

copy operator

Definition at line 75 of file structuralConstraintPossibleEdges.cpp.

References _PossibleEdges__possible_edges.

Referenced by ~StructuralConstraintPossibleEdges().

75  {
76  if (this != &from) {
77  _PossibleEdges__possible_edges = from._PossibleEdges__possible_edges;
78  }
79  return *this;
80  }
EdgeSet _PossibleEdges__possible_edges
the PossibleEdges on which we perform checks
+ Here is the caller graph for this function:

◆ operator=() [2/2]

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

move operator

Definition at line 84 of file structuralConstraintPossibleEdges.cpp.

References _PossibleEdges__possible_edges.

84  {
85  if (this != &from) {
87  std::move(from._PossibleEdges__possible_edges);
88  }
89  return *this;
90  }
EdgeSet _PossibleEdges__possible_edges
the PossibleEdges on which we perform checks

◆ setEdges()

void gum::learning::StructuralConstraintPossibleEdges::setEdges ( const EdgeSet set)

assign a set of forbidden arcs

Referenced by gum::learning::genericBNLearner::setPossibleEdges().

+ Here is the caller graph for this function:

◆ setGraphAlone()

void gum::learning::StructuralConstraintPossibleEdges::setGraphAlone ( const DiGraph graph)

sets a new graph from which we will perform checkings

Member Data Documentation

◆ _PossibleEdges__possible_edges

EdgeSet gum::learning::StructuralConstraintPossibleEdges::_PossibleEdges__possible_edges
protected

the PossibleEdges on which we perform checks

Definition at line 198 of file structuralConstraintPossibleEdges.h.

Referenced by operator=().


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