aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
IOperatorStrategy.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 Headers of the Operator Strategy interface.
25  *
26  * @author Pierre-Henri WUILLEMIN(@LIP6) and Jean-Christophe MAGNAN and Christophe
27  * GONZALES(@AMU)
28  */
29 
30 
31 // =========================================================================
32 #ifndef GUM_SDYNA_OPERATOR_STRATEGY_H
33 #define GUM_SDYNA_OPERATOR_STRATEGY_H
34 // =========================================================================
35 #include <agrum/tools/core/types.h>
36 // =========================================================================
37 #include <agrum/FMDP/planning/actionSet.h>
38 // =========================================================================
39 #include <agrum/tools/variables/discreteVariable.h>
40 // =========================================================================
41 
42 namespace gum {
43 
44  /**
45  * @class IOperatorStrategy IOperatorStrategy.h
46  * <agrum/FMDP/SDyna/IOperatorStrategy.h>
47  * @brief Interface for manipulating Operator center
48  * @ingroup fmdp_group
49  *
50  */
51  template < typename GUM_SCALAR >
53  // ###################################################################
54  /// @name Constructor & destructor.
55  // ###################################################################
56  /// @{
57  public:
58  // ==========================================================================
59  /// Destructor (virtual and empty since it's an interface)
60  // ==========================================================================
61  virtual ~IOperatorStrategy() {}
62 
63  /// @}
64 
65 
66  // ###################################################################
67  /// @name
68  // ###################################################################
69  /// @{
70 
73  = 0;
77  = 0;
80  = 0;
81 
82  /// @}
83 
84 
85  // ###################################################################
86  /// @name Graph Function Operations Methods
87  // ###################################################################
88  /// @{
89 
90  public:
91  // ==========================================================================
92  /// Performs a multiplication/projection on given qAction
93  /// @return qAction : the computed Q(s,a)
94  /// @warning given qAction is deleted, return the new one
95  // ==========================================================================
98  Idx actionId,
99  const FMDP< GUM_SCALAR >* fmdp,
100  const Set< const DiscreteVariable* >& elVarSeq)
101  = 0;
102 
103  // ==========================================================================
104  /// @warning given vFunction and qAction are deleted, returns the new one
105  // ==========================================================================
109  Idx del = 3)
110  = 0;
111 
112  // ==========================================================================
113  /// @warning Minimze the two given functions
114  // ==========================================================================
118  Idx del = 3)
119  = 0;
120 
121  // ==========================================================================
122  /// @warning given f1 and f2 are deleted, returns the new one
123  // ==========================================================================
127  Idx del = 3)
128  = 0;
129 
130  // ==========================================================================
131  /// @warning given vFunction and qAction are deleted, returns the new one
132  // ==========================================================================
139  Idx del = 3)
140  = 0;
141 
142  // ==========================================================================
143  /// @warning given function is deleted, returns the new one
144  // ==========================================================================
148  Idx del = 1)
149  = 0;
150 
151  // ==========================================================================
152  /// @warning this time, nothing is deleted
153  // ==========================================================================
157  Idx del = 0)
158  = 0;
159 
160 
161  /// @}
162 
163  protected:
166  Idx del) {
167  if (del == 1 || del == 3) delete f1;
168  if (del >= 2) delete f2;
169  }
170 
176  Idx del) {
177  if (del == 1 || del == 3) delete f1;
178  if (del >= 2) delete f2;
179  }
180  };
181 } // namespace gum
182 #endif // GUM_SDYNA_OPERATOR_STRATEGY_H
INLINE void deleteFunctionGraph_(const MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, Idx >, SetTerminalNodePolicy > *f1, const MultiDimFunctionGraph< ArgMaxSet< GUM_SCALAR, Idx >, SetTerminalNodePolicy > *f2, Idx del)
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
virtual MultiDimFunctionGraph< GUM_SCALAR > * maximize(const MultiDimFunctionGraph< GUM_SCALAR > *f1, const MultiDimFunctionGraph< GUM_SCALAR > *f2, Idx del=3)=0
virtual MultiDimFunctionGraph< GUM_SCALAR > * minimize(const MultiDimFunctionGraph< GUM_SCALAR > *f1, const MultiDimFunctionGraph< GUM_SCALAR > *f2, Idx del=3)=0
virtual MultiDimFunctionGraph< GUM_SCALAR > * add(const MultiDimFunctionGraph< GUM_SCALAR > *f1, const MultiDimFunctionGraph< GUM_SCALAR > *f2, Idx del=1)=0
virtual MultiDimFunctionGraph< GUM_SCALAR > * multiply(const MultiDimFunctionGraph< GUM_SCALAR > *f1, const MultiDimFunctionGraph< GUM_SCALAR > *f2, Idx del=3)=0
virtual MultiDimFunctionGraph< GUM_SCALAR > * regress(const MultiDimFunctionGraph< GUM_SCALAR > *Vold, Idx actionId, const FMDP< GUM_SCALAR > *fmdp, const Set< const DiscreteVariable * > &elVarSeq)=0
Performs a multiplication/projection on given qAction.
virtual MultiDimFunctionGraph< GUM_SCALAR > * subtract(const MultiDimFunctionGraph< GUM_SCALAR > *f1, const MultiDimFunctionGraph< GUM_SCALAR > *f2, Idx del=0)=0
virtual ~IOperatorStrategy()
Destructor (virtual and empty since it&#39;s an interface)
virtual MultiDimFunctionGraph< GUM_SCALAR, ExactTerminalNodePolicy > * getFunctionInstance()=0
virtual MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * getAggregatorInstance()=0