![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
An Elimination sequence algorithm that imposes a given partial ordering on the nodes elimination sequence. More...
#include <defaultPartialOrderedEliminationSequenceStrategy.h>
Public Member Functions | |
Constructors / Destructors | |
DefaultPartialOrderedEliminationSequenceStrategy (double theRatio=GUM_QUASI_RATIO, double theThreshold=GUM_WEIGHT_THRESHOLD) | |
default constructor (uses an empty graph) More... | |
DefaultPartialOrderedEliminationSequenceStrategy (UndiGraph *graph, const NodeProperty< Size > *dom_sizes, const List< NodeSet > *subsets, double ratio=GUM_QUASI_RATIO, double threshold=GUM_WEIGHT_THRESHOLD) | |
constructor for an a priori non empty graph More... | |
DefaultPartialOrderedEliminationSequenceStrategy (const DefaultPartialOrderedEliminationSequenceStrategy &from) | |
copy constructor More... | |
DefaultPartialOrderedEliminationSequenceStrategy (DefaultPartialOrderedEliminationSequenceStrategy &&from) | |
move constructor More... | |
virtual | ~DefaultPartialOrderedEliminationSequenceStrategy () |
destructor More... | |
virtual DefaultPartialOrderedEliminationSequenceStrategy * | newFactory () const final |
creates a new elimination sequence of the same type as the current object, but this sequence contains only an empty graph More... | |
virtual DefaultPartialOrderedEliminationSequenceStrategy * | copyFactory () const final |
virtual copy constructor More... | |
Accessors / Modifiers | |
virtual bool | setGraph (UndiGraph *graph, const NodeProperty< Size > *dom_sizes) final |
sets a new graph to be triangulated More... | |
virtual void | clear () final |
clears the sequence (to prepare, for instance, a new elimination sequence) More... | |
virtual NodeId | nextNodeToEliminate () final |
returns the new node to be eliminated within the triangulation algorithm More... | |
virtual void | askFillIns (bool do_it) final |
if the elimination sequence is able to compute fill-ins, we indicate whether we want this feature to be activated More... | |
virtual bool | providesFillIns () const final |
indicates whether the fill-ins generated by the eliminated nodes, if needed, will be computed by the elimination sequence, or need be computed by the triangulation itself. More... | |
virtual bool | providesGraphUpdate () const final |
indicates whether the elimination sequence updates by itself the graph after a node has been eliminated More... | |
virtual void | eliminationUpdate (const NodeId node) final |
performs all the graph/fill-ins updates provided (if any) More... | |
virtual const EdgeSet & | fillIns () final |
in case fill-ins are provided, this function returns the fill-ins due to all the nodes eliminated so far More... | |
Accessors / Modifiers | |
virtual bool | setPartialOrder (const List< NodeSet > *subsets) |
sets a new partial ordering constraint on the elimination sequence More... | |
const List< NodeSet > * | partialOrder () const noexcept |
returns the current partial ordering More... | |
bool | isPartialOrderNeeded () const noexcept |
indicates if a new partial ordering is needed More... | |
Accessors / Modifiers | |
UndiGraph * | graph () const noexcept |
returns the current graph More... | |
const NodeProperty< Size > * | domainSizes () const noexcept |
returns the current domain sizes More... | |
Protected Attributes | |
const List< NodeSet > * | subsets_ {nullptr} |
the subsets constituting the partial ordering More... | |
List< NodeSet >::const_iterator | subset_iter_ |
the iterator indicating which is the current subset on which we work More... | |
NodeSet | nodeset_ |
the nodes which can be currently eliminated More... | |
bool | partial_order_needed_ {true} |
indicate whether a new partial ordering is necessary for the elimination More... | |
UndiGraph * | graph_ {nullptr} |
the graph to be triangulated More... | |
const NodeProperty< Size > * | domain_sizes_ {nullptr} |
the domain sizes of the variables/nodes More... | |
NodeProperty< double > | log_domain_sizes_ |
the log of the domain sizes of the variables/nodes More... | |
Protected Member Functions | |
bool | isPartialOrderNeeded_ (const List< NodeSet > *subsets) const |
indicate whether a partial ordering is compatible with the current graph More... | |
An Elimination sequence algorithm that imposes a given partial ordering on the nodes elimination sequence.
Class DefaultPartialOrderedEliminationSequenceStrategy implements an elimination sequence algorithm that satisfies a partial ordering, that is, the set of all the nodes is divided into several subsets. All the nodes of the first subset must be eliminated before the nodes of the second, which must be eliminated before those of the third subset, and so on. Within a subset, the ordering is determined as follows:
with their neighbors) are eliminated first
neighbors, they become simplicial) and that create small cliques, are eliminated (see Bodlaender's safe reductions)
fill-ins to create cliques) that would create small cliques, are eliminated
last nodes to be eliminated.
Definition at line 81 of file defaultPartialOrderedEliminationSequenceStrategy.h.
gum::DefaultPartialOrderedEliminationSequenceStrategy::DefaultPartialOrderedEliminationSequenceStrategy | ( | double | theRatio = GUM_QUASI_RATIO , |
double | theThreshold = GUM_WEIGHT_THRESHOLD |
||
) |
default constructor (uses an empty graph)
theRatio | the ratio used by the SimplicialSet included in the DefaultEliminationSequenceStrategy |
theThreshold | the weight threshhold of the SimplicialSet included in the DefaultEliminationSequenceStrategy |
Definition at line 38 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::DefaultPartialOrderedEliminationSequenceStrategy::DefaultPartialOrderedEliminationSequenceStrategy | ( | UndiGraph * | graph, |
const NodeProperty< Size > * | dom_sizes, | ||
const List< NodeSet > * | subsets, | ||
double | ratio = GUM_QUASI_RATIO , |
||
double | threshold = GUM_WEIGHT_THRESHOLD |
||
) |
constructor for an a priori non empty graph
graph | the graph to be triangulated, i.e., the nodes of which will be eliminated |
dom_sizes | thedomain sizes of the nodes/variables |
subsets | the list of the subsets constituting the partial ordering |
ratio | the ratio used by the SimplicialSet included in the DefaultEliminationSequenceStrategy |
threshold | the weight threshhold of the SimplicialSet included in the DefaultEliminationSequenceStrategy |
Definition at line 47 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::DefaultPartialOrderedEliminationSequenceStrategy::DefaultPartialOrderedEliminationSequenceStrategy | ( | const DefaultPartialOrderedEliminationSequenceStrategy & | from | ) |
copy constructor
Definition at line 63 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::DefaultPartialOrderedEliminationSequenceStrategy::DefaultPartialOrderedEliminationSequenceStrategy | ( | DefaultPartialOrderedEliminationSequenceStrategy && | from | ) |
move constructor
Definition at line 82 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
destructor
Definition at line 98 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
create a new simplicial set suited for the current graph
Definition at line 106 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
returns the best possible node to be eliminated
this function is used by method nextNodeToEliminate
Definition at line 149 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
if the elimination sequence is able to compute fill-ins, we indicate whether we want this feature to be activated
if the elimination sequence is able to compute fill-ins, we indicatewhether we want this feature to be activated
do_it | when true and the elimination sequence has the ability to compute fill-ins, the elimination sequence will actually compute them (for the triangulation to use them), else they will not be available. |
Implements gum::EliminationSequenceStrategy.
Definition at line 218 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
clears the sequence (to prepare, for instance, a new elimination sequence)
Reimplemented from gum::PartialOrderedEliminationSequenceStrategy.
Definition at line 138 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
virtual copy constructor
Implements gum::PartialOrderedEliminationSequenceStrategy.
Definition at line 280 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
noexceptinherited |
returns the current domain sizes
Definition at line 40 of file eliminationSequenceStrategy_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
performs all the graph/fill-ins updates provided (if any)
performs all the graph/fill-ins updates provided
node | the node the elimination of which requires the graph update |
Reimplemented from gum::EliminationSequenceStrategy.
Definition at line 238 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
in case fill-ins are provided, this function returns the fill-ins due to all the nodes eliminated so far
in case fill-ins are provided, this function returns the fill-ins generated after the last node elimination
Reimplemented from gum::EliminationSequenceStrategy.
Definition at line 263 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
noexceptinherited |
returns the current graph
Definition at line 36 of file eliminationSequenceStrategy_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
noexceptinherited |
indicates if a new partial ordering is needed
if the current partial ordering does not contain all the nodes of the graph or if the graph itself is not defined (nullptr) a new partial ordering will be needed for the next triangulation
Definition at line 44 of file partialOrderedEliminationSequenceStrategy_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
indicate whether a partial ordering is compatible with the current graph
The method checks whether all the nodes of the graph belong to the partial ordering.
Definition at line 99 of file partialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
creates a new elimination sequence of the same type as the current object, but this sequence contains only an empty graph
Implements gum::PartialOrderedEliminationSequenceStrategy.
Definition at line 273 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
returns the new node to be eliminated within the triangulation algorithm
NotFound | exception is thrown if there is no more node to eliminate in the graph |
Implements gum::EliminationSequenceStrategy.
Definition at line 173 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
noexceptinherited |
returns the current partial ordering
Definition at line 38 of file partialOrderedEliminationSequenceStrategy_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
indicates whether the fill-ins generated by the eliminated nodes, if needed, will be computed by the elimination sequence, or need be computed by the triangulation itself.
indicates whether the new fill-ins generated by a new eliminated node, if needed, will be computed by the elimination sequence, or need be computed by the triangulation itself.
An elimination sequence provides fill-ins to its triangulation if and only if it has the ability to compute them and it has been asked to do so (by method askFillIns)
Implements gum::EliminationSequenceStrategy.
Definition at line 227 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
indicates whether the elimination sequence updates by itself the graph after a node has been eliminated
Implements gum::EliminationSequenceStrategy.
Definition at line 233 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
|
finalvirtual |
sets a new graph to be triangulated
The elimination sequence algorithms reinitializes its data to start a new triangulation with graph Graph and a new partial ordrering
graph | the new graph to be triangulated |
dom_sizes | the domain sizes of the nodes/variables |
Reimplemented from gum::PartialOrderedEliminationSequenceStrategy.
Definition at line 126 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
sets a new partial ordering constraint on the elimination sequence
sets a new partial order
subsets | the list of the subsets constituting the partial ordering |
Definition at line 116 of file partialOrderedEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
for each node, the weight of the clique created by the node's elimination
Definition at line 223 of file defaultPartialOrderedEliminationSequenceStrategy.h.
|
private |
indicates whether we compute new fill-ins
Definition at line 235 of file defaultPartialOrderedEliminationSequenceStrategy.h.
|
private |
the ratio used by simplicial_set for its quasi-simplicial nodes
Definition at line 229 of file defaultPartialOrderedEliminationSequenceStrategy.h.
|
private |
the simplicial set used for determining the best nodes to eliminate
Definition at line 226 of file defaultPartialOrderedEliminationSequenceStrategy.h.
|
private |
the threshold used by simplicial_set to determine small cliques
Definition at line 232 of file defaultPartialOrderedEliminationSequenceStrategy.h.
|
protectedinherited |
the domain sizes of the variables/nodes
Definition at line 158 of file eliminationSequenceStrategy.h.
|
protectedinherited |
the graph to be triangulated
Definition at line 155 of file eliminationSequenceStrategy.h.
|
protectedinherited |
the log of the domain sizes of the variables/nodes
Definition at line 161 of file eliminationSequenceStrategy.h.
|
protectedinherited |
the nodes which can be currently eliminated
Definition at line 133 of file partialOrderedEliminationSequenceStrategy.h.
|
protectedinherited |
indicate whether a new partial ordering is necessary for the elimination
Definition at line 136 of file partialOrderedEliminationSequenceStrategy.h.
|
protectedinherited |
the iterator indicating which is the current subset on which we work
Definition at line 130 of file partialOrderedEliminationSequenceStrategy.h.
|
protectedinherited |
the subsets constituting the partial ordering
Definition at line 127 of file partialOrderedEliminationSequenceStrategy.h.