Go to the documentation of this file.00001
00007 #ifndef _MOUNTAINCAR_H_
00008 #define _MOUNTAINCAR_H_
00009
00010 #include <set>
00011 #include <deque>
00012 #include <rl_common/Random.h>
00013 #include <rl_common/core.hh>
00014
00018 class MountainCar: public Environment {
00019 public:
00020
00025 MountainCar(Random &rand);
00026
00033 MountainCar(Random &rand, bool stochastic, bool lin, int delay);
00034
00035 virtual ~MountainCar();
00036
00037 virtual const std::vector<float> &sensation() const;
00038 virtual float apply(int action);
00039
00040 virtual bool terminal() const;
00041 virtual void reset();
00042
00043 virtual int getNumActions();
00044 virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat);
00045 virtual void getMinMaxReward(float* minR, float* maxR);
00046
00048 void setSensation(std::vector<float> newS);
00049
00050 virtual std::vector<experience> getSeedings();
00051
00053 experience getExp(float s0, float s1, int a);
00054
00055 protected:
00056 enum car_action_t {REVERSE, ZERO, FORWARD};
00057
00058 private:
00059
00060 std::deque<float> posHistory;
00061 std::deque<float> velHistory;
00062
00063 const bool noisy;
00064 Random &rng;
00065
00066 std::vector<float> s;
00067
00068 float &pos;
00069 float &vel;
00070 const bool linear;
00071 int delay;
00072
00073 float reward();
00074
00075 float bound(float val, float min, float max);
00076
00077 };
00078
00079 #endif