Go to the documentation of this file.00001
00008 #ifndef _TAXI_H_
00009 #define _TAXI_H_
00010
00011 #include <set>
00012 #include <rl_common/Random.h>
00013 #include <rl_common/core.hh>
00014 #include "gridworld.hh"
00015
00017 class Taxi: public Environment {
00018 public:
00024 Taxi(Random &rand, const Gridworld *gridworld, bool stochastic);
00025
00029 Taxi(Random &rand);
00030
00036 Taxi(Random &rand, bool stochastic);
00037
00045 Taxi(Random &rand, unsigned width, unsigned height, bool stochastic);
00046
00047 virtual ~Taxi();
00048
00049 virtual const std::vector<float> &sensation() const;
00050 virtual float apply(int action);
00051
00052 virtual bool terminal() const;
00053 virtual void reset();
00054 virtual int getNumActions();
00055 virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat);
00056 virtual void getMinMaxReward(float* minR, float* maxR);
00057 virtual std::vector<experience> getSeedings();
00058
00060 experience getExp(float s0, float s1, float s2, float s3, int a);
00061
00063 void setSensation(std::vector<float> newS);
00064
00065 protected:
00066 typedef std::pair<float,float> coord_t;
00067 enum taxi_action_t {NORTH, SOUTH, EAST, WEST, PICKUP, PUTDOWN};
00068
00070 class DefaultLandmarks: public std::vector<coord_t> {
00071 public:
00072 DefaultLandmarks();
00073 };
00074
00075 private:
00076 const Gridworld *const grid;
00077 std::vector<coord_t> landmarks;
00078 const bool noisy;
00079 Random &rng;
00080
00081 std::vector<float> s;
00082 bool fickle;
00083
00084 float &ns;
00085 float &ew;
00086 float &pass;
00087 float &dest;
00088
00090 static const Gridworld *create_default_map();
00091
00092 static const DefaultLandmarks defaultlandmarks;
00093
00097 taxi_action_t add_noise(taxi_action_t action);
00098
00102 void apply_fickle_passenger();
00103
00106 void randomize_landmarks();
00107
00110 void randomize_landmarks_to_corners();
00111 };
00112
00113 #endif