aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
treeOperator.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 /**
23  * @file
24  * @brief Class used to compute the operation between two decision diagrams
25  *
26  * @author Pierre-Henri WUILLEMIN(@LIP6) and Jean-Christophe MAGNAN and Christophe
27  * GONZALES(@AMU)
28  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
29  */
30 
31 #ifndef GUM_TREE_OPERATOR_H
32 #define GUM_TREE_OPERATOR_H
33 
34 #include <functional>
35 
36 #include <agrum/tools/multidim/implementations/multiDimFunctionGraph.h>
37 #include <agrum/tools/multidim/utils/FunctionGraphUtilities/terminalNodePolicies/ExactTerminalNodePolicy.h>
38 
39 namespace gum {
40 
41  /**
42  * @class TreeOperator
43  * @headerfile treeOperator.h <agrum/tools/multidim/patterns/treeOperator.h>
44  * @ingroup multidim_group
45  *
46  * @brief Class used to perform Decision Tree Operation in the FMDP Framework
47  */
48  template < typename GUM_SCALAR,
49  template < typename >
50  class COMBINEOPERATOR,
51  template < typename > class TerminalNodePolicy = ExactTerminalNodePolicy >
52  class TreeOperator {
53  public:
54  // ============================================================================
55  /// @name Constructors / Destructors
56  // ============================================================================
57  /// @{
58 
59  /**
60  * @brief Default constructor.
61  */
62  TreeOperator(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt1,
63  const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt2);
64 
65  /**
66  * @brief Default constructor.
67  */
68  TreeOperator(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt1,
69  const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt2,
70  const HashTable< const DiscreteVariable*, Idx > givenContext);
71 
72  /**
73  * @brief Default destructor.
74  */
75  ~TreeOperator();
76 
77  /// @}
78  // ============================================================================
79  /// @name Main Method
80  // ============================================================================
81  /// @{
82 
83  /// Computes and builds the Function Graph that is the result of the
84  /// operation
86 
87  /// @}
88 
89  private:
90  /// The main recursion function
92 
93  /// The main recursion function
95 
97 
98  /// The two function graphs used for the operation
101 
102  /// The resulting function graph
104 
105  /// The function to be performed on the leaves
106  const COMBINEOPERATOR< GUM_SCALAR > _combine_;
107 
110  };
111 
112 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
113  extern template class TreeOperator< double, std::plus >;
114 #endif
115 
116 } // namespace gum
117 
118 #include <agrum/tools/multidim/utils/FunctionGraphUtilities/operators/treeOperator_tpl.h>
119 
120 #endif // GUM_OPERATOR_H
NodeId _xPloreDT2_(NodeId currentNodeId)
The main recursion function.
NodeId _xPloreDT1_(NodeId currentNodeId)
The main recursion function.
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * _dt2_
Definition: treeOperator.h:100
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * _rd_
The resulting function graph.
Definition: treeOperator.h:103
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
const COMBINEOPERATOR< GUM_SCALAR > _combine_
The function to be performed on the leaves.
Definition: treeOperator.h:106
Class used to perform Decision Tree Operation in the FMDP Framework.
Definition: treeOperator.h:52
TreeOperator(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt1, const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt2, const HashTable< const DiscreteVariable *, Idx > givenContext)
Default constructor.
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * compute()
Computes and builds the Function Graph that is the result of the operation.
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * _dt1_
The two function graphs used for the operation.
Definition: treeOperator.h:99
~TreeOperator()
Default destructor.
NodeId _checkRedundancy_(const DiscreteVariable *, NodeId *)
TreeOperator(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt1, const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt2)
Default constructor.
HashTable< const DiscreteVariable *, Idx > _context_
Definition: treeOperator.h:108