![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
The basic class for computing the next graph changes possible in a structure learning algorithm. More...
#include <graphChangesGeneratorOnSubDiGraph.h>
Public Types | |
| using | iterator = typename Set< GraphChange >::const_iterator |
| the iterator for parsing the list of possible graph change operators | |
| using | const_iterator = iterator |
| the const iterator for parsing the list of graph change operators | |
Public Member Functions | |
Constructors / Destructors | |
| GraphChangesGeneratorOnSubDiGraph (STRUCT_CONSTRAINT &constraint) | |
| default constructor | |
| GraphChangesGeneratorOnSubDiGraph (const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > &from) | |
| copy constructor | |
| GraphChangesGeneratorOnSubDiGraph (GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > &&from) | |
| move operator | |
| virtual | ~GraphChangesGeneratorOnSubDiGraph () |
| destructor | |
Operators | |
| GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & | operator= (const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > &from) |
| copy operator | |
| GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & | operator= (GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > &&from) |
| move operator | |
Iterators | |
| iterator | begin () const |
| returns an (unsafe) iterator on the beginning of the list of operators | |
| const iterator & | end () const |
| returns an (unsafe) iterator on the end of the list of operators | |
Accessors / Modifiers | |
| STRUCT_CONSTRAINT & | constraint () const noexcept |
| returns the constraint that is used by the generator | |
| void | setGraph (const DiGraph &graph) |
| sets a new graph from which the operator will compute possible changes | |
| void | setTargets (const NodeSet &nodes) |
| assign a set of target nodes | |
| void | addTarget (NodeId node) |
| adds a new target node | |
| void | eraseTarget (NodeId node) |
| removes a target | |
| void | setTails (const NodeSet &nodes) |
| assign a set of "tail" nodes | |
| void | setTails (Size nb_nodes) |
| assign a set of "tail" nodes from 0 to nb_nodes - 1 | |
| void | addTail (NodeId node) |
| adds a new "tail" node | |
| void | eraseTail (NodeId node) |
| removes a tail node | |
| void | modifyGraph (const ArcAddition &change) |
| notify the operator set of a change applied to the graph | |
| void | modifyGraph (const ArcDeletion &change) |
| notify the operator set of a change applied to the graph | |
| void | modifyGraph (const ArcReversal &change) |
| notify the operator set of a change applied to the graph | |
| void | modifyGraph (const GraphChange &change) |
| notify the operator set of a change applied to the graph | |
| void | clearChanges () noexcept |
| empty the set of possible change operators that can be applied | |
| void | notifyGetCompleted () |
| notifies the generator that we have parsed all its legal changes | |
| void | setMaxNbThreads (Size nb) noexcept |
| sets the maximum number of threads used to compute the set of changes | |
Protected Member Functions | |
| void | createChanges_ () |
| create the set of legal and illegal changes from a given graph | |
Protected Attributes | |
| STRUCT_CONSTRAINT * | constraint_ |
| a reference on the structural constraint used to restrict the changes | |
| NodeSet | target_nodes_ |
| the set of target nodes | |
| NodeSet | tail_nodes_ |
| the tail nodes (other extremities than the targets) | |
| Set< GraphChange > | legal_changes_ |
| the current set of operators | |
Private Attributes | |
| Size | _max_threads_number_ {gum::getNumberOfThreads()} |
| the max number of threads authorized | |
The basic class for computing the next graph changes possible in a structure learning algorithm.
Structure learning algorithm try different modifications of the graph. Class GraphChangesGeneratorOnSubDiGraph provides a simple way to compute those that we wish to perform when we wish to limit the set of changes over a subgraph of the graph we learn. For instance, we may wish to relearn an already partially learnt structure just around nodes A,B,C. In this case, we can set the set of target nodes of the GraphChangesGeneratorOnSubDiGraph to {A,B,C} and the set of "tail" nodes as all the nodes of the graph. In this case, only the arcs whose heads are A, B or C will be trnasmitted to the learning algorithm.
Basically, the idea is to use method setGraph at the beginning of the structure learning in order to initialize the possible set of operators. Then, parse this set using a for ( auto iter = operator_set.begin (); iter != operator_set.end (); ++iter ) loop and compute the scores induced by these changes. When this is done, flush the operator set by calling method clearChanges. Then iterate changes and after each new change applied, used again the iterator for loop, and so on. Note that, whenever you execute method modifyGraph, this will automatically flush the current list of changes and put into the list only the changes that are affected by the graph modification.
Definition at line 113 of file graphChangesGeneratorOnSubDiGraph.h.
| using gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::const_iterator = iterator |
the const iterator for parsing the list of graph change operators
Definition at line 119 of file graphChangesGeneratorOnSubDiGraph.h.
| using gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::iterator = typename Set< GraphChange >::const_iterator |
the iterator for parsing the list of possible graph change operators
Definition at line 116 of file graphChangesGeneratorOnSubDiGraph.h.
| gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::GraphChangesGeneratorOnSubDiGraph | ( | STRUCT_CONSTRAINT & | constraint | ) |
default constructor
References constraint().
Referenced by GraphChangesGeneratorOnSubDiGraph(), GraphChangesGeneratorOnSubDiGraph(), ~GraphChangesGeneratorOnSubDiGraph(), operator=(), and operator=().
| gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::GraphChangesGeneratorOnSubDiGraph | ( | const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & | from | ) |
copy constructor
References GraphChangesGeneratorOnSubDiGraph().
| gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::GraphChangesGeneratorOnSubDiGraph | ( | GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > && | from | ) |
move operator
References GraphChangesGeneratorOnSubDiGraph().
|
virtual |
destructor
References GraphChangesGeneratorOnSubDiGraph().
| void gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::addTail | ( | NodeId | node | ) |
| void gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::addTarget | ( | NodeId | node | ) |
adds a new target node
References addTarget().
Referenced by addTarget().
|
virtual |
returns an (unsafe) iterator on the beginning of the list of operators
Implements gum::learning::IGraphChangesGenerator4DiGraph.
|
virtualnoexcept |
empty the set of possible change operators that can be applied
Implements gum::learning::IGraphChangesGenerator4DiGraph.
References clearChanges().
Referenced by clearChanges().
|
noexcept |
returns the constraint that is used by the generator
Referenced by GraphChangesGeneratorOnSubDiGraph().
|
protected |
create the set of legal and illegal changes from a given graph
References createChanges_().
Referenced by createChanges_().
|
virtual |
returns an (unsafe) iterator on the end of the list of operators
Implements gum::learning::IGraphChangesGenerator4DiGraph.
| void gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::eraseTail | ( | NodeId | node | ) |
removes a tail node
References eraseTail().
Referenced by eraseTail().
| void gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::eraseTarget | ( | NodeId | node | ) |
removes a target
References eraseTarget().
Referenced by eraseTarget().
|
virtual |
notify the operator set of a change applied to the graph
Implements gum::learning::IGraphChangesGenerator4DiGraph.
References modifyGraph().
Referenced by modifyGraph(), modifyGraph(), modifyGraph(), and modifyGraph().
|
virtual |
notify the operator set of a change applied to the graph
Implements gum::learning::IGraphChangesGenerator4DiGraph.
References modifyGraph().
|
virtual |
notify the operator set of a change applied to the graph
Implements gum::learning::IGraphChangesGenerator4DiGraph.
References modifyGraph().
|
virtual |
notify the operator set of a change applied to the graph
Implements gum::learning::IGraphChangesGenerator4DiGraph.
References modifyGraph().
|
virtual |
notifies the generator that we have parsed all its legal changes
Implements gum::learning::IGraphChangesGenerator4DiGraph.
References notifyGetCompleted().
Referenced by notifyGetCompleted().
| GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::operator= | ( | const GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & | from | ) |
copy operator
References GraphChangesGeneratorOnSubDiGraph().
| GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > & gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::operator= | ( | GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT > && | from | ) |
move operator
References GraphChangesGeneratorOnSubDiGraph().
|
virtual |
sets a new graph from which the operator will compute possible changes
Implements gum::learning::IGraphChangesGenerator4DiGraph.
References setGraph().
Referenced by setGraph().
|
noexcept |
sets the maximum number of threads used to compute the set of changes
References setMaxNbThreads().
Referenced by setMaxNbThreads().
| void gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::setTails | ( | const NodeSet & | nodes | ) |
assign a set of "tail" nodes
References setTails().
Referenced by setTails(), and setTails().
| void gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::setTails | ( | Size | nb_nodes | ) |
assign a set of "tail" nodes from 0 to nb_nodes - 1
References setTails().
| void gum::learning::GraphChangesGeneratorOnSubDiGraph< STRUCT_CONSTRAINT >::setTargets | ( | const NodeSet & | nodes | ) |
assign a set of target nodes
References setTargets().
Referenced by setTargets().
|
private |
the max number of threads authorized
Definition at line 243 of file graphChangesGeneratorOnSubDiGraph.h.
|
protected |
a reference on the structural constraint used to restrict the changes
Definition at line 227 of file graphChangesGeneratorOnSubDiGraph.h.
|
protected |
the current set of operators
Definition at line 236 of file graphChangesGeneratorOnSubDiGraph.h.
|
protected |
the tail nodes (other extremities than the targets)
Definition at line 233 of file graphChangesGeneratorOnSubDiGraph.h.
|
protected |
the set of target nodes
Definition at line 230 of file graphChangesGeneratorOnSubDiGraph.h.