aGrUM  0.19.0
a C++ library for (probabilistic) graphical models
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:1205
FactorySimulationLandmark
const std::string & actionName(Idx actionId)
Iteration over the variables of the simulated probleme.
Copyright 2005-2020 Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.
const iterator_safe & endSafe() const noexcept
Returns the safe end iterator.
Definition: sequence_tpl.h:633
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>
Sequence< Idx > FactoryActions__
Actions.
HashTable< Idx, std::string *> actionMap__
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:1021
Instantiation randomState_()
Choses a random state as the first test for a run.
FactorySimulationLandmarkX
~FactorySimulator()
Default destructor.
DiscreteVariable * fuelLevel__
Base class for discrete random variable.
DiscreteVariable * xPos__
Copyright 2005-2020 Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.
Definition: agrum.h:25
FactorySimulationAction lastAction__
FactorySimulationAction
iterator_safe beginSafe() const
Returns a safe begin iterator.
Definition: sequence_tpl.h:626
Copyright 2005-2020 Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.
FactorySimulationLandmarkY
Copyright 2005-2020 Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.
A class to simulate the Factory problem.
Copyright 2005-2020 Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1804
DiscreteVariable * yPos__
DiscreteVariable * passengerDest__
Sequence< const DiscreteVariable *> FactoryVars__
Variables data structures.
Bijection< const DiscreteVariable *, const DiscreteVariable *> primeMap__
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:82
FactorySimulator()
Default constructor.
SequenceIteratorSafe< const DiscreteVariable *> endVariables()
Iteration over the variables of the simulated probleme.
Size Idx
Type for indexes.
Definition: types.h:52
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__
double reward()
Choses a random state as the first test for a run.