MachineIntelligenceCore:ReinforcementLearning
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
MazeOfDigits.hpp
Go to the documentation of this file.
1 
23 #ifndef SRC_TYPES_MAZEOFDIGITS_HPP_
24 #define SRC_TYPES_MAZEOFDIGITS_HPP_
25 
26 #include <types/Environment.hpp>
27 
28 
29 namespace mic {
30 namespace environments {
31 
36 enum class MazeOfDigitsChannels : std::size_t
37 {
38  Digits = 0,
39  Goals = 1,
40  Walls = 2,
41  Agent = 3,
42  Count = 4
43 };
44 
45 
51 public:
56  MazeOfDigits(std::string node_name_ = "maze_of_digits");
57 
63 
67  virtual ~MazeOfDigits();
68 
73 
78  virtual size_t getObservationSize() { return ((!pomdp_flag) ? width * height * channels : roi_size * roi_size * 1); }
79 
84 
88  virtual void initializeEnvironment();
89 
98  void initExemplaryMaze();
99 
103  void reRandomAgentPosition();
104 
108  void initFullyRandomMaze();
109 
114 
118  void initRandomPathMaze();
119 
125  void setBiggerDigit(size_t x_, size_t y_, size_t value_);
126 
131  mic::types::TensorXfPtr getObservation();
132 
137  virtual std::string environmentToString();
138 
143  virtual std::string observationToString();
144 
149  virtual mic::types::MatrixXfPtr encodeEnvironment();
150 
155  virtual mic::types::MatrixXfPtr encodeObservation();
156 
157 
159  virtual mic::types::MatrixXfPtr encodeAgentGrid();
160 
165  virtual mic::types::Position2D getAgentPosition();
166 
172  virtual bool moveAgentToPosition(mic::types::Position2D pos_);
173 
179  virtual float getStateReward(mic::types::Position2D pos_);
180 
181  // Makes all versions of polymorphic method isStateAllowed() available.
183 
189  virtual bool isStateAllowed(mic::types::Position2D pos_);
190 
191  // Makes all versions of polymorphic method isStateTerminal() available.
193 
199  virtual bool isStateTerminal(mic::types::Position2D pos_);
200 
205  unsigned int optimalPathLength(){
206  return optimal_path_length;
207  }
208 
209 
210 protected:
211 
219  mic::configuration::Property<short> type;
220 
226  std::string gridToString(mic::types::TensorXfPtr & grid_);
227 
231  unsigned int optimal_path_length;
232 
233 
234 };
235 
236 } /* namespace environments */
237 } /* namespace mic */
238 
239 #endif /* SRC_TYPES_MAZEOFDIGITS_HPP_ */
virtual float getStateReward(mic::types::Position2D pos_)
virtual std::string observationToString()
Abstract class representing an environment.
Definition: Environment.hpp:40
virtual size_t getObservationSize()
virtual bool isStateTerminal(mic::types::Position2D pos_)
mic::environments::MazeOfDigits & operator=(const mic::environments::MazeOfDigits &md)
size_t channels
Number of channels.
virtual bool isStateTerminal(long x_, long y_)
Definition: Environment.cpp:66
virtual mic::types::Position2D getAgentPosition()
virtual bool isStateAllowed(mic::types::Position2D pos_)
mic::types::TensorXfPtr getObservation()
MazeOfDigitsChannels
MazeOfDigits channels.
virtual mic::types::MatrixXfPtr encodeEnvironment()
std::string gridToString(mic::types::TensorXfPtr &grid_)
mic::configuration::Property< size_t > width
Property: width of the environment.
Class emulating the maze of digits environment.
virtual void initializePropertyDependentVariables()
bool pomdp_flag
Flag related to.
Channel storing the agent position.
void setBiggerDigit(size_t x_, size_t y_, size_t value_)
virtual mic::types::MatrixXfPtr encodeAgentGrid()
Encode the current state of the reduced grid (only the agent position) as a matrix of size [1...
mic::configuration::Property< size_t > roi_size
Property: size of the ROI (region of interest).
virtual bool moveAgentToPosition(mic::types::Position2D pos_)
virtual mic::types::MatrixXfPtr encodeObservation()
MazeOfDigits(std::string node_name_="maze_of_digits")
mic::configuration::Property< short > type
mic::configuration::Property< size_t > height
Property: height of the environment.
virtual bool isStateAllowed(long x_, long y_)
Definition: Environment.cpp:62
virtual std::string environmentToString()