aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
binaryJoinTreeConverter.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 The base interface for converting a join tree into a binary join tree
24  *
25  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
26  */
27 #ifndef GUM_BINARY_JOIN_TREE_CONVERTER_H
28 #define GUM_BINARY_JOIN_TREE_CONVERTER_H
29 
30 #include <agrum/tools/core/set.h>
31 #include <agrum/tools/graphs/cliqueGraph.h>
32 #include <agrum/tools/graphs/graphElements.h>
33 
34 namespace gum {
35 
37  public:
38  // ############################################################################
39  /// @name Constructors / Destructors
40  // ############################################################################
41  /// @{
42 
43  /// default constructor
45 
46  /// destructor
47  virtual ~BinaryJoinTreeConverter();
48 
49  /// @}
50 
51  // ############################################################################
52  /// @name Accessors/Modifiers
53  // ############################################################################
54  /// @{
55 
56  /// returns a binary join tree corresponding to clique graph JT
57  /** This method creates and returns a new binary join tree compatible with
58  * that passed in argument (JT) and optimized for inference. As such, this
59  * requires knowing the join tree to be converted (of course), but also
60  * which roots will be used by the collect/diffusion inference engine and
61  * the domain size of the variables contained in the cliques of JT (to
62  * optimize the combination of the potentials contained in the cliques.
63  * @throws InvalidNode exception is thrown if some roots do not belong to
64  * JT or if several roots belong to the same connected component.
65  * @warning If you do not pass in argument a root for each connected
66  * component,
67  * then for those with unspecified roots, an arbitrary root will be computed
68  * and used for the binarization. */
69  virtual CliqueGraph convert(const CliqueGraph& JT,
70  const NodeProperty< Size >& domain_sizes,
71  const NodeSet& roots)
72  = 0;
73 
74  /// returns all the roots considered for all the connected components
75  virtual const NodeSet& roots() const = 0;
76 
77  /// @}
78 
79  private:
80  /// forbid copy constructor
82 
83  /// forbid copy operator
85  };
86 
87 } /* namespace gum */
88 
89 #endif /* GUM_BINARY_JOIN_TREE_CONVERTER_H */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
BinaryJoinTreeConverter(const BinaryJoinTreeConverter &)
forbid copy constructor
BinaryJoinTreeConverter()
default constructor
virtual ~BinaryJoinTreeConverter()
destructor
BinaryJoinTreeConverter & operator=(const BinaryJoinTreeConverter &)
forbid copy operator
virtual const NodeSet & roots() const =0
returns all the roots considered for all the connected components
virtual CliqueGraph convert(const CliqueGraph &JT, const NodeProperty< Size > &domain_sizes, const NodeSet &roots)=0
returns a binary join tree corresponding to clique graph JT