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
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include <iostream>
00045 #include <omnetpp.h>
00046 #include <BaseWorldUtility.h>
00047 #include <sstream>
00048
00062 class PostureTransition {
00063 protected:
00064
00066 int numPos;
00067
00072 int defaultMatrixID;
00073
00075 typedef struct{
00076 std::string name;
00077 double** matrix;
00078 }TransMatrix;
00079
00081 typedef std::vector<TransMatrix*> TransMatrixList;
00082
00084 TransMatrixList matrixList;
00085
00087 typedef struct{
00088 Coord low;
00089 Coord high;
00090 }AreaBound;
00091
00093 typedef struct{
00094 std::string name;
00095 std::vector<AreaBound*> boundries;
00096 }AreaType;
00097
00099 typedef std::vector<AreaType*> AreaTypeList;
00100
00102 AreaTypeList areaTypeList;
00103
00105 typedef struct{
00106 simtime_t low;
00107 simtime_t high;
00108 }TimeBound;
00109
00111 typedef struct{
00112 std::string name;
00113 std::vector<TimeBound*> boundries;
00114 }TimeDomainType;
00115
00117 typedef std::vector<TimeDomainType*> TimeDomainList;
00118
00120 TimeDomainList timeDomainList;
00121
00123 typedef struct{
00124 int timeID;
00125 int areaID;
00126 int matrixID;
00127 }CombinationType;
00128
00130 typedef std::vector<CombinationType*> CombinationList;
00131
00133 CombinationList combinationList;
00134
00135
00139 double** extractMatrixFromSteadyState(double* );
00140
00142 int findTimeDomain(simtime_t );
00143
00145 int findAreaType(Coord);
00146
00150 bool isMarkovian(double**);
00151
00155 bool isMarkovian(double*);
00156
00158 void multMatrix(double** , double** ,double** );
00159
00161 void addMatrix(double** , double** ,double** );
00162
00164 void subtractMatrix(double** , double** ,double** );
00165
00167 void multVector(double* ,double** );
00168
00169 public:
00170
00174 PostureTransition(int);
00175
00177 int addMatrix(std::string , double**, bool);
00178
00182 int addSteadyState(std::string, double* );
00183
00185 int addAreaType(std::string);
00186
00188 bool setAreaBoundry(int, Coord, Coord );
00189
00191 int addTimeDomain(std::string);
00192
00194 bool setTimeBoundry(int, simtime_t, simtime_t);
00195
00197 bool addCombination(std::string, std::string, std::string);
00198
00200 double** getMatrix(simtime_t, Coord);
00201
00202 };