![]() |
aGrUM
0.16.0
|
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 82 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 39 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
Referenced by copyFactory(), DefaultPartialOrderedEliminationSequenceStrategy(), and newFactory().
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 49 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References DefaultPartialOrderedEliminationSequenceStrategy(), setGraph(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
gum::DefaultPartialOrderedEliminationSequenceStrategy::DefaultPartialOrderedEliminationSequenceStrategy | ( | const DefaultPartialOrderedEliminationSequenceStrategy & | from | ) |
copy constructor
Definition at line 66 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References DefaultPartialOrderedEliminationSequenceStrategy().
gum::DefaultPartialOrderedEliminationSequenceStrategy::DefaultPartialOrderedEliminationSequenceStrategy | ( | DefaultPartialOrderedEliminationSequenceStrategy && | from | ) |
move constructor
Definition at line 85 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __log_weights, __simplicial_set, gum::SimplicialSet::replaceLogWeights(), and ~DefaultPartialOrderedEliminationSequenceStrategy().
|
virtual |
destructor
Definition at line 102 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __simplicial_set.
Referenced by DefaultPartialOrderedEliminationSequenceStrategy().
|
private |
create a new simplicial set suited for the current graph
Definition at line 110 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __log_weights, __provide_fill_ins, __simplicial_ratio, __simplicial_set, __simplicial_threshold, gum::EliminationSequenceStrategy::_graph, gum::EliminationSequenceStrategy::_log_domain_sizes, and gum::SimplicialSet::setFillIns().
Referenced by setGraph().
|
private |
returns the best possible node to be eliminated
this function is used by method nextNodeToEliminate
Definition at line 152 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References gum::PartialOrderedEliminationSequenceStrategy::_nodeset, GUM_ERROR, and gum::PriorityQueueImplementation< Val, Priority, Cmp, Alloc, Gen >::priority().
Referenced by nextNodeToEliminate().
|
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 105 of file partialOrderedEliminationSequenceStrategy.cpp.
References gum::EliminationSequenceStrategy::_graph, gum::NodeGraphPart::existsNode(), gum::Set< Key, Alloc >::insert(), and gum::NodeGraphPart::size().
Referenced by gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
|
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 221 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __provide_fill_ins, __simplicial_set, and gum::SimplicialSet::setFillIns().
|
finalvirtual |
clears the sequence (to prepare, for instance, a new elimination sequence)
Reimplemented from gum::PartialOrderedEliminationSequenceStrategy.
Definition at line 141 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __log_weights, __simplicial_set, and gum::PartialOrderedEliminationSequenceStrategy::clear().
|
finalvirtual |
virtual copy constructor
Implements gum::PartialOrderedEliminationSequenceStrategy.
Definition at line 285 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References DefaultPartialOrderedEliminationSequenceStrategy().
|
noexceptinherited |
returns the current domain sizes
Definition at line 44 of file eliminationSequenceStrategy_inl.h.
References gum::EliminationSequenceStrategy::_domain_sizes.
|
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 242 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __simplicial_set, gum::EliminationSequenceStrategy::_graph, gum::PartialOrderedEliminationSequenceStrategy::_nodeset, gum::PartialOrderedEliminationSequenceStrategy::_partial_order_needed, gum::PartialOrderedEliminationSequenceStrategy::_subset_iter, gum::PartialOrderedEliminationSequenceStrategy::_subsets, gum::Set< Key, Alloc >::empty(), gum::Set< Key, Alloc >::erase(), gum::SimplicialSet::eraseClique(), gum::NodeGraphPart::existsNode(), gum::Set< Key, Alloc >::insert(), and gum::SimplicialSet::makeClique().
|
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 268 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __provide_fill_ins, __simplicial_set, gum::EliminationSequenceStrategy::fillIns(), and gum::SimplicialSet::fillIns().
|
noexceptinherited |
returns the current graph
Definition at line 37 of file eliminationSequenceStrategy_inl.h.
References gum::EliminationSequenceStrategy::_graph.
Referenced by gum::EliminationSequenceStrategy::setGraph().
|
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 46 of file partialOrderedEliminationSequenceStrategy_inl.h.
References gum::PartialOrderedEliminationSequenceStrategy::_partial_order_needed.
|
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 278 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __simplicial_ratio, __simplicial_threshold, and DefaultPartialOrderedEliminationSequenceStrategy().
|
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 176 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __log_weights, __nodeToEliminate(), __simplicial_set, gum::EliminationSequenceStrategy::_graph, gum::PartialOrderedEliminationSequenceStrategy::_nodeset, gum::PartialOrderedEliminationSequenceStrategy::_partial_order_needed, gum::SimplicialSet::allAlmostSimplicialNodes(), gum::SimplicialSet::allQuasiSimplicialNodes(), gum::SimplicialSet::allSimplicialNodes(), gum::Set< Key, Alloc >::cbegin(), gum::Set< Key, Alloc >::cend(), gum::Set< Key, Alloc >::empty(), and GUM_ERROR.
|
noexceptinherited |
returns the current partial ordering
Definition at line 39 of file partialOrderedEliminationSequenceStrategy_inl.h.
References gum::PartialOrderedEliminationSequenceStrategy::_subsets.
|
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 230 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __provide_fill_ins.
|
finalvirtual |
indicates whether the elimination sequence updates by itself the graph after a node has been eliminated
Implements gum::EliminationSequenceStrategy.
Definition at line 236 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 130 of file defaultPartialOrderedEliminationSequenceStrategy.cpp.
References __createSimplicialSet(), and gum::PartialOrderedEliminationSequenceStrategy::setGraph().
Referenced by DefaultPartialOrderedEliminationSequenceStrategy().
|
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 122 of file partialOrderedEliminationSequenceStrategy.cpp.
References gum::EliminationSequenceStrategy::_graph, gum::PartialOrderedEliminationSequenceStrategy::_isPartialOrderNeeded(), gum::PartialOrderedEliminationSequenceStrategy::_nodeset, gum::PartialOrderedEliminationSequenceStrategy::_partial_order_needed, gum::PartialOrderedEliminationSequenceStrategy::_subset_iter, gum::PartialOrderedEliminationSequenceStrategy::_subsets, gum::Set< Key, Alloc >::clear(), gum::Set< Key, Alloc >::empty(), gum::NodeGraphPart::existsNode(), and gum::Set< Key, Alloc >::insert().
Referenced by gum::PartialOrderedTriangulation::_initTriangulation(), DefaultPartialOrderedEliminationSequenceStrategy(), gum::PartialOrderedEliminationSequenceStrategy::PartialOrderedEliminationSequenceStrategy(), and gum::PartialOrderedEliminationSequenceStrategy::setGraph().
|
private |
for each node, the weight of the clique created by the node's elimination
Definition at line 229 of file defaultPartialOrderedEliminationSequenceStrategy.h.
Referenced by __createSimplicialSet(), clear(), DefaultPartialOrderedEliminationSequenceStrategy(), and nextNodeToEliminate().
|
private |
indicates whether we compute new fill-ins
Definition at line 241 of file defaultPartialOrderedEliminationSequenceStrategy.h.
Referenced by __createSimplicialSet(), askFillIns(), fillIns(), and providesFillIns().
|
private |
the ratio used by __simplicial_set for its quasi-simplicial nodes
Definition at line 235 of file defaultPartialOrderedEliminationSequenceStrategy.h.
Referenced by __createSimplicialSet(), and newFactory().
|
private |
the simplicial set used for determining the best nodes to eliminate
Definition at line 232 of file defaultPartialOrderedEliminationSequenceStrategy.h.
Referenced by __createSimplicialSet(), askFillIns(), clear(), DefaultPartialOrderedEliminationSequenceStrategy(), eliminationUpdate(), fillIns(), nextNodeToEliminate(), and ~DefaultPartialOrderedEliminationSequenceStrategy().
|
private |
the threshold used by __simplicial_set to determine small cliques
Definition at line 238 of file defaultPartialOrderedEliminationSequenceStrategy.h.
Referenced by __createSimplicialSet(), and newFactory().
|
protectedinherited |
the domain sizes of the variables/nodes
Definition at line 159 of file eliminationSequenceStrategy.h.
Referenced by gum::EliminationSequenceStrategy::clear(), gum::EliminationSequenceStrategy::domainSizes(), and gum::EliminationSequenceStrategy::setGraph().
|
protectedinherited |
the graph to be triangulated
Definition at line 156 of file eliminationSequenceStrategy.h.
Referenced by gum::DefaultEliminationSequenceStrategy::__createSimplicialSet(), __createSimplicialSet(), gum::OrderedEliminationSequenceStrategy::__isOrderNeeded(), gum::PartialOrderedEliminationSequenceStrategy::_isPartialOrderNeeded(), gum::EliminationSequenceStrategy::clear(), gum::OrderedEliminationSequenceStrategy::eliminationUpdate(), eliminationUpdate(), gum::EliminationSequenceStrategy::graph(), gum::DefaultEliminationSequenceStrategy::nextNodeToEliminate(), nextNodeToEliminate(), gum::EliminationSequenceStrategy::setGraph(), gum::OrderedEliminationSequenceStrategy::setOrder(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
|
protectedinherited |
the log of the domain sizes of the variables/nodes
Definition at line 162 of file eliminationSequenceStrategy.h.
Referenced by gum::DefaultEliminationSequenceStrategy::__createSimplicialSet(), __createSimplicialSet(), gum::EliminationSequenceStrategy::clear(), and gum::EliminationSequenceStrategy::setGraph().
|
protectedinherited |
the nodes which can be currently eliminated
Definition at line 135 of file partialOrderedEliminationSequenceStrategy.h.
Referenced by __nodeToEliminate(), gum::PartialOrderedEliminationSequenceStrategy::clear(), eliminationUpdate(), nextNodeToEliminate(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
|
protectedinherited |
indicate whether a new partial ordering is necessary for the elimination
Definition at line 138 of file partialOrderedEliminationSequenceStrategy.h.
Referenced by gum::PartialOrderedEliminationSequenceStrategy::clear(), eliminationUpdate(), gum::PartialOrderedEliminationSequenceStrategy::isPartialOrderNeeded(), nextNodeToEliminate(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
|
protectedinherited |
the iterator indicating which is the current subset on which we work
Definition at line 132 of file partialOrderedEliminationSequenceStrategy.h.
Referenced by eliminationUpdate(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
|
protectedinherited |
the subsets constituting the partial ordering
Definition at line 129 of file partialOrderedEliminationSequenceStrategy.h.
Referenced by gum::PartialOrderedEliminationSequenceStrategy::clear(), eliminationUpdate(), gum::PartialOrderedEliminationSequenceStrategy::partialOrder(), gum::PartialOrderedEliminationSequenceStrategy::setGraph(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().