aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
IOperatorStrategy.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 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 
74  = 0;
76 
77  /// @}
78 
79 
80  // ###################################################################
81  /// @name Graph Function Operations Methods
82  // ###################################################################
83  /// @{
84 
85  public:
86  // ==========================================================================
87  /// Performs a multiplication/projection on given qAction
88  /// @return qAction : the computed Q(s,a)
89  /// @warning given qAction is deleted, return the new one
90  // ==========================================================================
93  Idx actionId,
94  const FMDP< GUM_SCALAR >* fmdp,
95  const Set< const DiscreteVariable* >& elVarSeq)
96  = 0;
97 
98  // ==========================================================================
99  /// @warning given vFunction and qAction are deleted, returns the new one
100  // ==========================================================================
104  Idx del = 3)
105  = 0;
106 
107  // ==========================================================================
108  /// @warning Minimze the two given functions
109  // ==========================================================================
113  Idx del = 3)
114  = 0;
115 
116  // ==========================================================================
117  /// @warning given f1 and f2 are deleted, returns the new one
118  // ==========================================================================
122  Idx del = 3)
123  = 0;
124 
125  // ==========================================================================
126  /// @warning given vFunction and qAction are deleted, returns the new one
127  // ==========================================================================
129  argmaximize(
132  Idx del = 3)
133  = 0;
134 
135  // ==========================================================================
136  /// @warning given function is deleted, returns the new one
137  // ==========================================================================
140  Idx del = 1)
141  = 0;
142 
143  // ==========================================================================
144  /// @warning this time, nothing is deleted
145  // ==========================================================================
149  Idx del = 0)
150  = 0;
151 
152 
153  /// @}
154 
155  protected:
158  Idx del) {
159  if (del == 1 || del == 3) delete f1;
160  if (del >= 2) delete f2;
161  }
162 
166  Idx del) {
167  if (del == 1 || del == 3) delete f1;
168  if (del >= 2) delete f2;
169  }
170  };
171 } // namespace gum
172 #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:643
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