aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
ILearningStrategy.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 Learning 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_LEARNING_STRATEGY_H
33 #define GUM_SDYNA_LEARNING_STRATEGY_H
34 // =========================================================================
35 #include <string>
36 // =========================================================================
37 #include <agrum/tools/core/types.h>
38 // =========================================================================
39 #include <agrum/FMDP/fmdp.h>
40 #include <agrum/FMDP/learning/datastructure/IVisitableGraphLearner.h>
41 #include <agrum/FMDP/learning/observation.h>
42 // =========================================================================
43 #include <agrum/tools/variables/discreteVariable.h>
44 // =========================================================================
45 
46 namespace gum {
47 
48  /**
49  * @class ILearningStrategy ILearningStrategy.h
50  * <agrum/FMDP/SDyna/ILearningStrategy.h>
51  * @brief Interface for manipulating FMDP learner
52  * @ingroup fmdp_group
53  *
54  */
56  // ###################################################################
57  /// @name Constructor & destructor.
58  // ###################################################################
59  /// @{
60  public:
61  // ==========================================================================
62  /// Destructor (virtual and empty since it's an interface)
63  // ==========================================================================
64  virtual ~ILearningStrategy() {}
65 
66  /// @}
67 
68  // ###################################################################
69  /// @name Initialization
70  // ###################################################################
71  /// @{
72  public:
73  // ==========================================================================
74  /// Initializes the learner
75  // ==========================================================================
76  virtual void initialize(FMDP< double >* fmdp) = 0;
77 
78  /// @}
79 
80 
81  // ###################################################################
82  /// @name Incremental methods
83  // ###################################################################
84  /// @{
85  public:
86  // ==========================================================================
87  /**
88  * Gives to the learner a new transition
89  * @param actionId : the action on which the transition was made
90  * @param obs : the observed transition
91  * @return true if learning this transition implies structural changes
92  * (can trigger a new planning)
93  */
94  // ==========================================================================
95  virtual bool addObservation(Idx actionId, const Observation* obs) = 0;
96 
97 
98  // ==========================================================================
99  /**
100  * Starts an update of datastructure in the associated FMDP
101  */
102  // ==========================================================================
103  virtual void updateFMDP() = 0;
104 
105  /// @}
106 
107 
108  // ###################################################################
109  /// @name Miscelleanous methods
110  // ###################################################################
111  /// @{
112  public:
113  // ==========================================================================
114  /**
115  * @brief learnerSize
116  * @return
117  */
118  // ==========================================================================
119  virtual Size size() = 0;
120 
121  // ==========================================================================
122  /**
123  * @brief Required for RMax
124  * @return
125  */
126  // ==========================================================================
128  const DiscreteVariable* var) const = 0;
129 
130  virtual double rMax() const = 0;
131  virtual double modaMax() const = 0;
132 
133  /// @}
134  };
135 } // namespace gum
136 #endif // GUM_SDYNA_LEARNING_STRATEGY_H
virtual const IVisitableGraphLearner * varLearner(Idx actionId, const DiscreteVariable *var) const =0
Required for RMax.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
virtual ~ILearningStrategy()
Destructor (virtual and empty since it&#39;s an interface)
virtual void updateFMDP()=0
Starts an update of datastructure in the associated FMDP.
virtual void initialize(FMDP< double > *fmdp)=0
Initializes the learner.
<agrum/FMDP/SDyna/ILearningStrategy.h>
virtual bool addObservation(Idx actionId, const Observation *obs)=0
Gives to the learner a new transition.
virtual double modaMax() const =0
learnerSize
virtual double rMax() const =0
learnerSize
virtual Size size()=0
learnerSize