aGrUM  0.16.0
IDecisionStrategy.h
Go to the documentation of this file.
1 
31 // =========================================================================
32 #ifndef GUM_SDYNA_DECISION_STRATEGY_H
33 #define GUM_SDYNA_DECISION_STRATEGY_H
34 // =========================================================================
35 #include <agrum/core/types.h>
36 // =========================================================================
38 // =========================================================================
40 // =========================================================================
41 
42 namespace gum {
43 
52  // ###################################################################
54  // ###################################################################
56  public:
57  // ==========================================================================
59  // ==========================================================================
60  virtual ~IDecisionStrategy() {}
61 
63 
64  // ###################################################################
66  // ###################################################################
68  public:
69  // ==========================================================================
71  // ==========================================================================
72  virtual void initialize(const FMDP< double >* fmdp) {
73  _optPol = nullptr;
74  if (_allActions.size() == 0)
75  for (auto actionIter = fmdp->beginActions();
76  actionIter != fmdp->endActions();
77  ++actionIter)
78  _allActions += *actionIter;
79  }
81 
82 
83  // ###################################################################
85  // ###################################################################
87  public:
88  virtual void checkState(const Instantiation& newState, Idx actionId) = 0;
89 
92  _optPol =
94  optPol);
95  }
96 
97  virtual ActionSet stateOptimalPolicy(const Instantiation& curState) {
98  return (_optPol && _optPol->realSize() != 0) ? _optPol->get(curState)
99  : _allActions;
100  }
101 
102  protected:
105 
108 
110  };
111 } // namespace gum
112 #endif // GUM_SDYNA_DECISION_STRATEGY_H
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size size() const
Gives the size.
Definition: actionSet.h:211
virtual void initialize(const FMDP< double > *fmdp)
Initializes the learner.
virtual ActionSet stateOptimalPolicy(const Instantiation &curState)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
A class to store the optimal actions.
Definition: actionSet.h:88
<agrum/FMDP/SDyna/IDecisionStrategy.h>
SequenceIteratorSafe< Idx > beginActions() const
Returns an iterator reference to he beginning of the list of actions.
Definition: fmdp.h:137
virtual void checkState(const Instantiation &newState, Idx actionId)=0
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Class implementingting a function graph.
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * _optPol
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
SequenceIteratorSafe< Idx > endActions() const
Returns an iterator reference to the end of the list of actions.
Definition: fmdp.h:144
virtual ~IDecisionStrategy()
Destructor (virtual and empty since it&#39;s an interface)
Size Idx
Type for indexes.
Definition: types.h:53
void setOptimalStrategy(const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > *optPol)