aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
treeOperator.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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
53  class TreeOperator {
54  public:
55  // ============================================================================
56  /// @name Constructors / Destructors
57  // ============================================================================
58  /// @{
59 
60  /**
61  * @brief Default constructor.
62  */
64  const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt1,
65  const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt2);
66 
67  /**
68  * @brief Default constructor.
69  */
71  const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt1,
72  const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* dt2,
73  const HashTable< const DiscreteVariable*, Idx > givenContext);
74 
75  /**
76  * @brief Default destructor.
77  */
78  ~TreeOperator();
79 
80  /// @}
81  // ============================================================================
82  /// @name Main Method
83  // ============================================================================
84  /// @{
85 
86  /// Computes and builds the Function Graph that is the result of the
87  /// operation
89 
90  /// @}
91 
92  private:
93  /// The main recursion function
95 
96  /// The main recursion function
98 
100 
101  /// The two function graphs used for the operation
104 
105  /// The resulting function graph
107 
108  /// The function to be performed on the leaves
109  const COMBINEOPERATOR< GUM_SCALAR > combine__;
110 
113  };
114 
115 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
116  extern template class TreeOperator< double, std::plus >;
117 #endif
118 
119 } // namespace gum
120 
121 #include <agrum/tools/multidim/utils/FunctionGraphUtilities/operators/treeOperator_tpl.h>
122 
123 #endif // GUM_OPERATOR_H
HashTable< const DiscreteVariable *, Idx > context__
Definition: treeOperator.h:111
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * rd__
The resulting function graph.
Definition: treeOperator.h:106
Class used to perform Decision Tree Operation in the FMDP Framework.
Definition: treeOperator.h:53
TreeOperator(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt1, const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt2, const HashTable< const DiscreteVariable *, Idx > givenContext)
Default constructor.
NodeId checkRedundancy__(const DiscreteVariable *, NodeId *)
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * compute()
Computes and builds the Function Graph that is the result of the operation.
const COMBINEOPERATOR< GUM_SCALAR > combine__
The function to be performed on the leaves.
Definition: treeOperator.h:109
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * dt2__
Definition: treeOperator.h:103
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * dt1__
The two function graphs used for the operation.
Definition: treeOperator.h:102
NodeId xPloreDT2__(NodeId currentNodeId)
The main recursion function.
~TreeOperator()
Default destructor.
TreeOperator(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt1, const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dt2)
Default constructor.
NodeId xPloreDT1__(NodeId currentNodeId)
The main recursion function.