aGrUM  0.14.2
multiDimFunctionGraphOperator.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ****************************************************************************/
28 #ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_OPERATOR_H
29 #define GUM_MULTI_DIM_FUNCTION_GRAPH_OPERATOR_H
30 
31 #include <functional>
32 
36 
37 namespace gum {
38 
39  // clang-format off
47  // clang-format on
48  template < typename GUM_SCALAR,
49  template < typename >
50  class FUNCTOR,
51  template < typename > class TerminalNodePolicy =
52  ExactTerminalNodePolicy >
54  public:
55  // ============================================================================
57  // ============================================================================
59 
66 
71 
73  // ============================================================================
75  // ============================================================================
77 
83 
85 
86  Idx nbCall();
87  Idx nbVarRetro();
89 
90  private:
94 
97  void __establishVarOrder();
98 
102  const DiscreteVariable*,
103  const DiscreteVariable*);
104 
109  HashTable< NodeId, short int* >& dgInstNeed);
110 
112  NodeId __compute(O4DGContext& currentSituation, Idx lastInstVarPos);
113 
116 
119 
122 
125 
127  const FUNCTOR< GUM_SCALAR > __function;
128 
132 
136 
140 
142  short int* __default;
143  };
144 
145 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
147 #endif
148 
149 } // namespace gum
150 
152 
153 #endif // GUM_MULTI_DIM_FUNCTION_GRAPH_OPERATOR_H
void __findRetrogradeVariables(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *dg, HashTable< NodeId, short int * > &dgInstNeed)
Establish for each node in both function graph if it has retrograde variables beneath it...
Headers of the ExactTerminalNodePolicy.
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * compute()
Computes and builds the Function Graph that is the result of the operation.
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * __rd
The resulting function graph.
short int * __default
Just a comptuationnal trick.
HashTable< NodeId, short int *> __DG1InstantiationNeeded
Table uses to know if a given node of first function graph has retrograde vrariables.
Idx __nbVar
The total number of variable implied in the operation.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Idx __distance(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *, const DiscreteVariable *, const DiscreteVariable *)
Heuristic methods to decide which of two retrograde variables should come first.
HashTable< double, NodeId > __explorationTable
The hashtable used to know if two pair of nodes have already been visited.
HashTable< NodeId, short int *> __DG2InstantiationNeeded
Table uses to know if a given node of second function graph has retrograde vrariables.
Class implementingting a function graph.
Headers of MultiDimFunctionGraph.
Class used to perform Function Graph Operations.
const FUNCTOR< GUM_SCALAR > __function
The function to be performed on the leaves.
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * __DG1
One of the two function graphs used for the operation.
Class used to compute the operation between two decision diagrams.
MultiDimFunctionGraphOperator(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *DG1, const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *DG2)
Default constructor.
Size Idx
Type for indexes.
Definition: types.h:50
Class used to manipulate context during Function Graph Operations.
Definition: o4DGContext.h:46
Class used to manipulate o4DGContext in Function Graph Operations.
void __establishVarOrder()
Computes an order for the final Decision graph that will minimize the number of re exploration...
Size NodeId
Type for node ids.
Definition: graphElements.h:97
NodeId __compute(O4DGContext &currentSituation, Idx lastInstVarPos)
The main recursion function.
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * __DG2
The other one.