energyrooms.hh
Go to the documentation of this file.
00001 #ifndef _ENERGYROOMS_H_
00002 #define _ENERGYROOMS_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 EnergyRooms: public Environment {
00022 public:
00027   EnergyRooms(Random &rand, const Gridworld *gridworld, bool stochastic);
00028 
00034   EnergyRooms(Random &rand, bool negReward);
00035 
00037   EnergyRooms(Random &rand, bool stochastic, bool negReward, bool goalOption);
00038 
00040   EnergyRooms(Random &rand, bool stochastic, bool negReward, bool goalOption, bool fuel);
00041 
00043   EnergyRooms(Random &rand, unsigned width, unsigned height, bool stochastic);
00044 
00045   virtual ~EnergyRooms();
00046 
00047   virtual const std::vector<float> &sensation() const;
00048   virtual float apply(int action);
00049 
00050   virtual bool terminal() const;
00051   virtual void reset();
00052 
00053   virtual int getNumActions();
00054   virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat);
00055   virtual void getMinMaxReward(float* minR, float* maxR);
00056 
00057   const Gridworld &gridworld() const { return *grid; }
00058 
00059   friend std::ostream &operator<<(std::ostream &out, const EnergyRooms &rooms);
00060 
00061   std::vector<std::vector<float> > getSubgoals();
00062 
00063 protected:
00064   typedef std::pair<float,float> coord_t;
00065   enum room_action_t {NORTH, SOUTH, EAST, WEST};
00066 
00067 private:
00068   const Gridworld *const grid;
00069   coord_t goal;
00070 
00071   const bool negReward;
00072 
00073   const bool noisy;
00074   Random &rng;
00075 
00076   coord_t doorway;
00077 
00078   std::vector<float> s;
00079 
00080   float &ns;
00081   float &ew;
00082   float &energy;
00083 
00084   const bool goalOption;
00085   const bool fuel;
00086 
00087   const Gridworld *create_default_map();
00088 
00092   room_action_t add_noise(room_action_t action);
00093 
00096   void randomize_goal();
00097 
00099   float reward();
00100 
00101 };
00102 
00103 #endif


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