00001 #ifndef _STOCKS_H_ 00002 #define _STOCKS_H_ 00003 00004 #include <rl_common/Random.h> 00005 #include <rl_common/core.hh> 00006 #include <set> 00007 00008 00009 class Stocks: public Environment { 00010 public: 00016 Stocks(Random &rand, bool stochastic, int nsectors, int nstocks); 00017 00021 Stocks(Random &rand, bool stochastic); 00022 00023 virtual ~Stocks(); 00024 00025 virtual const std::vector<float> &sensation() const; 00026 virtual float apply(int action); 00027 00028 virtual bool terminal() const; 00029 virtual void reset(); 00030 virtual int getNumActions(); 00031 virtual void getMinMaxFeatures(std::vector<float> *minFeat, std::vector<float> *maxFeat); 00032 virtual bool isEpisodic() { return false; }; 00033 virtual void getMinMaxReward(float* minR, float* maxR); 00034 00035 void calcStockRising(); 00036 float reward(); 00037 void setSensation(std::vector<float> s); 00038 void initStocks(); 00039 00040 protected: 00041 00042 00043 00044 private: 00045 00046 const int nsectors; 00047 const int nstocks; 00048 const bool noisy; 00049 Random &rng; 00050 00051 std::vector<float> s; 00052 00053 // lets just have an index into the array 00054 int** rising; 00055 int* owners; 00056 00057 bool STOCK_DEBUG; 00058 00059 }; 00060 00061 #endif