aGrUM  0.14.2
regress.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_REGRESS_H
29 #define GUM_REGRESS_H
30 
34 
35 namespace gum {
36 
44  template < typename GUM_SCALAR,
45  template < typename >
46  class COMBINEOPERATOR,
47  template < typename >
48  class PROJECTOPERATOR,
49  template < typename > class TerminalNodePolicy =
50  ExactTerminalNodePolicy >
51  class Regress {
52  public:
53  // ============================================================================
55  // ============================================================================
57 
59  Regress(
62  const Set< const DiscreteVariable* >* primedVars,
63  const DiscreteVariable* targetVar,
64  const GUM_SCALAR neutral);
65 
67  ~Regress();
68 
70 
71  // ============================================================================
73  // ============================================================================
75 
79 
81 
82  private:
86  void __establishVarOrder();
87 
94 
96  NodeId __compute(O4DGContext& currentSituation, Idx lastInstVarPos);
97 
100 
103 
106 
109 
112 
114  const GUM_SCALAR __neutral;
115 
118 
120  const COMBINEOPERATOR< GUM_SCALAR > __combine;
121  const PROJECTOPERATOR< GUM_SCALAR > __project;
122 
126 
131 
133  short int* __default;
134  };
135 
136 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
137  extern template class Regress< double, std::multiplies, std::plus >;
138 #endif
139 
140 } // namespace gum
141 
143 
144 #endif // GUM_REGRESS_H
const PROJECTOPERATOR< GUM_SCALAR > __project
Definition: regress.h:121
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * __rd
The resulting function graph.
Definition: regress.h:105
HashTable< NodeId, short int *> __DG2InstantiationNeeded
Definition: regress.h:130
const DiscreteVariable * __targetVar
The variable we work on to eleminate.
Definition: regress.h:111
Headers of the ExactTerminalNodePolicy.
const GUM_SCALAR __neutral
The function to be performed on the leaves.
Definition: regress.h:114
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * compute()
Computes and builds the Function Graph that is the result of the operation.
Definition: regress_tpl.h:101
const COMBINEOPERATOR< GUM_SCALAR > __combine
The functions to be performed on the leaves.
Definition: regress.h:120
HashTable< NodeId, short int *> __DG1InstantiationNeeded
Table uses to know if a given node of given function graph has retrograde variables.
Definition: regress.h:129
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * __DG2
The other one.
Definition: regress.h:102
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
Regress(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *vfunction, const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *probDist, const Set< const DiscreteVariable * > *primedVars, const DiscreteVariable *targetVar, const GUM_SCALAR neutral)
Default constructor.
Definition: regress_tpl.h:45
Class used to compute the operation between two decision diagrams.
void __establishVarOrder()
Computes an order for the final Decision graph that will minimize the number of re exploration...
Definition: regress_tpl.h:139
Class implementingting a function graph.
Headers of MultiDimFunctionGraph.
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...
Definition: regress_tpl.h:227
NodeId __compute(O4DGContext &currentSituation, Idx lastInstVarPos)
The main recursion function.
Definition: regress_tpl.h:325
Idx __nbVar
The total number of variable implied in the operation.
Definition: regress.h:117
Class used to perform Function Graph Operations in the FMDP Framework.
Definition: regress.h:51
const Set< const DiscreteVariable *> * __primedVars
The set of variables we want to keep at the end.
Definition: regress.h:108
HashTable< double, NodeId > __explorationTable
The hashtable used to know if two pair of nodes have already been visited.
Definition: regress.h:125
Size Idx
Type for indexes.
Definition: types.h:50
short int * __default
Just a computationnal trick.
Definition: regress.h:133
Class used to manipulate context during Function Graph Operations.
Definition: o4DGContext.h:46
Class used to manipulate o4DGContext in Function Graph Operations.
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * __DG1
One of the two function graphs used for the operation.
Definition: regress.h:99
Size NodeId
Type for node ids.
Definition: graphElements.h:97
~Regress()
Default destructor.
Definition: regress_tpl.h:73