aGrUM  0.16.0
taxiSimulator.h
Go to the documentation of this file.
1 
29 #ifndef GUM_TAXI_SIMULATOR_H
30 #define GUM_TAXI_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  TAXI = 4
50  };
52  HOMEX = 0,
53  WORKX = 0,
54  THEATERX = 3,
55  CLUBX = 4,
56  STATIONX = 2
57  };
59  HOMEY = 0,
60  WORKY = 4,
61  THEATERY = 0,
62  CLUBY = 4,
63  STATIONY = 1
64  };
66  GoNorth = 1,
67  GoEast = 2,
68  GoSouth = 3,
69  GoWest = 4,
70  PickUp = 5,
71  PutDown = 6,
72  FillUp = 7
73  };
74 
75  // clang-format off
82  // clang-format on
84  public:
85  // ===========================================================================
87  // ===========================================================================
89 
93  TaxiSimulator();
94 
99 
101 
102  // ===========================================================================
104  // ===========================================================================
106 
107  protected:
110 
111  public:
112  bool hasReachEnd();
113 
115 
116  // ===========================================================================
118  // ===========================================================================
120 
121  const DiscreteVariable* primeVar(const DiscreteVariable* mainVar) {
122  return __primeMap.second(mainVar);
123  }
124 
127  return __taxiVars.beginSafe();
128  }
130  return __taxiVars.endSafe();
131  }
132 
134 
135  // ===========================================================================
137  // ===========================================================================
139 
140  const std::string& actionName(Idx actionId) { return *__actionMap[actionId]; }
141 
144  return __taxiActions.beginSafe();
145  }
147 
148 
149  void perform(Idx);
150 
151  private:
152  void __performGoNorth();
153  void __performGoEast();
154  void __performGoSouth();
155  void __performGoWest();
156  void __performPickUp();
157  void __performPutDown();
158  void __performFillUp();
159 
161 
162  // ===========================================================================
164  // ===========================================================================
166  public:
167  double reward();
168 
169  private:
170  void __evalReward();
172  TaxiSimulationLandmarkX xCurPos,
173  TaxiSimulationLandmarkY yCurPos);
175  TaxiSimulationLandmarkX xCurPos,
176  TaxiSimulationLandmarkY yCurPos);
177 
179 
188 
191  HashTable< Idx, std::string* > __actionMap; //__actionMap.insert ( actionId,
192  // new std::string ( action ) );
194 
196  double __reward;
197  };
198 
199 } /* namespace gum */
200 
201 
202 #endif // GUM_TAXI_SIMULATOR_H
void perform(Idx)
Iteration over the variables of the simulated probleme.
Safe iterators for Sequence.
Definition: sequence.h:1206
void __performFillUp()
Iteration over the variables of the simulated probleme.
void __performGoEast()
Iteration over the variables of the simulated probleme.
void __performGoNorth()
Iteration over the variables of the simulated probleme.
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:634
class LabelizedVariable
<agrum/FMDP/simulation/abstractSimulator.h>
SequenceIteratorSafe< const DiscreteVariable *> beginVariables()
Iteration over the variables of the simulated probleme.
TaxiSimulationAction
Definition: taxiSimulator.h:65
LabelizedVariable * __passengerDest
const DiscreteVariable * primeVar(const DiscreteVariable *mainVar)
Iteration over the variables of the simulated probleme.
TaxiSimulationLandmarkX
Definition: taxiSimulator.h:51
LabelizedVariable * __xPos
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1022
SequenceIteratorSafe< const DiscreteVariable *> endVariables()
Iteration over the variables of the simulated probleme.
LabelizedVariable * __yPos
void __performGoWest()
Iteration over the variables of the simulated probleme.
Base class for discrete random variable.
TaxiSimulationLandmark
Definition: taxiSimulator.h:44
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
SequenceIteratorSafe< Idx > beginActions()
Iteration over the variables of the simulated probleme.
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:627
TaxiSimulationLandmarkY
Definition: taxiSimulator.h:58
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool hasReachEnd()
Choses a random state as the first test for a run.
Bijection< const DiscreteVariable *, const DiscreteVariable *> __primeMap
LabelizedVariable * __fuelLevel
double reward()
Sets the intial statefrom which we begun the simulation.
bool __isAtMeetPoint(TaxiSimulationLandmark passpos, TaxiSimulationLandmarkX xCurPos, TaxiSimulationLandmarkY yCurPos)
HashTable< Idx, std::string *> __actionMap
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
void __performGoSouth()
Iteration over the variables of the simulated probleme.
A class to simulate the Taxi problem.
Definition: taxiSimulator.h:83
Sequence< const DiscreteVariable *> __taxiVars
Variables data structures.
~TaxiSimulator()
Default destructor.
const std::string & actionName(Idx actionId)
Iteration over the variables of the simulated probleme.
double __reward
Reward.
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
LabelizedVariable * __passengerPos
Instantiation _randomState()
Choses a random state as the first test for a run.
void __performPutDown()
Iteration over the variables of the simulated probleme.
Size Idx
Type for indexes.
Definition: types.h:53
void __performPickUp()
Iteration over the variables of the simulated probleme.
SequenceIteratorSafe< Idx > endActions()
Iteration over the variables of the simulated probleme.
Sequence< Idx > __taxiActions
Actions.
TaxiSimulator()
Default constructor.
bool __isAtDestination(TaxiSimulationLandmark passDest, TaxiSimulationLandmarkX xCurPos, TaxiSimulationLandmarkY yCurPos)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
TaxiSimulationAction __lastAction