aGrUM  0.14.2
factorySimulator.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_FACTORY_SIMULATOR_H
27 #define GUM_FACTORY_SIMULATOR_H
28 //======================================================================
30 //======================================================================
31 #include <agrum/FMDP/fmdp.h>
32 //======================================================================
34 //======================================================================
36 //======================================================================
37 
38 namespace gum {
39 
40 
42  HOME = 0,
43  WORK = 1,
44  THEATER = 2,
45  CLUB = 3,
46  Factory = 4
47  };
49  HOMEX = 0,
50  WORKX = 0,
51  THEATERX = 3,
52  CLUBX = 4,
54  };
56  HOMEY = 0,
57  WORKY = 4,
58  THEATERY = 0,
59  CLUBY = 4,
61  };
63  GoNorth = 0,
64  GoEast = 1,
65  GoSouth = 2,
66  GoWest = 3,
67  PickUp = 4,
68  PutDown = 5,
69  FillUp = 6
70  };
71 
72  // clang-format off
79  // clang-format on
81  public:
82  // ===========================================================================
84  // ===========================================================================
86 
91 
96 
98 
99  // ===========================================================================
101  // ===========================================================================
103 
104  protected:
107 
108  public:
109  bool hasReachEnd();
111  double reward();
112  void perform(Idx);
113 
115 
116  // ===========================================================================
118  // ===========================================================================
120 
121  const DiscreteVariable* primeVar(const DiscreteVariable* mainVar) {
122  return __primeMap.second(mainVar);
123  }
124 
127  return __FactoryVars.beginSafe();
128  }
130  return __FactoryVars.endSafe();
131  }
132 
134 
135  // ===========================================================================
137  // ===========================================================================
139 
140  const std::string& actionName(Idx actionId) { return *__actionMap[actionId]; }
141 
144  return __FactoryActions.beginSafe();
145  }
147 
148 
150 
151 
152  private:
153  void __goNorth();
154  void __goEast();
155  void __goSouth();
156  void __goWest();
157  void __pickUp();
158  void __putDown();
159  void __fillUp();
160 
169 
172  HashTable< Idx, std::string* > __actionMap; //__actionMap.insert ( actionId,
173  // new std::string ( action ) );
175  };
176 
177 } /* namespace gum */
178 
179 
180 #endif // GUM_FACTORY_SIMULATOR_H
void perform(Idx)
Choses a random state as the first test for a run.
Safe iterators for Sequence.
Definition: sequence.h:1203
FactorySimulationLandmark
const std::string & actionName(Idx actionId)
Iteration over the variables of the simulated probleme.
FactorySimulationAction __lastAction
Base class for discrete random variable.
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:631
SequenceIteratorSafe< Idx > endActions()
Iteration over the variables of the simulated probleme.
SequenceIteratorSafe< const DiscreteVariable *> beginVariables()
Iteration over the variables of the simulated probleme.
<agrum/FMDP/simulation/abstractSimulator.h>
DiscreteVariable * __fuelLevel
Instantiation _randomState()
Choses a random state as the first test for a run.
const DiscreteVariable * primeVar(const DiscreteVariable *mainVar)
Iteration over the variables of the simulated probleme.
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1019
FactorySimulationLandmarkX
~FactorySimulator()
Default destructor.
Sequence< Idx > __FactoryActions
Actions.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
FactorySimulationAction
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:624
Class for implementation of factored markov decision process.
FactorySimulationLandmarkY
DiscreteVariable * __yPos
Class for simulating a discrete time stochastic process.
A class to simulate the Factory problem.
Header files of gum::Instantiation.
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1803
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:80
Bijection< const DiscreteVariable *, const DiscreteVariable *> __primeMap
FactorySimulator()
Default constructor.
Sequence< const DiscreteVariable *> __FactoryVars
Variables data structures.
DiscreteVariable * __passengerDest
DiscreteVariable * __xPos
SequenceIteratorSafe< const DiscreteVariable *> endVariables()
Iteration over the variables of the simulated probleme.
Size Idx
Type for indexes.
Definition: types.h:50
SequenceIteratorSafe< Idx > beginActions()
Iteration over the variables of the simulated probleme.
bool hasReachEnd()
Choses a random state as the first test for a run.
DiscreteVariable * __passengerPos
HashTable< Idx, std::string *> __actionMap
double reward()
Choses a random state as the first test for a run.