Go to the documentation of this file.00001 #ifndef BWI_PLANNING_COST_LEARNER_H
00002 #define BWI_PLANNING_COST_LEARNER_H
00003
00004 #include <bwi_planning_common/structures.h>
00005
00006 namespace bwi_planning {
00007
00008 typedef std::pair<const int, float> IFPair;
00009 typedef std::pair<const int, int> IIPair;
00010 typedef std::pair<const int, std::map<int, float> > IIFPair;
00011 typedef std::pair<const int, std::map<int, int> > IIIPair;
00012 typedef std::pair<const std::string, std::map<int, std::map< int, float> > >
00013 SIIFPair;
00014 typedef std::pair<const std::string, std::map<int, std::map< int, int> > >
00015 SIIIPair;
00016
00017 class CostLearner {
00018
00019 public:
00020
00021 CostLearner ();
00022
00023 void prepareInputData();
00024 void writeLuaFile(std::string lua_file = "");
00025 void writeValuesFile(int episode = -1);
00026 void readValuesFile(int episode = -1);
00027
00028 bool addSample(const std::string& loc, int door_from, int door_to,
00029 float cost);
00030 bool addSample(const std::string& loc, const std::string& door_from,
00031 const std::string& door_to, float cost);
00032 void finalizeEpisode();
00033
00034 private:
00035
00036 std::vector<bwi_planning_common::Door> doors_;
00037 std::map<std::string, std::map<int, std::map<int, float> > >
00038 distance_estimates_;
00039 std::map<std::string, std::map<int, std::map<int, int> > >
00040 distance_samples_;
00041
00042 std::string values_file_;
00043 std::string lua_file_;
00044
00045 double alpha_;
00046 bool use_exponential_weighting_;
00047 int iteration_;
00048 };
00049 }
00050
00051 #endif