aGrUM  0.16.0
adaptiveRMaxPlaner.h
Go to the documentation of this file.
1 
30 // =========================================================================
31 #ifndef GUM_ADAPTIVE_RMAX_PLANER_H
32 #define GUM_ADAPTIVE_RMAX_PLANER_H
33 // =========================================================================
35 #include <agrum/FMDP/fmdp.h>
39 // =========================================================================
40 
41 namespace gum {
42 
54  : public StructuredPlaner< double >
55  , public IDecisionStrategy {
56  // ###################################################################
58  // ###################################################################
60  public:
61  // ==========================================================================
63  // ==========================================================================
64  static AdaptiveRMaxPlaner*
66  double discountFactor = 0.9,
67  double epsilon = 0.00001,
68  bool verbose = true) {
70  discountFactor,
71  epsilon,
72  learner,
73  verbose);
74  }
75 
76  // ==========================================================================
78  // ==========================================================================
80  double discountFactor = 0.9,
81  double epsilon = 0.00001,
82  bool verbose = true) {
84  discountFactor,
85  epsilon,
86  learner,
87  verbose);
88  }
89 
91 
92  // ###################################################################
94  // ###################################################################
96  private:
97  // ==========================================================================
99  // ==========================================================================
101  double discountFactor,
102  double epsilon,
103  const ILearningStrategy* learner,
104  bool verbose);
105 
106  // ==========================================================================
108  // ==========================================================================
109  public:
111 
113 
114 
115  // ###################################################################
117  // ###################################################################
119 
120  public:
121  // ==========================================================================
127  // ==========================================================================
128  void initialize(const FMDP< double >* fmdp);
129 
130 
131  // ==========================================================================
140  // ==========================================================================
141  void makePlanning(Idx nbStep = 1000000);
142 
144 
145 
146  // ###################################################################
148  // ###################################################################
150 
151  protected:
152  // ==========================================================================
154  // ==========================================================================
155  virtual void _initVFunction();
156 
157  // ==========================================================================
159  // ==========================================================================
161 
163 
164 
165  // ###################################################################
167  // ###################################################################
169 
170  protected:
171  // ==========================================================================
173  // ==========================================================================
174  virtual void _evalPolicy();
175 
177 
178  private:
180 
181  std::pair< NodeId, NodeId > __visitLearner(const IVisitableGraphLearner*,
182  NodeId currentNodeId,
185  void __clearTables();
186 
187  private:
191 
192  double __rThreshold;
193  double __rmax;
194 
195 
196  // ###################################################################
198  // ###################################################################
200  public:
201  void checkState(const Instantiation& newState, Idx actionId) {
202  if (!__initializedTable[actionId]) {
203  __counterTable[actionId]->reset(newState);
204  __initializedTable[actionId] = true;
205  } else
206  __counterTable[actionId]->incState(newState);
207  }
208 
209  private:
212 
215  };
216 
217 } /* namespace gum */
218 
219 #endif // GUM_ADAPTIVE_RMAX_PLANER_H
void makePlanning(Idx nbStep=1000000)
Performs a value iteration.
HashTable< Idx, StatesCounter *> __counterTable
HashTable< Idx, MultiDimFunctionGraph< double > *> __actionsBoolTable
<agrum/FMDP/planning/structuredPlaner.h>
~AdaptiveRMaxPlaner()
Default destructor.
virtual MultiDimFunctionGraph< double > * _valueIteration()
Performs a single step of value iteration.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
<agrum/FMDP/SDyna/IDecisionStrategy.h>
static AdaptiveRMaxPlaner * ReducedAndOrderedInstance(const ILearningStrategy *learner, double discountFactor=0.9, double epsilon=0.00001, bool verbose=true)
std::pair< NodeId, NodeId > __visitLearner(const IVisitableGraphLearner *, NodeId currentNodeId, MultiDimFunctionGraph< double > *, MultiDimFunctionGraph< double > *)
<agrum/FMDP/SDyna/IVisitableGraphLearner.h>
const ILearningStrategy * __fmdpLearner
AdaptiveRMaxPlaner(IOperatorStrategy< double > *opi, double discountFactor, double epsilon, const ILearningStrategy *learner, bool verbose)
Default constructor.
<agrum/FMDP/planning/mddOperatorStrategy.h>
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
HashTable< Idx, bool > __initializedTable
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
<agrum/FMDP/SDyna/ILearningStrategy.h>
<agrum/FMDP/planning/treeOperatorStrategy.h>
HashTable< Idx, MultiDimFunctionGraph< double > *> __actionsRMaxTable
static AdaptiveRMaxPlaner * TreeInstance(const ILearningStrategy *learner, double discountFactor=0.9, double epsilon=0.00001, bool verbose=true)
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
<agrum/FMDP/planning/adaptiveRMaxPlaner.h>
void initialize(const FMDP< double > *fmdp)
Initializes data structure needed for making the planning.
INLINE const FMDP< double > * fmdp()
Returns a const ptr on the Factored Markov Decision Process on which we&#39;re planning.
virtual void _initVFunction()
Performs a single step of value iteration.
Size Idx
Type for indexes.
Definition: types.h:53
void checkState(const Instantiation &newState, Idx actionId)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size NodeId
Type for node ids.
Definition: graphElements.h:98
virtual void _evalPolicy()
Perform the required tasks to extract an optimal policy.