48#ifndef GUM_LEARNING_GRAPH_CHANGES_SELECTOR_4_DIGRAPH_H
49#define GUM_LEARNING_GRAPH_CHANGES_SELECTOR_4_DIGRAPH_H
66 template <
typename STRUCTURAL_CONSTRAINT,
typename GRAPH_CHANGES_GENERATOR >
79 STRUCTURAL_CONSTRAINT& constraint,
80 GRAPH_CHANGES_GENERATOR& changes_generator);
104 GRAPH_CHANGES_GENERATOR >& from);
239 const NodeId target_node);
Base class for all oriented graphs.
A priorityQueue is a heap in which each element has a mutable priority.
The generic class for storing (ordered) sequences of objects.
double bestScore()
return the score of the best graph change
bool isChangeValid(const GraphChange &change) const
indicates whether a given change is valid or not
Score * _score_
the scoring function
Set< NodeId > _queues_to_update_
the set of queues to update when applying several changes
Sequence< GraphChange > _changes_
a sequence containing all the possible changes
void updateScoresAfterAppliedChanges()
recompute all the scores after the application of several changes
GeneratorType & graphChangeGenerator() const noexcept
returns the generator used by the selector
void setGraph(DiGraph &graph)
sets the graph from which scores are computed
void _illegal2LegalChanges_(Set< std::size_t > &changes_to_recompute)
remove the now legal changes from the illegal set
bool empty()
indicates whether the selector still contains graph changes
std::vector< std::pair< NodeId, double > > nodesSortedByBestScore() const
returns the set of queues sorted by decreasing top priority
std::vector< std::pair< double, double > > _change_scores_
the scores for the head and tail of all the changes
GraphChangesSelector4DiGraph(const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR > &from)
copy constructor
~GraphChangesSelector4DiGraph()
destructor
NodeProperty< double > _node_current_scores_
the current score of each node
GraphChangesSelector4DiGraph(Score &score, STRUCTURAL_CONSTRAINT &constraint, GRAPH_CHANGES_GENERATOR &changes_generator)
default constructor
STRUCTURAL_CONSTRAINT * _constraint_
the set of constraints used to determine valid changes
void _findLegalChangesNeedingUpdate_(Set< std::size_t > &changes_to_recompute, const NodeId target_node)
finds the changes that are affected by a given node modification
GRAPH_CHANGES_GENERATOR * _changes_generator_
the generator that returns the set of possible changes
void _updateScores_(const Set< std::size_t > &changes_to_recompute)
perform the necessary updates of the scores
std::vector< std::pair< NodeId, double > > nodesUnsortedWithScore() const
returns the set of queues top priorities
NodeProperty< std::vector< NodeId > > _parents_
the set of parents of each node (speeds-up score computations)
Set< std::size_t > _illegal_changes_
the set of changes known to be currently illegal (due to the constraints)
void applyChangeWithoutScoreUpdate(const GraphChange &change)
indicate to the selector that one of serveral changes has been applied
PriorityQueue< NodeId, double, std::greater< double > > _node_queue_
a global priority queue indicating for each node its best score
NodeProperty< PriorityQueue< std::size_t, double, std::greater< double > > > _change_queue_per_node_
for each node, a priority queue sorting GraphChanges by decreasing score
void _getNewChanges_()
get from the graph change generator a new set of changes
bool _isChangeValid_(const std::size_t index) const
indicates whether a given change is valid or not
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR > & operator=(const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR > &from)
copy operator
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR > & operator=(GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR > &&from)
move operator
void _invalidateChange_(const std::size_t change_index)
put a change into the illegal set
void applyChange(const GraphChange &change)
indicate to the selector that a change has been applied
GRAPH_CHANGES_GENERATOR GeneratorType
the type of the generator
const GraphChange & bestChange()
returns the best graph change to examine
bool _queues_valid_
indicates whether we need to recompute whether the queue is empty or not
GraphChangesSelector4DiGraph(GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR > &&from)
move constructor
The base class for all the scores used for learning (BIC, BDeu, etc).
The mecanism to compute the next available graph changes for directed structure learning search algor...
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
the base class for all the scores used for learning (BIC, BDeu, etc)