aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
junctionTreeStrategy.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /** @file
23  * @brief Base Class for all the algorithms producing a junction given a set
24  * of cliques/subcliques resulting from a triangulation
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_JUNCTION_TREE_STRATEGY_H
30 #define GUM_JUNCTION_TREE_STRATEGY_H
31 
32 #include <agrum/agrum.h>
33 
34 #include <agrum/tools/graphs/cliqueGraph.h>
35 #include <agrum/tools/graphs/graphElements.h>
36 
37 namespace gum {
38 
39  class StaticTriangulation;
40 
41  /** @class JunctionTreeStrategy
42  * @brief Base Class for all the algorithms producing a junction given a set
43  * of cliques/subcliques resulting from a triangulation.
44  *
45  * \ingroup graph_group
46  */
48  public:
49  // ############################################################################
50  /// @name Constructors / Destructors
51  // ############################################################################
52  /// @{
53 
54  /// destructor
55  virtual ~JunctionTreeStrategy();
56 
57  /// create a clone not assigned to any triangulation algorithm
58  virtual JunctionTreeStrategy* newFactory() const = 0;
59 
60  /// virtual copy constructor
61  /** @param triangulation if triangulation is different from nullptr, this
62  * becomes the new triangulation algorithm associated with the junction tree
63  * strategy */
65  = nullptr) const = 0;
66 
67  /// @}
68 
69 
70  // ############################################################################
71  /// @name Accessors / Modifiers
72  // ############################################################################
73  /// @{
74 
75  /** @brief indicates whether the junction tree strategy needs fill-ins
76  * to work properly
77  *
78  * If the junctionTreeStrategy needs fill-ins to work properly, its
79  * assigned triangulation instance (see method setTriangulation) will be
80  * commited to compute them. */
81  virtual bool requiresFillIns() const = 0;
82 
83  /// returns the junction tree computed
84  /** The idea behind this method is that the JunctionTreeStrategy asks its
85  * assigned triangulation (see method setTriangulation) all the data it
86  * needs to compute correctly the junction tree. For instance, it may asks
87  * for a triangulated graph or an elimination tree, or even the order of
88  * elimination of the nodes, etc. All these data are available from the
89  * triangulation class. Knowing these data, the junctionTreeStrategy
90  * computes and returns a junction tree corresponding to the
91  * triangulated graph. */
92  virtual const CliqueGraph& junctionTree() = 0;
93 
94  /// assigns the triangulation to the junction tree strategy
95  virtual void setTriangulation(StaticTriangulation* triangulation) = 0;
96 
97  /** @brief assigns a new triangulation to the junction tree strategy
98  * during a move construction */
99  virtual void moveTriangulation(StaticTriangulation* triangulation);
100 
101  /** @brief returns, for each node, the clique of the junction tree which was
102  * created by its deletion */
103  virtual const NodeProperty< NodeId >& createdCliques() = 0;
104 
105  /** @brief returns the Id of the clique of the junction tree created by the
106  * elimination of a given node during the triangulation process */
107  virtual NodeId createdClique(const NodeId id) = 0;
108 
109  /// resets the current junction tree strategy data structures
110  virtual void clear() = 0;
111 
112  /// @}
113 
114 
115  protected:
116  /// the triangulation to which the junction tree is associated
118 
119 
120  // ############################################################################
121  /// @name Constructors / Destructors
122  // ############################################################################
123  /// @{
124 
125  /// default constructor
127 
128  /// copy constructor
130 
131  /// move constructor
133 
134  /// @}
135  };
136 
137 } /* namespace gum */
138 
139 #endif /* GUM_JUNCTION_TREE_STRATEGY_H */
virtual const NodeProperty< NodeId > & createdCliques()=0
returns, for each node, the clique of the junction tree which was created by its deletion ...
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
StaticTriangulation * triangulation_
the triangulation to which the junction tree is associated
virtual bool requiresFillIns() const =0
indicates whether the junction tree strategy needs fill-ins to work properly
virtual void clear()=0
resets the current junction tree strategy data structures
virtual JunctionTreeStrategy * copyFactory(StaticTriangulation *triangulation=nullptr) const =0
virtual copy constructor
virtual void setTriangulation(StaticTriangulation *triangulation)=0
assigns the triangulation to the junction tree strategy
Base Class for all the algorithms producing a junction given a set of cliques/subcliques resulting fr...
JunctionTreeStrategy(const JunctionTreeStrategy &from)
copy constructor
JunctionTreeStrategy()
default constructor
base class for all non-incremental triangulation methods
virtual ~JunctionTreeStrategy()
destructor
JunctionTreeStrategy(JunctionTreeStrategy &&from)
move constructor
virtual NodeId createdClique(const NodeId id)=0
returns the Id of the clique of the junction tree created by the elimination of a given node during t...
virtual const CliqueGraph & junctionTree()=0
returns the junction tree computed
virtual JunctionTreeStrategy * newFactory() const =0
create a clone not assigned to any triangulation algorithm
virtual void moveTriangulation(StaticTriangulation *triangulation)
assigns a new triangulation to the junction tree strategy during a move construction ...