aGrUM  0.14.2
IDecisionStrategy.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
28 // =========================================================================
29 #ifndef GUM_SDYNA_DECISION_STRATEGY_H
30 #define GUM_SDYNA_DECISION_STRATEGY_H
31 // =========================================================================
32 #include <agrum/core/types.h>
33 // =========================================================================
35 // =========================================================================
37 // =========================================================================
38 
39 namespace gum {
40 
49  // ###################################################################
51  // ###################################################################
53  public:
54  // ==========================================================================
56  // ==========================================================================
57  virtual ~IDecisionStrategy() {}
58 
60 
61  // ###################################################################
63  // ###################################################################
65  public:
66  // ==========================================================================
68  // ==========================================================================
69  virtual void initialize(const FMDP< double >* fmdp) {
70  _optPol = nullptr;
71  if (_allActions.size() == 0)
72  for (auto actionIter = fmdp->beginActions();
73  actionIter != fmdp->endActions();
74  ++actionIter)
75  _allActions += *actionIter;
76  }
78 
79 
80  // ###################################################################
82  // ###################################################################
84  public:
85  virtual void checkState(const Instantiation& newState, Idx actionId) = 0;
86 
89  _optPol =
91  optPol);
92  }
93 
94  virtual ActionSet stateOptimalPolicy(const Instantiation& curState) {
95  return (_optPol && _optPol->realSize() != 0) ? _optPol->get(curState)
96  : _allActions;
97  }
98 
99  protected:
102 
105 
107  };
108 } // namespace gum
109 #endif // GUM_SDYNA_DECISION_STRATEGY_H
Provides basic types used in aGrUM.
Size size() const
Gives the size.
Definition: actionSet.h:208
virtual void initialize(const FMDP< double > *fmdp)
Initializes the learner.
virtual ActionSet stateOptimalPolicy(const Instantiation &curState)
Base class for discrete random variable.
A class to store the optimal actions.
Definition: actionSet.h:85
<agrum/FMDP/SDyna/IDecisionStrategy.h>
SequenceIteratorSafe< Idx > beginActions() const
Returns an iterator reference to he beginning of the list of actions.
Definition: fmdp.h:134
virtual void checkState(const Instantiation &newState, Idx actionId)=0
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Headers of the MDDOperatorStrategy planer class.
Class implementingting a function graph.
const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > * _optPol
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:80
SequenceIteratorSafe< Idx > endActions() const
Returns an iterator reference to the end of the list of actions.
Definition: fmdp.h:141
virtual ~IDecisionStrategy()
Destructor (virtual and empty since it&#39;s an interface)
Size Idx
Type for indexes.
Definition: types.h:50
void setOptimalStrategy(const MultiDimFunctionGraph< ActionSet, SetTerminalNodePolicy > *optPol)