![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
An efficient unconstrained elimination sequence algorithm. More...
#include <defaultEliminationSequenceStrategy.h>
Public Member Functions | |
Constructors / Destructors | |
DefaultEliminationSequenceStrategy (double theRatio=GUM_QUASI_RATIO, double theThreshold=GUM_WEIGHT_THRESHOLD) | |
default constructor (uses an empty graph) More... | |
DefaultEliminationSequenceStrategy (UndiGraph *graph, const NodeProperty< Size > *dom_sizes, double ratio=GUM_QUASI_RATIO, double threshold=GUM_WEIGHT_THRESHOLD) | |
constructor for an a priori non empty graph More... | |
DefaultEliminationSequenceStrategy (const DefaultEliminationSequenceStrategy &from) | |
copy constructor More... | |
DefaultEliminationSequenceStrategy (DefaultEliminationSequenceStrategy &&) | |
move constructor More... | |
virtual | ~DefaultEliminationSequenceStrategy () |
destructor More... | |
virtual DefaultEliminationSequenceStrategy * | 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 DefaultEliminationSequenceStrategy * | 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 | |
UndiGraph * | graph () const noexcept |
returns the current graph More... | |
const NodeProperty< Size > * | domainSizes () const noexcept |
returns the current domain sizes More... | |
Protected Attributes | |
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... | |
An efficient unconstrained elimination sequence algorithm.
Class DefaultEliminationSequenceStrategy implements an unconstrained elimination sequence algorithm (that is, there is no external constraint on the possible elimination ordering). The ordering is determined as follows:
with their neighbors) are eliminated first
their neighbors, they become simplicial) and that create small cliques,
fill-ins to create cliques) that would create small cliques, are eliminated
last nodes to be eliminated.
Definition at line 75 of file defaultEliminationSequenceStrategy.h.
gum::DefaultEliminationSequenceStrategy::DefaultEliminationSequenceStrategy | ( | 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 35 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::DefaultEliminationSequenceStrategy::DefaultEliminationSequenceStrategy | ( | UndiGraph * | graph, |
const NodeProperty< Size > * | dom_sizes, | ||
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 | the domain sizes of the nodes to be eliminated |
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 43 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::DefaultEliminationSequenceStrategy::DefaultEliminationSequenceStrategy | ( | const DefaultEliminationSequenceStrategy & | from | ) |
copy constructor
Definition at line 56 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::DefaultEliminationSequenceStrategy::DefaultEliminationSequenceStrategy | ( | DefaultEliminationSequenceStrategy && | from | ) |
move constructor
Definition at line 73 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
destructor
Definition at line 87 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
create a new simplicial set suited for the current graph
Definition at line 105 of file defaultEliminationSequenceStrategy.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
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 183 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
clears the sequence (to prepare, for instance, a new elimination sequence)
Reimplemented from gum::EliminationSequenceStrategy.
Definition at line 136 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
virtual copy constructor
Implements gum::UnconstrainedEliminationSequenceStrategy.
Definition at line 100 of file defaultEliminationSequenceStrategy.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 199 of file defaultEliminationSequenceStrategy.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 208 of file defaultEliminationSequenceStrategy.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().
|
finalvirtual |
creates a new elimination sequence of the same type as the current object, but this sequence contains only an empty graph
Implements gum::UnconstrainedEliminationSequenceStrategy.
Definition at line 95 of file defaultEliminationSequenceStrategy.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 147 of file defaultEliminationSequenceStrategy.cpp.
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 192 of file defaultEliminationSequenceStrategy.cpp.
References gum::Set< Key, Alloc >::emplace().
|
finalvirtual |
indicates whether the elimination sequence updates by itself the graph after a node has been eliminated
Some algorithms have more informations than the triangulation algorithm to update the graph after a node has been eliminated. They can thus exploit these informations to update the graph faster than the triangulation. Hence the latter should delegate this operation to the elimination sequence. This is the case, for instance, for the defaultEliminationSequence, which uses a SimplicialSet that knows that some eliminated nodes do not require any fill-in.
Implements gum::EliminationSequenceStrategy.
Definition at line 196 of file defaultEliminationSequenceStrategy.cpp.
|
finalvirtual |
sets a new graph to be triangulated
The elimination sequence algorithm reinitializes its data to start a new triangulation with Graph "graph"
graph | the new graph to be triangulated |
dom_sizes | the domain sizes of the variables/nodes |
Reimplemented from gum::EliminationSequenceStrategy.
Definition at line 125 of file defaultEliminationSequenceStrategy.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 219 of file defaultEliminationSequenceStrategy.h.
|
private |
indicates whether we compute new fill-ins
Definition at line 231 of file defaultEliminationSequenceStrategy.h.
|
private |
the ratio used by simplicial_set for its quasi-simplicial nodes
Definition at line 225 of file defaultEliminationSequenceStrategy.h.
|
private |
the simplicial set used for determining the best nodes to eliminate
Definition at line 222 of file defaultEliminationSequenceStrategy.h.
|
private |
the threshold used by simplicial_set to determine small cliques
Definition at line 228 of file defaultEliminationSequenceStrategy.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.