fourrooms.hh
Go to the documentation of this file.
00001 #ifndef _FOURROOMS_H_
00002 #define _FOURROOMS_H_
00003 
00004 #include <set>
00005 #include <rl_common/Random.h>
00006 #include <rl_common/core.hh>
00007 #include "gridworld.hh"
00008 
00009 /*
00010 inline ostream &operator<<(ostream &out, const room_action_t &a) {
00011   switch(a) {
00012   case NORTH: return out << "NORTH";
00013   case SOUTH: return out << "SOUTH";
00014   case EAST: return out << "EAST";
00015   case WEST: return out << "WEST";
00016   }
00017   return out;
00018 }
00019 */
00020 
00021 class FourRooms: public Environment {
00022 public:
00027   FourRooms(Random &rand, const Gridworld *gridworld, bool stochastic);
00028 
00034   FourRooms(Random &rand);
00035 
00037   FourRooms(Random &rand, bool stochastic, bool negReward, bool exReward);
00038 
00040   FourRooms(Random &rand, bool stochastic, bool negReward);
00041 
00043   FourRooms(Random &rand, bool stochastic);
00044 
00046   FourRooms(Random &rand, unsigned width, unsigned height, bool stochastic);
00047 
00048   virtual ~FourRooms();
00049 
00050   virtual const std::vector<float> &sensation() const;
00051   virtual float apply(int action);
00052 
00053   virtual bool terminal() const;
00054   virtual void reset();
00055 
00056   virtual int getNumActions();
00057   virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat);
00058   virtual void getMinMaxReward(float* minR, float* maxR);
00059 
00060   const Gridworld &gridworld() const { return *grid; }
00061 
00062   friend std::ostream &operator<<(std::ostream &out, const FourRooms &rooms);
00063 
00064   std::vector<std::vector<float> > getSubgoals();
00065   void calcWallDistances();
00066 
00067   void setSensation(std::vector<float> newS);
00068 
00069 protected:
00070   typedef std::pair<float,float> coord_t;
00071   enum room_action_t {NORTH, SOUTH, EAST, WEST};
00072 
00073 private:
00074   const Gridworld *const grid;
00075   coord_t goal;
00076 
00077   const bool negReward;
00078   const bool noisy;
00079   const bool extraReward;
00080   const bool rewardSensor;
00081 
00082   Random &rng;
00083 
00084   coord_t doorway;
00085 
00086   std::vector<float> s;
00087   std::vector<float> unused;
00088 
00089   float &ns;
00090   float &ew;
00091 
00092   float &distN;
00093   float &distS;
00094   float &distE;
00095   float &distW;
00096 
00097   float &rewardEW;
00098   float &rewardNS;
00099 
00100   const bool goalOption;
00101 
00102   const Gridworld *create_default_map();
00103 
00107   room_action_t add_noise(room_action_t action);
00108 
00111   void randomize_goal();
00112 
00114   float reward(int effect);
00115 
00116 };
00117 
00118 #endif


rl_env
Author(s):
autogenerated on Thu Jun 6 2019 22:00:23