aGrUM  0.16.0
factorySimulator.h
Go to the documentation of this file.
1 
29 #ifndef GUM_FACTORY_SIMULATOR_H
30 #define GUM_FACTORY_SIMULATOR_H
31 //======================================================================
33 //======================================================================
34 #include <agrum/FMDP/fmdp.h>
35 //======================================================================
37 //======================================================================
39 //======================================================================
40 
41 namespace gum {
42 
43 
45  HOME = 0,
46  WORK = 1,
47  THEATER = 2,
48  CLUB = 3,
49  Factory = 4
50  };
52  HOMEX = 0,
53  WORKX = 0,
54  THEATERX = 3,
55  CLUBX = 4,
57  };
59  HOMEY = 0,
60  WORKY = 4,
61  THEATERY = 0,
62  CLUBY = 4,
64  };
66  GoNorth = 0,
67  GoEast = 1,
68  GoSouth = 2,
69  GoWest = 3,
70  PickUp = 4,
71  PutDown = 5,
72  FillUp = 6
73  };
74 
75  // clang-format off
82  // clang-format on
84  public:
85  // ===========================================================================
87  // ===========================================================================
89 
94 
99 
101 
102  // ===========================================================================
104  // ===========================================================================
106 
107  protected:
110 
111  public:
112  bool hasReachEnd();
114  double reward();
115  void perform(Idx);
116 
118 
119  // ===========================================================================
121  // ===========================================================================
123 
124  const DiscreteVariable* primeVar(const DiscreteVariable* mainVar) {
125  return __primeMap.second(mainVar);
126  }
127 
130  return __FactoryVars.beginSafe();
131  }
133  return __FactoryVars.endSafe();
134  }
135 
137 
138  // ===========================================================================
140  // ===========================================================================
142 
143  const std::string& actionName(Idx actionId) { return *__actionMap[actionId]; }
144 
147  return __FactoryActions.beginSafe();
148  }
150 
151 
153 
154 
155  private:
156  void __goNorth();
157  void __goEast();
158  void __goSouth();
159  void __goWest();
160  void __pickUp();
161  void __putDown();
162  void __fillUp();
163 
172 
175  HashTable< Idx, std::string* > __actionMap; //__actionMap.insert ( actionId,
176  // new std::string ( action ) );
178  };
179 
180 } /* namespace gum */
181 
182 
183 #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:1206
FactorySimulationLandmark
const std::string & actionName(Idx actionId)
Iteration over the variables of the simulated probleme.
FactorySimulationAction __lastAction
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:634
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:1022
FactorySimulationLandmarkX
~FactorySimulator()
Default destructor.
Sequence< Idx > __FactoryActions
Actions.
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
FactorySimulationAction
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:627
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
FactorySimulationLandmarkY
DiscreteVariable * __yPos
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
A class to simulate the Factory problem.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1805
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
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:53
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.