Go to the documentation of this file.00001
00007 #ifndef _TWOROOMS_H_
00008 #define _TWOROOMS_H_
00009
00010 #include <set>
00011 #include <rl_common/Random.h>
00012 #include <rl_common/core.hh>
00013 #include "gridworld.hh"
00014
00015 #include <deque>
00016
00017
00020 class TwoRooms: public Environment {
00021 public:
00022
00030 TwoRooms(Random &rand, bool stochastic, bool rewardType, int actDelay, bool multiGoal);
00031
00032 virtual ~TwoRooms();
00033
00034 virtual const std::vector<float> &sensation() const;
00035 virtual float apply(int action);
00036
00037 virtual bool terminal() const;
00038 virtual void reset();
00039
00040 virtual int getNumActions();
00041 virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat);
00042 virtual void getMinMaxReward(float* minR, float* maxR);
00043
00045 experience getExp(float s0, float s1, int a);
00046
00047 virtual std::vector<experience> getSeedings();
00048
00049 protected:
00050 typedef std::pair<float,float> coord_t;
00051 enum room_action_t {NORTH, SOUTH, EAST, WEST};
00052
00053 private:
00054 const Gridworld *const grid;
00055 coord_t goal;
00056 coord_t goal2;
00057 std::deque<int> actHistory;
00058 bool useGoal2;
00059
00060 const bool negReward;
00061 const bool noisy;
00062 const int actDelay;
00063 const bool multiGoal;
00064
00065 Random &rng;
00066
00067 coord_t doorway;
00068
00069 std::vector<float> s;
00070
00071 float &ns;
00072 float &ew;
00073
00075 const Gridworld *create_default_map();
00076
00080 room_action_t add_noise(room_action_t action);
00081
00084 void randomize_goal();
00085
00087 float reward();
00088
00089 };
00090
00091 #endif