00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __ENVIRONMENT_XXX_H_
00030 #define __ENVIRONMENT_XXX_H_
00031
00032
00033 #define XXX_MAXACTIONSWIDTH 9
00034
00035 typedef struct ENV_XXX_CONFIG
00036 {
00037
00038 unsigned int StartX1;
00039 unsigned int StartX2;
00040 unsigned int StartX3;
00041 unsigned int StartX4;
00042 unsigned int GoalX1;
00043 unsigned int GoalX2;
00044 unsigned int GoalX3;
00045 unsigned int GoalX4;
00046
00047
00048
00049
00050 } EnvXXXConfig_t;
00051
00052 typedef struct ENVXXXHASHENTRY
00053 {
00054 int stateID;
00055 unsigned int X1;
00056 unsigned int X2;
00057 unsigned int X3;
00058 unsigned int X4;
00059
00060 } EnvXXXHashEntry_t;
00061
00062 typedef struct
00063 {
00064
00065 int startstateid;
00066 int goalstateid;
00067
00068
00069 int HashTableSize;
00070 vector<EnvXXXHashEntry_t*>* Coord2StateIDHashTable;
00071
00072
00073 vector<EnvXXXHashEntry_t*> StateID2CoordTable;
00074
00075
00076
00077 }EnvironmentXXX_t;
00078
00079
00082 class EnvironmentXXX : public DiscreteSpaceInformation
00083 {
00084
00085 public:
00088 bool InitializeEnv(const char* sEnvFile);
00089
00090
00093 bool InitializeMDPCfg(MDPConfig *MDPCfg);
00096 int GetFromToHeuristic(int FromStateID, int ToStateID);
00099 int GetGoalHeuristic(int stateID);
00102 int GetStartHeuristic(int stateID);
00105 void SetAllActionsandAllOutcomes(CMDPSTATE* state);
00108 void SetAllPreds(CMDPSTATE* state);
00111 void GetSuccs(int SourceStateID, vector<int>* SuccIDV, vector<int>* CostV);
00114 void GetPreds(int TargetStateID, vector<int>* PredIDV, vector<int>* CostV);
00115
00118 int SizeofCreatedEnv();
00121 void PrintState(int stateID, bool bVerbose, FILE* fOut=NULL);
00124 void PrintEnv_Config(FILE* fOut);
00125
00126
00127 ~EnvironmentXXX(){};
00128
00129 private:
00130
00131
00132 EnvXXXConfig_t EnvXXXCfg;
00133 EnvironmentXXX_t EnvXXX;
00134
00135
00136
00137 void ReadConfiguration(FILE* fCfg);
00138
00139 void InitializeEnvConfig();
00140
00141 unsigned int GETHASHBIN(unsigned int X1, unsigned int X2,
00142 unsigned int X3, unsigned int X4);
00143
00144 void PrintHashTableHist();
00145
00146
00147 EnvXXXHashEntry_t* GetHashEntry(unsigned int X1, unsigned int X2,
00148 unsigned int X3, unsigned int X4);
00149
00150
00151 EnvXXXHashEntry_t* CreateNewHashEntry(unsigned int X1, unsigned int X2,
00152 unsigned int X3, unsigned int X4);
00153
00154
00155 void CreateStartandGoalStates();
00156
00157 void InitializeEnvironment();
00158
00159
00160 void AddAllOutcomes(unsigned int SourceX1, unsigned int SourceX2, unsigned int SourceX3,
00161 unsigned int SourceX4, CMDPACTION* action, int cost);
00162
00163 void ComputeHeuristicValues();
00164
00165
00166 };
00167
00168
00169 #endif
00170