aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
abstractSimulator.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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 Class for simulating a discrete time stochastic process.
25  *
26  * @author Jean-Christophe MAGNAN
27  */
28 #ifndef GUM_ABSTRACT_SIMULATOR_H
29 #define GUM_ABSTRACT_SIMULATOR_H
30 //======================================================================
31 #include <agrum/tools/multidim/instantiation.h>
32 //======================================================================
33 #include <agrum/FMDP/fmdp.h>
34 //======================================================================
35 //======================================================================
36 
37 namespace gum {
38  /**
39  * @class AbstractSimulator abstractSimulator.h
40  * <agrum/FMDP/simulation/abstractSimulator.h>
41  * @brief A class to simulate a reinforcement learning problem.
42  * @ingroup fmdp_group
43  *
44  *
45  *
46  */
48  public:
49  // ===========================================================================
50  /// @name Constructors, Destructors.
51  // ===========================================================================
52  /// @{
53 
54  /**
55  * Default constructor.
56  */
58 
59  /**
60  * Default destructor.
61  */
62  virtual ~AbstractSimulator();
63 
64  /// @}
65 
66  // ===========================================================================
67  /// @name
68  // ===========================================================================
69  /// @{
70 
71  /// Sets the intial statefrom which we begun the simulation
74  }
76 
77  protected:
78  /// Choses a random state as the first test for a run
79  virtual Instantiation randomState_();
80 
81  public:
82  /// Sets the final states upon which a run is over
85  }
86 
87  /// Tests if end state has been reached
88  virtual bool hasReachEnd();
89 
90  ///
92 
93  ///
94  virtual double reward() = 0;
95 
96  ///
97  virtual void perform(Idx) = 0;
98 
99  /// @}
100 
101  // ===========================================================================
102  /// @name Variables
103  // ===========================================================================
104  /// @{
105 
106  virtual const DiscreteVariable* primeVar(const DiscreteVariable* mainVar) = 0;
107 
108  /// Iteration over the variables of the simulated probleme
109  virtual SequenceIteratorSafe< const DiscreteVariable* > beginVariables() = 0;
110  virtual SequenceIteratorSafe< const DiscreteVariable* > endVariables() = 0;
111 
112  /// @}
113 
114  // ===========================================================================
115  /// @name Actions
116  // ===========================================================================
117  /// @{
118 
119  virtual const std::string& actionName(Idx) = 0;
120 
121  /// Iteration over the variables of the simulated probleme
122  virtual SequenceIteratorSafe< Idx > beginActions() = 0;
123  virtual SequenceIteratorSafe< Idx > endActions() = 0;
124 
125 
126  /// @}
127 
128  /// Tha state in which the system currently is
130  };
131 
132 } /* namespace gum */
133 
134 
135 #endif // GUM__ABSTRACT_SIMULATOR_H
virtual double reward()=0
Sets the intial statefrom which we begun the simulation.
virtual Instantiation randomState_()
Choses a random state as the first test for a run.
virtual SequenceIteratorSafe< Idx > endActions()=0
Iteration over the variables of the simulated probleme.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
virtual void perform(Idx)=0
Sets the intial statefrom which we begun the simulation.
Instantiation currentState_
Tha state in which the system currently is.
virtual ~AbstractSimulator()
Default destructor.
virtual const DiscreteVariable * primeVar(const DiscreteVariable *mainVar)=0
Iteration over the variables of the simulated probleme.
virtual SequenceIteratorSafe< const DiscreteVariable *> beginVariables()=0
Iteration over the variables of the simulated probleme.
virtual SequenceIteratorSafe< const DiscreteVariable *> endVariables()=0
Iteration over the variables of the simulated probleme.
virtual const std::string & actionName(Idx)=0
Iteration over the variables of the simulated probleme.
virtual SequenceIteratorSafe< Idx > beginActions()=0
Iteration over the variables of the simulated probleme.
AbstractSimulator()
Default constructor.