aGrUM  0.14.2
abstractSimulator.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  ***************************************************************************/
26 #ifndef GUM_ABSTRACT_SIMULATOR_H
27 #define GUM_ABSTRACT_SIMULATOR_H
28 //======================================================================
30 //======================================================================
31 #include <agrum/FMDP/fmdp.h>
32 //======================================================================
33 //======================================================================
34 
35 namespace gum {
46  public:
47  // ===========================================================================
49  // ===========================================================================
51 
56 
60  virtual ~AbstractSimulator();
61 
63 
64  // ===========================================================================
66  // ===========================================================================
68 
70  INLINE void setInitialState(const Instantiation& initialState) {
71  _currentState = initialState;
72  }
74 
75  protected:
77  virtual Instantiation _randomState();
78 
79  public:
81  INLINE void setEndState(const Instantiation& endState) {
82  _endState = endState;
83  }
84 
86  virtual bool hasReachEnd();
87 
89  INLINE const Instantiation& currentState() { return _currentState; }
90 
92  virtual double reward() = 0;
93 
95  virtual void perform(Idx) = 0;
96 
98 
99  // ===========================================================================
101  // ===========================================================================
103 
104  virtual const DiscreteVariable* primeVar(const DiscreteVariable* mainVar) = 0;
105 
109 
111 
112  // ===========================================================================
114  // ===========================================================================
116 
117  virtual const std::string& actionName(Idx) = 0;
118 
122 
123 
125 
128  };
129 
130 } /* namespace gum */
131 
132 
133 #endif // GUM__ABSTRACT_SIMULATOR_H
virtual double reward()=0
Sets the intial statefrom which we begun the simulation.
Safe iterators for Sequence.
Definition: sequence.h:1203
virtual bool hasReachEnd()
Tests if end state has been reached.
<agrum/FMDP/simulation/abstractSimulator.h>
virtual SequenceIteratorSafe< Idx > endActions()=0
Iteration over the variables of the simulated probleme.
virtual void perform(Idx)=0
Sets the intial statefrom which we begun the simulation.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
INLINE const Instantiation & currentState()
Sets the intial statefrom which we begun the simulation.
Instantiation _currentState
Tha state in which the system currently is.
Class for implementation of factored markov decision process.
virtual ~AbstractSimulator()
Default destructor.
void setInitialStateRandomly()
Sets the intial statefrom which we begun the simulation.
INLINE void setEndState(const Instantiation &endState)
Sets the final states upon which a run is over.
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.
Header files of gum::Instantiation.
virtual Instantiation _randomState()
Choses a random state as the first test for a run.
virtual SequenceIteratorSafe< const DiscreteVariable *> endVariables()=0
Iteration over the variables of the simulated probleme.
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:80
Size Idx
Type for indexes.
Definition: types.h:50
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.
INLINE void setInitialState(const Instantiation &initialState)
Sets the intial statefrom which we begun the simulation.
AbstractSimulator()
Default constructor.