26 #ifndef GUM_LEARNING_GRAPH_CHANGES_SELECTOR_4_DIGRAPH_H 27 #define GUM_LEARNING_GRAPH_CHANGES_SELECTOR_4_DIGRAPH_H 48 template <
typename STRUCTURAL_CONSTRAINT,
49 typename GRAPH_CHANGES_GENERATOR,
50 template <
typename >
class ALLOC = std::allocator >
63 STRUCTURAL_CONSTRAINT& constraint,
64 GRAPH_CHANGES_GENERATOR& changes_generator);
69 GRAPH_CHANGES_GENERATOR,
75 GRAPH_CHANGES_GENERATOR,
90 GRAPH_CHANGES_GENERATOR,
93 GRAPH_CHANGES_GENERATOR,
98 GRAPH_CHANGES_GENERATOR,
101 GRAPH_CHANGES_GENERATOR,
120 bool empty(const
NodeId i);
144 double bestScore(const
NodeId i);
234 const NodeId target_node);
Base classes for oriented graphs.
NodeProperty< double > __node_current_scores
the current score of each node
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
bool empty()
indicates whether the selector still contains graph changes
The base class for all the scores used for learning (BIC, BDeu, etc)
GeneratorType & graphChangeGenerator() const noexcept
returns the generator used by the selector
the classes to account for structure changes in a graph
void __updateScores(const Set< std::size_t > &changes_to_recompute)
perform the necessary updates of the scores
STRUCTURAL_CONSTRAINT * __constraint
the set of constraints used to determine valid changes
The generic class for storing (ordered) sequences of objects.
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > & operator=(const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > &from)
copy operator
const GraphChange & bestChange()
returns the best graph change to examine
void applyChange(const GraphChange &change)
indicate to the selector that a change has been applied
Set< std::size_t > __illegal_changes
the set of changes known to be currently illegal (due to the constraints)
Score< ALLOC > * __score
the scoring function
~GraphChangesSelector4DiGraph()
destructor
gum is the global namespace for all aGrUM entities
PriorityQueue< NodeId, double, std::greater< double > > __node_queue
a global priority queue indicating for each node its best score
The class for generic Hash Tables.
The mecanism to compute the next available graph changes for directed structure learning search algor...
std::vector< std::pair< double, double > > __change_scores
the scores for the head and tail of all the changes
Representation of a setA Set is a structure that contains arbitrary elements.
The mecanism to compute the next available graph changes for directed structure learning search algor...
void applyChangeWithoutScoreUpdate(const GraphChange &change)
indicate to the selector that one of serveral changes has been applied
A priorityQueue is a heap in which each element has a mutable priorityA priority queue is quite simil...
bool __isChangeValid(const std::size_t index) const
indicates whether a given change is valid or not
NodeProperty< std::vector< NodeId, ALLOC< NodeId > > > __parents
the set of parents of each node (speeds-up score computations)
Base class for all oriented graphs.
Set< NodeId > __queues_to_update
the set of queues to update when applying several changes
double bestScore()
return the score of the best graph change
priority queues (in which an element cannot appear more than once)
bool __queues_valid
indicates whether we need to recompute whether the queue is empty or not
the base class for all the scores used for learning (BIC, BDeu, etc)
GraphChangesSelector4DiGraph(Score< ALLOC > &score, STRUCTURAL_CONSTRAINT &constraint, GRAPH_CHANGES_GENERATOR &changes_generator)
default constructor
void updateScoresAfterAppliedChanges()
recompute all the scores after the application of several changes
std::vector< std::pair< NodeId, double > > nodesUnsortedWithScore() const
returns the set of queues top priorities
Sequence< GraphChange > __changes
a sequence containing all the possible changes
std::vector< std::pair< NodeId, double > > nodesSortedByBestScore() const
returns the set of queues sorted by decreasing top priority
void __invalidateChange(const std::size_t change_index)
put a change into the illegal set
void __findLegalChangesNeedingUpdate(Set< std::size_t > &changes_to_recompute, const NodeId target_node)
finds the changes that are affected by a given node modification
void __illegal2LegalChanges(Set< std::size_t > &changes_to_recompute)
remove the now legal changes from the illegal set
void setGraph(DiGraph &graph)
sets the graph from which scores are computed
GRAPH_CHANGES_GENERATOR GeneratorType
the type of the generator
GRAPH_CHANGES_GENERATOR * __changes_generator
the generator that returns the set of possible changes
void __getNewChanges()
get from the graph change generator a new set of changes
bool isChangeValid(const GraphChange &change) const
indicates whether a given change is valid or not
Size NodeId
Type for node ids.
NodeProperty< PriorityQueue< std::size_t, double, std::greater< double > > > __change_queue_per_node
for each node, a priority queue sorting GraphChanges by decreasing score