aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
defaultPartialOrderedEliminationSequenceStrategy.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
64
65#ifndef GUM_DEFAULT_PARTIAL_ORDERED_ELIMINATION_SEQUENCE_STRATEGY_H
66#define GUM_DEFAULT_PARTIAL_ORDERED_ELIMINATION_SEQUENCE_STRATEGY_H
67
70
71namespace gum {
72
101 public:
102 // ############################################################################
104 // ############################################################################
106
108
113 double theThreshold = GUM_WEIGHT_THRESHOLD);
114
116
132 const NodeProperty< Size >* dom_sizes,
133 const List< NodeSet >* subsets,
134 double ratio = GUM_QUASI_RATIO,
135 double threshold = GUM_WEIGHT_THRESHOLD);
136
138
149
153
156
162
164
174
176
177
178 // ############################################################################
180 // ############################################################################
182
184
195 virtual bool setGraph(UndiGraph* graph, const NodeProperty< Size >* dom_sizes) final;
196
199 virtual void clear() final;
200
202
204 virtual NodeId nextNodeToEliminate() final;
205
212 virtual void askFillIns(bool do_it) final;
213
221 virtual bool providesFillIns() const final;
222
225 virtual bool providesGraphUpdate() const final;
226
228
230 virtual void eliminationUpdate(const NodeId node) final;
231
234 virtual const EdgeSet& fillIns() final;
235
237
238 private:
242
245
248
251
254
255
257
259
262 };
263
264} /* namespace gum */
265
266#endif /* GUM_DEFAULT_PARTIAL_ORDERED_ELIMINATION_SEQUENCE_STRATEGY_H */
virtual NodeId nextNodeToEliminate() final
returns the new node to be eliminated within the triangulation algorithm
virtual void eliminationUpdate(const NodeId node) final
performs all the graph/fill-ins updates provided (if any)
virtual DefaultPartialOrderedEliminationSequenceStrategy * newFactory() const final
creates a new elimination sequence of the same type as the current object, but this sequence contains...
double _simplicial_threshold_
the threshold used by simplicial_set to determine small cliques
void _createSimplicialSet_()
create a new simplicial set suited for the current graph
virtual bool setGraph(UndiGraph *graph, const NodeProperty< Size > *dom_sizes) final
sets a new graph to be triangulated
virtual void clear() final
clears the sequence (to prepare, for instance, a new elimination sequence)
virtual const EdgeSet & fillIns() final
in case fill-ins are provided, this function returns the fill-ins due to all the nodes eliminated so ...
virtual bool providesFillIns() const final
indicates whether the fill-ins generated by the eliminated nodes, if needed, will be computed by the ...
double _simplicial_ratio_
the ratio used by simplicial_set for its quasi-simplicial nodes
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 ...
virtual bool providesGraphUpdate() const final
indicates whether the elimination sequence updates by itself the graph after a node has been eliminat...
NodeId _nodeToEliminate_(const PriorityQueue< NodeId, double > &possibleNodes)
returns the best possible node to be eliminated
NodeProperty< double > _log_weights_
for each node, the weight of the clique created by the node's elimination
DefaultPartialOrderedEliminationSequenceStrategy(double theRatio=GUM_QUASI_RATIO, double theThreshold=GUM_WEIGHT_THRESHOLD)
default constructor (uses an empty graph)
virtual DefaultPartialOrderedEliminationSequenceStrategy * copyFactory() const final
virtual copy constructor
SimplicialSet * _simplicial_set_
the simplicial set used for determining the best nodes to eliminate
UndiGraph * graph() const noexcept
returns the current graph
Generic doubly linked lists.
Definition list.h:379
PartialOrderedEliminationSequenceStrategy()
default constructor (uses an empty graph)
Class enabling fast retrieval of simplicial, quasi and almost simplicial nodes.
Base class for undirected graphs.
Definition undiGraph.h:128
Set< Edge > EdgeSet
Some typdefs and define for shortcuts ...
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Base class for all elimination sequence algorithm that impose a given partial ordering on the nodes e...
Class for fast retrieval of simplicial and quasi/almost simplicial nodes.
#define GUM_QUASI_RATIO
#define GUM_WEIGHT_THRESHOLD