aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
orderedTriangulation.cpp
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
48
49#include <agrum/agrum.h>
50
52
53namespace gum {
54
57 const JunctionTreeStrategy& JTStrategy,
58 bool minimality) :
59 StaticTriangulation(elimSeq, JTStrategy, minimality) {
60 // for debugging purposes
61 GUM_CONSTRUCTOR(OrderedTriangulation);
62 }
63
66 const NodeProperty< Size >* dom,
67 const std::vector< NodeId >* order,
69 const JunctionTreeStrategy& JTStrategy,
70 bool minimality) :
71 StaticTriangulation(theGraph, dom, elimSeq, JTStrategy, minimality), _order_(order) {
74
75 // for debugging purposes
76 GUM_CONSTRUCTOR(OrderedTriangulation);
77 }
78
79 // copy constructor
81 StaticTriangulation(from), _order_(from._order_) { // for debugging purposes
82 GUM_CONS_CPY(OrderedTriangulation);
83 }
84
85 // move constructor
87 StaticTriangulation(std::move(from)), _order_(from._order_) {
88 // for debugging purposes
89 GUM_CONS_MOV(OrderedTriangulation);
90 }
91
98
103
106 // for debugging purposes
107 GUM_DESTRUCTOR(OrderedTriangulation);
108 }
109
117
119 void OrderedTriangulation::setOrder(const std::vector< NodeId >* order) {
120 _order_ = order;
122 ->setOrder(_order_);
123 }
124
132
133} /* namespace gum */
Base Class for all the algorithms producing a junction given a set of cliques/subcliques resulting fr...
An Elimination sequence algorithm that imposes a given complete ordering on the nodes elimination seq...
virtual bool setGraph(UndiGraph *graph, const NodeProperty< Size > *dom_sizes) final
sets a new graph to be triangulated
virtual bool setOrder(const std::vector< NodeId > *order) final
sets the sequence of elimination
virtual void setOrder(const std::vector< NodeId > *order) final
sets the sequence of elimination (only the reference is stored)
const std::vector< NodeId > * _order_
the elimination sequence to apply
virtual ~OrderedTriangulation()
destructor
virtual void initTriangulation_(UndiGraph &graph) final
the function called to initialize the triangulation process
OrderedTriangulation(const OrderedEliminationSequenceStrategy &elimSeq=OrderedEliminationSequenceStrategy(), const JunctionTreeStrategy &JTStrategy=DefaultJunctionTreeStrategy(), bool minimality=false)
default constructor
virtual OrderedTriangulation * newFactory() const final
returns a fresh triangulation over the same graph and of the same type as the current object (using t...
virtual void setGraph(const UndiGraph *graph, const NodeProperty< Size > *domsizes) final
initialize the triangulation data structures for a new graph
virtual OrderedTriangulation * copyFactory() const final
virtual copy constructor
JunctionTreeStrategy * junction_tree_strategy_
the junction tree strategy used by the triangulation
StaticTriangulation(const EliminationSequenceStrategy &elimSeq, const JunctionTreeStrategy &JTStrategy, bool minimality=false)
default constructor: without any graph
EliminationSequenceStrategy * elimination_sequence_strategy_
the elimination sequence strategy used by the triangulation
virtual void setGraph(const UndiGraph *graph, const NodeProperty< Size > *domsizes)
initialize the triangulation data structures for a new graph
const NodeProperty< Size > * domain_sizes_
the domain sizes of the variables/nodes of the graph
Base class for undirected graphs.
Definition undiGraph.h:128
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
STL namespace.
class for graph triangulations for which we enforce a given complete ordering on the nodes eliminatio...