Go to the documentation of this file.00001
00008 #ifndef _FUELROOMS_H_
00009 #define _FUELROOMS_H_
00010
00011 #include <set>
00012 #include <rl_common/Random.h>
00013 #include <rl_common/core.hh>
00014 #include "gridworld.hh"
00015
00016
00018 class FuelRooms: public Environment {
00019 public:
00020
00026 FuelRooms(Random &rand, bool extraVariation, bool stoch);
00027
00028 virtual ~FuelRooms();
00029
00030 virtual const std::vector<float> &sensation() const;
00031 virtual float apply(int action);
00032
00033 virtual bool terminal() const;
00034 virtual void reset();
00035
00036 virtual int getNumActions();
00037 virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat);
00038 virtual void getMinMaxReward(float* minR, float* maxR);
00039
00040 virtual std::vector<experience> getSeedings();
00041
00043 experience getExp(int s0, int s1, int s2, int a);
00044
00045
00047 void checkVisits();
00048
00050 void resetVisits();
00051
00053 void printVisits();
00054
00056 void printVisitMap(string filename);
00057
00058 protected:
00059 typedef std::pair<float,float> coord_t;
00060 enum room_action_t {NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST};
00061
00062 private:
00063 const int height;
00064 const int width;
00065 coord_t goal;
00066
00067 const bool extraVar;
00068 const bool noisy;
00069 Random &rng;
00070
00071
00072 std::vector<float> s;
00073
00074 float &ns;
00075 float &ew;
00076 float &energy;
00077
00078
00079 int fuelVisited;
00080 int totalVisited;
00081
00082 int** stateVisits;
00083
00087 room_action_t add_noise(room_action_t action);
00088
00090 float reward(int effect);
00091
00092 };
00093
00094 #endif