aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
defaultEliminationSequenceStrategy.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
61
62#ifndef GUM_DEFAULT_ELIMINATION_SEQUENCE_STRATEGY_H
63#define GUM_DEFAULT_ELIMINATION_SEQUENCE_STRATEGY_H
64
65
66#include <agrum/agrum.h>
67
70
71namespace gum {
72
73
95 public:
96 // ############################################################################
98 // ############################################################################
100
102
107 double theThreshold = GUM_WEIGHT_THRESHOLD);
108
110
124 const NodeProperty< Size >* dom_sizes,
125 double ratio = GUM_QUASI_RATIO,
126 double threshold = GUM_WEIGHT_THRESHOLD);
127
129
139
142
145
150 virtual DefaultEliminationSequenceStrategy* newFactory() const final;
151
153
162 virtual DefaultEliminationSequenceStrategy* copyFactory() const final;
163
165
166
167 // ############################################################################
169 // ############################################################################
171
173
184 virtual bool setGraph(UndiGraph* graph, const NodeProperty< Size >* dom_sizes) final;
185
188 virtual void clear() final;
189
191
193 virtual NodeId nextNodeToEliminate() final;
194
201 virtual void askFillIns(bool do_it) final;
202
210 virtual bool providesFillIns() const final;
211
222 virtual bool providesGraphUpdate() const final;
223
225
227 virtual void eliminationUpdate(const NodeId node) final;
228
231 virtual const EdgeSet& fillIns() final;
232
234
235 private:
239
242
245
248
251
252
255 };
256
257
258} /* namespace gum */
259
260
261#endif /* GUM_DEFAULT_ELIMINATION_SEQUENCE_STRATEGY_H */
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 NodeId nextNodeToEliminate() final
returns the new node to be eliminated within the triangulation algorithm
void _createSimplicialSet_()
create a new simplicial set suited for the current graph
double _simplicial_threshold_
the threshold used by simplicial_set to determine small cliques
NodeProperty< double > _log_weights_
for each node, the weight of the clique created by the node's elimination
virtual const EdgeSet & fillIns() final
in case fill-ins are provided, this function returns the fill-ins due to all the nodes eliminated so ...
double _simplicial_ratio_
the ratio used by simplicial_set for its quasi-simplicial nodes
virtual bool providesGraphUpdate() const final
indicates whether the elimination sequence updates by itself the graph after a node has been eliminat...
virtual void clear() final
clears the sequence (to prepare, for instance, a new elimination sequence)
virtual void eliminationUpdate(const NodeId node) final
performs all the graph/fill-ins updates provided (if any)
DefaultEliminationSequenceStrategy(double theRatio=GUM_QUASI_RATIO, double theThreshold=GUM_WEIGHT_THRESHOLD)
default constructor (uses an empty graph)
SimplicialSet * _simplicial_set_
the simplicial set used for determining the best nodes to eliminate
virtual bool providesFillIns() const final
indicates whether the fill-ins generated by the eliminated nodes, if needed, will be computed by the ...
bool _provide_fill_ins_
indicates whether we compute new fill-ins
virtual bool setGraph(UndiGraph *graph, const NodeProperty< Size > *dom_sizes) final
sets a new graph to be triangulated
virtual DefaultEliminationSequenceStrategy * newFactory() const final
creates a new elimination sequence of the same type as the current object, but this sequence contains...
virtual DefaultEliminationSequenceStrategy * copyFactory() const final
virtual copy constructor
UndiGraph * graph() const noexcept
returns the current 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
Class for fast retrieval of simplicial and quasi/almost simplicial nodes.
#define GUM_QUASI_RATIO
#define GUM_WEIGHT_THRESHOLD
Base Class for all elimination sequence algorithms that require only the graph to be triangulated and...