aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS > Class Template Reference

the "meta-programming" class for storing structural constraintsIn aGrUM, there are two ways to store sets of structural constraints: the first one is to put them into a StructuralConstraintSetDynamic. More...

#include <structuralConstraintSetStatic.h>

Inherits minConstraints< CONSTRAINT1, OTHER_CONSTRAINTS... >.

Public Member Functions

Constructors / Destructors
 StructuralConstraintSetStatic ()
 default constructor More...
 
 StructuralConstraintSetStatic (const StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS... > &)
 copy constructor More...
 
 ~StructuralConstraintSetStatic ()
 destructor More...
 
Operators
StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS... > & operator= (const StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS... > &)
 copy operator 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_< CONSTRAINT1, OTHER_CONSTRAINTS... >::minConstraints
 

Detailed Description

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
class gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >

the "meta-programming" class for storing structural constraints

In aGrUM, there are two ways to store sets of structural constraints: the first one is to put them into a StructuralConstraintSetDynamic.

This class allows to add at runtime any constraint you wish. As such, it is very generic but, by not knowing at compile time the constraints that will be stored into the vector, calling its methods has a slight overhead. On the other hand, if you already know all the constraints you wish to apply, the StructuralConstraintSetStatic is better suited because it will compute at compile time how to call the constraint's methods in a most efficient way: if these methods are inlined, there will be no overhead at all when calling these methods.

This class is intended to store structural constraints and help applying them during learning in a most efficient way. The idea is that it will compute at compile time the class hierarchy graph of the set of constraints and will determine the set of distinct structural constraints in the set. Then, each time we wish to apply a method, say a graph modification check to all the constraints, the class will apply the methods once on each distinct constraint, hence avoiding duplicates.

Definition at line 402 of file structuralConstraintSetStatic.h.

Member Typedef Documentation

◆ constraints

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
using gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::constraints = typename _StructuralConstraintSetStatic_< CONSTRAINT1, OTHER_CONSTRAINTS... >::minConstraints

Definition at line 408 of file structuralConstraintSetStatic.h.

Constructor & Destructor Documentation

◆ StructuralConstraintSetStatic() [1/2]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::StructuralConstraintSetStatic ( )

default constructor

◆ StructuralConstraintSetStatic() [2/2]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::StructuralConstraintSetStatic ( const StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS... > &  )

copy constructor

◆ ~StructuralConstraintSetStatic()

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::~StructuralConstraintSetStatic ( )

destructor

Member Function Documentation

◆ checkArcAddition()

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::checkArcAddition ( NodeId  x,
NodeId  y 
) const

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

◆ checkArcDeletion()

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::checkArcDeletion ( NodeId  x,
NodeId  y 
) const

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

◆ checkArcReversal()

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::checkArcReversal ( NodeId  x,
NodeId  y 
) const

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

◆ checkModification() [1/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::checkModification ( const ArcAddition change) const

checks whether the constraints enable to add an arc

◆ checkModification() [2/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::checkModification ( const ArcDeletion change) const

checks whether the constraints enable to remove an arc

◆ checkModification() [3/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::checkModification ( const ArcReversal change) const

checks whether the constraints enable to reverse an arc

◆ checkModification() [4/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::checkModification ( const GraphChange change) const

checks whether the constraints enable to perform a graph change

◆ isAlwaysInvalid()

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
bool gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::isAlwaysInvalid ( const GraphChange change) const

indicates whether a change will always violate the constraint

◆ modifyGraph() [1/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
void gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::modifyGraph ( const ArcAddition change)

notify the constraint of a modification of the graph

◆ modifyGraph() [2/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
void gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::modifyGraph ( const ArcDeletion change)

notify the constraint of a modification of the graph

◆ modifyGraph() [3/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
void gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::modifyGraph ( const ArcReversal change)

notify the constraint of a modification of the graph

◆ modifyGraph() [4/4]

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
void gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::modifyGraph ( const GraphChange change)

notify the constraint of a modification of the graph

◆ operator=()

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS... >& gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::operator= ( const StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS... > &  )

copy operator

◆ setGraph()

template<typename CONSTRAINT1, typename... OTHER_CONSTRAINTS>
void gum::learning::StructuralConstraintSetStatic< CONSTRAINT1, OTHER_CONSTRAINTS >::setGraph ( const DiGraph graph)

sets a new graph from which we will perform checkings


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