INET Framework for OMNeT++/OMNEST
inet::PostureTransition Class Reference

Class to provide spatial and temporal correlation in the posture selection process of the MoBAN mobility model. More...

#include <PostureTransition.h>

Classes

struct  AreaBound
 Data type for one instance of the area (space) boundary. More...
 
struct  AreaType
 Data type for one instance of area type. More...
 
struct  CombinationType
 Data type for one instance of space-time combination. More...
 
struct  TimeBound
 Data type for one instance of the time boundary. More...
 
struct  TimeDomainType
 Data type for one instance of time domain. More...
 
struct  TransMatrix
 Data type for one instance of Markov transition matrix. More...
 

Public Member Functions

 PostureTransition (int)
 Construct a posture transition object. More...
 
 ~PostureTransition ()
 
int addMatrix (std::string, double **, bool)
 Receives a transition matrix and add to the list. More...
 
int addSteadyState (std::string, double *)
 Receives a steady state vector, extracts the corresponding transition matrix considering the default matrix, and add to the list of given matrices. More...
 
int addAreaType (std::string)
 Adds a area type to the list with the given name and returns the index of this area type in the list. More...
 
bool setAreaBoundry (int, Coord, Coord)
 Adds the given boundary to the existing area type specified by the given ID . More...
 
int addTimeDomain (std::string)
 Adds a time domain to the list with the given name and returns the index of the this time domain in the list. More...
 
bool setTimeBoundry (int, simtime_t, simtime_t)
 Adds the given boundary to the existing time domain specified by the given ID . More...
 
bool addCombination (std::string, std::string, std::string)
 Adds a space-time combination to the list. More...
 
double ** getMatrix (simtime_t, Coord)
 Gets a time and location, and returns the corresponding Markov transition matrix. More...
 

Protected Types

typedef std::vector< TransMatrix * > TransMatrixList
 Data type for a list of Markov transition matrices. More...
 
typedef std::vector< AreaType * > AreaTypeList
 Data type for the list of area types. More...
 
typedef std::vector< TimeDomainType * > TimeDomainList
 Data type for the list of time domains. More...
 
typedef std::vector< CombinationType * > CombinationList
 Data type for the list of space-time combinations. More...
 

Protected Member Functions

double ** extractMatrixFromSteadyState (double *)
 Gets a steady state vector and return a matrix which is as close as posible to the default matrix and satisfies the given steady state. More...
 
int findTimeDomain (simtime_t)
 Gets a time and finds the ID of the containing time domain if there is. More...
 
int findAreaType (Coord)
 Gets a location and finds the ID of the containing area type if there is. More...
 
bool isMarkovian (double **)
 Checks if a matrix can be a Markov transition matrix. More...
 
bool isMarkovian (double *)
 Checks if a vector can be the steady state of a Markov chain. More...
 
void multMatrix (double **, double **, double **)
 Multiplies two matrices with dimension numPos*numPose . More...
 
void addMatrix (double **, double **, double **)
 Adds two matrices with dimension numPos*numPose . More...
 
void subtractMatrix (double **, double **, double **)
 Subtracts two matrices with dimension numPos*numPose . More...
 
void multVector (double *, double **)
 Multiply a vector of size numPos with its transpose. More...
 

Protected Attributes

int numPos
 Number of postures. More...
 
int defaultMatrixID
 The index of the default (base) transition matrix. More...
 
TransMatrixList matrixList
 The list of all given transition matrices. More...
 
AreaTypeList areaTypeList
 The list of all defined area types. More...
 
TimeDomainList timeDomainList
 The list of all defined time domains. More...
 
CombinationList combinationList
 The list of all given space-time combinations. More...
 

Detailed Description

Class to provide spatial and temporal correlation in the posture selection process of the MoBAN mobility model.

This class obtains and stores Markovian transition matrices. There is also the possibility to get a steady state vector. In this case, the closest transition matrix to the default Makov matrix is extracted which satisfies the given steady state vector. The class also receives the defined area types and time domains as well as given space-time domains during the initialization phase. During the simulation run, the class provide a functions to return the corresponding markov matrix for a given time and location. It will be used whenever a new posture is going to be selected.

Author
Majid Nabi

Member Typedef Documentation

◆ AreaTypeList

typedef std::vector<AreaType *> inet::PostureTransition::AreaTypeList
protected

Data type for the list of area types.

◆ CombinationList

Data type for the list of space-time combinations.

◆ TimeDomainList

typedef std::vector<TimeDomainType *> inet::PostureTransition::TimeDomainList
protected

Data type for the list of time domains.

◆ TransMatrixList

typedef std::vector<TransMatrix *> inet::PostureTransition::TransMatrixList
protected

Data type for a list of Markov transition matrices.

Constructor & Destructor Documentation

◆ PostureTransition()

inet::PostureTransition::PostureTransition ( int  numPosture)

Construct a posture transition object.

Constructor function of the class.

The parameter is the number of postures which is the dimension of all matrices

It sets the value for t he number of posture. It also suppose the first given transition matrix as default. However, during parsing the xml configuration file, if a matrix has attribute type with value "default", it will be considered as the default (base) transition matrix.

56 {
57  numPos = numPosture;
58  defaultMatrixID = 0; // if no default matrix found, the first one will be supposed as the default matrix.
59 }

◆ ~PostureTransition()

inet::PostureTransition::~PostureTransition ( )
62 {
63  for (auto comb : combinationList) {
64  delete comb;
65  }
66  for (auto mat : matrixList) {
67  for (int i = 0; i < numPos; ++i)
68  delete[] mat->matrix[i];
69  delete[] mat->matrix;
70  delete mat;
71  }
72  for (auto areaType : areaTypeList) {
73  for (auto bound : areaType->boundries)
74  delete bound;
75  delete areaType;
76  }
77  for (auto timeDomain : timeDomainList) {
78  for (auto bound : timeDomain->boundries)
79  delete bound;
80  delete timeDomain;
81  }
82 }

Member Function Documentation

◆ addAreaType()

int inet::PostureTransition::addAreaType ( std::string  name)

Adds a area type to the list with the given name and returns the index of this area type in the list.

Creates a new area type instance and adds it to the list.

The boundaries of the area type is empty now. It will be filled later. The function returns the index of the new area type in the list as its output.

165 {
166  // Check if the name is repetitive
167  AreaTypeList::const_iterator areaIt;
168  for (areaIt = areaTypeList.begin(); areaIt != areaTypeList.end(); areaIt++) {
169  if ((*areaIt)->name == name) {
170  std::string str = "There are multiple area types with the same name: " + name + " in the configuration file!";
171  throw cRuntimeError("%s", str.c_str());
172  }
173  }
174 
175  AreaType *area = new AreaType;
176  area->name = name;
177  areaTypeList.push_back(area);
178  return areaTypeList.size() - 1;
179 }

Referenced by inet::MoBanCoordinator::readConfigurationFile().

◆ addCombination()

bool inet::PostureTransition::addCombination ( std::string  areaName,
std::string  timeName,
std::string  matrixName 
)

Adds a space-time combination to the list.

This function creates a new space-time combination instance and adds it to the combinations list.

It checks if the given names for area type, time domain, and matrix are previously defined and exist in the corresponding lists. Note that at least area type or time domain should have been specified for a combination. Otherwise the combination is not meaningful. if for example a combination has no area type and just has specified time domain, it means that for the whole simulation area, it will be the same and the proper matrix is selected based on the time.

237 {
238  int thisID;
239  CombinationType *comb = new CombinationType;
240  comb->areaID = -1;
241  comb->timeID = -1;
242  comb->matrixID = -1;
243 
244  // look for matching area type name.
245  thisID = 0;
246  AreaTypeList::const_iterator areaIt;
247  for (areaIt = areaTypeList.begin(); areaIt != areaTypeList.end(); areaIt++) {
248  if (areaName == (*areaIt)->name) {
249  comb->areaID = thisID;
250  break;
251  }
252  ++thisID;
253  }
254 
255  // in the input name is empty, it means that no area type is specified for this combination.
256  if (comb->areaID == -1 && !areaName.empty()) {
257  std::string str = "Undefined area type name is given in a combinations: " + areaName + ", " + timeName + ", " + matrixName;
258  throw cRuntimeError("%s", str.c_str());
259  }
260 
261  // look for matching time domain name.
262  thisID = 0;
263  TimeDomainList::const_iterator timeIt;
264  for (timeIt = timeDomainList.begin(); timeIt != timeDomainList.end(); timeIt++) {
265  if (timeName == (*timeIt)->name) {
266  comb->timeID = thisID;
267  break;
268  }
269  ++thisID;
270  }
271  if (comb->timeID == -1 && !timeName.empty()) {
272  std::string str = "Undefined time domain name is given in a combinations: " + areaName + ", " + timeName + ", " + matrixName;
273  throw cRuntimeError("%s", str.c_str());
274  }
275 
276  if (comb->areaID == -1 && comb->timeID == -1)
277  throw cRuntimeError("Both area type and time domain is unspecified in a combination.");
278 
279  // look for matching transition matrix name.
280  thisID = 0;
281  TransMatrixList::const_iterator matrixIt;
282  for (matrixIt = matrixList.begin(); matrixIt != matrixList.end(); matrixIt++) {
283  if (matrixName == (*matrixIt)->name) {
284  comb->matrixID = thisID;
285  break;
286  }
287  ++thisID;
288  }
289  if (comb->matrixID == -1)
290  throw cRuntimeError("Undefined matrix name is given in the combinations");
291 
292  combinationList.push_back(comb);
293 
294  return true;
295 }

Referenced by inet::MoBanCoordinator::readConfigurationFile().

◆ addMatrix() [1/2]

void inet::PostureTransition::addMatrix ( double **  mat1,
double **  mat2,
double **  res 
)
protected

Adds two matrices with dimension numPos*numPose .

Function to add two matrix with the known dimensions as number of postures.

428 {
429  int i, j;
430  for (i = 0; i < numPos; i++) {
431  for (j = 0; j < numPos; j++)
432  res[i][j] = mat1[i][j] + mat2[i][j];
433  }
434 }

Referenced by extractMatrixFromSteadyState(), and inet::MoBanCoordinator::readConfigurationFile().

◆ addMatrix() [2/2]

int inet::PostureTransition::addMatrix ( std::string  name,
double **  matrix,
bool  thisDefault 
)

Receives a transition matrix and add to the list.

This function initiates a new instance of markov matrix with the given matrix.

Note that it copies the matrix into the created matrix. The function first verifies if the given matrix can be a Markov transition matrix.

89 {
90  // check if the name is repetitive
91  TransMatrixList::const_iterator matrixIt;
92  for (matrixIt = matrixList.begin(); matrixIt != matrixList.end(); matrixIt++) {
93  if ((*matrixIt)->name == name) {
94  std::string str = "There are multiple matrices with the same name: " + name + " in the configuration file!";
95  throw cRuntimeError("%s", str.c_str());
96  }
97  }
98 
99  // verify if the given matrix is Markovian
100  if (!isMarkovian(matrix)) {
101  std::string str = "Given transition matrix " + name + " is not Markovian!";
102  throw cRuntimeError("%s", str.c_str());
103  }
104 
105  TransMatrix *mat = new TransMatrix;
106 
107  mat->name = name;
108  mat->matrix = new double *[numPos];
109  for (int i = 0; i < numPos; ++i) {
110  mat->matrix[i] = new double[numPos];
111  for (int j = 0; j < numPos; ++j)
112  mat->matrix[i][j] = matrix[i][j];
113  }
114 
115  matrixList.push_back(mat);
116 
117  if (thisDefault)
118  defaultMatrixID = matrixList.size() - 1;
119 
120  return 0;
121 }

◆ addSteadyState()

int inet::PostureTransition::addSteadyState ( std::string  name,
double *  iVector 
)

Receives a steady state vector, extracts the corresponding transition matrix considering the default matrix, and add to the list of given matrices.

This function creates a new instance of markov matrix to be filled with a derived matrix from the given steady state vector.

The function first verifies if the given vector can be a steady state vector. Then extracts a markov matrix based on that and adds it to the list of given matrices.

129 {
130  // check if the name is repetitive
131  TransMatrixList::const_iterator matrixIt;
132  for (matrixIt = matrixList.begin(); matrixIt != matrixList.end(); matrixIt++) {
133  if ((*matrixIt)->name == name) {
134  std::string str = "There are multiple matrices with the same name: " + name + " in the configuration file!";
135  throw cRuntimeError("%s", str.c_str());
136  }
137  }
138 
139  // check if the given matrix is Markovian
140  if (!isMarkovian(iVector)) {
141  std::string str = "Given steady state vector " + name + " cannot be true!";
142  throw cRuntimeError("%s", str.c_str());
143  }
144 
145  // make a local copy of the input steady state vector
146  double *steady = new double[numPos];
147  for (int i = 0; i < numPos; ++i)
148  steady[i] = iVector[i];
149 
150  TransMatrix *mat = new TransMatrix;
151  mat->name = name;
152  mat->matrix = extractMatrixFromSteadyState(steady);
153  delete[] steady;
154 
155  matrixList.push_back(mat);
156 
157  return 0;
158 }

Referenced by inet::MoBanCoordinator::readConfigurationFile().

◆ addTimeDomain()

int inet::PostureTransition::addTimeDomain ( std::string  name)

Adds a time domain to the list with the given name and returns the index of the this time domain in the list.

Creates a new time domain instance and adds it to the list.

The boundaries of the time domain is empty now. It will be filled later. The function returns the index of the time domain in the list as its output.

200 {
201  // Check if the name is repetitive
202  TimeDomainList::const_iterator timeIt;
203  for (timeIt = timeDomainList.begin(); timeIt != timeDomainList.end(); timeIt++) {
204  if ((*timeIt)->name == name) {
205  std::string str = "There are multiple time domains with the same name: " + name + " in the configuration file!";
206  throw cRuntimeError("%s", str.c_str());
207  }
208  }
209 
210  TimeDomainType *time = new TimeDomainType;
211  time->name = name;
212  timeDomainList.push_back(time);
213  return timeDomainList.size() - 1;
214 }

Referenced by inet::MoBanCoordinator::readConfigurationFile().

◆ extractMatrixFromSteadyState()

double ** inet::PostureTransition::extractMatrixFromSteadyState ( double *  vec)
protected

Gets a steady state vector and return a matrix which is as close as posible to the default matrix and satisfies the given steady state.

This function receives a steady state vector and extracts a Markovian matrix which is as close as possible to the default markov matrix and satisfies the given steady state vector.

465 {
466  int i, j;
467  double **dafaultMat;
468 
469  // make output matrix and an identity matrix and a temp
470  double **mat = new double *[numPos];
471  double **temp1 = new double *[numPos];
472  double **temp2 = new double *[numPos];
473  double **temp3 = new double *[numPos];
474  double **identity = new double *[numPos];
475  int **change = new int *[numPos];
476  for (int i = 0; i < numPos; ++i) {
477  mat[i] = new double[numPos];
478  temp1[i] = new double[numPos];
479  temp2[i] = new double[numPos];
480  temp3[i] = new double[numPos];
481  identity[i] = new double[numPos];
482  change[i] = new int[numPos];
483  }
484 
485  for (i = 0; i < numPos; i++)
486  for (j = 0; j < numPos; j++)
487  if (i == j)
488  identity[i][j] = 1;
489  else
490  identity[i][j] = 0;
491 
492  double *sum = new double[numPos];
493  int *changeSum = new int[numPos];
494 
495  dafaultMat = matrixList.at(defaultMatrixID)->matrix;
496 
497  for (int numTry = 0; numTry < 400; ++numTry) {
498  subtractMatrix(identity, dafaultMat, temp1);
499  multVector(vec, temp2);
500  multMatrix(temp1, temp2, temp3);
501  addMatrix(dafaultMat, temp3, mat);
502 
503  // remember if it has not changed
504  for (i = 0; i < numPos; i++)
505  for (j = 0; j < numPos; j++)
506  change[i][j] = 1;
507 
508  for (j = 0; j < numPos; j++)
509  for (i = 0; i < numPos; i++) {
510  if (mat[i][j] < 0) {
511  mat[i][j] = 0;
512  change[i][j] = 0;
513  }
514  if (mat[i][j] > 1) {
515  mat[i][j] = 1;
516  change[i][j] = 0;
517  }
518  }
519 
520  for (j = 0; j < numPos; j++) {
521  sum[j] = 0;
522  changeSum[j] = 0;
523  for (i = 0; i < numPos; i++) {
524  sum[j] += mat[i][j];
525  changeSum[j] += change[i][j];
526  }
527  }
528 
529  for (j = 0; j < numPos; j++)
530  for (i = 0; i < numPos; i++) {
531  if (change[i][j] == 1)
532  mat[i][j] = mat[i][j] + (1 - sum[j]) / changeSum[j];
533  }
534 
535  dafaultMat = mat;
536  }
537 
538  for (j = 0; j < numPos; j++)
539  for (i = 0; i < numPos; i++) {
540  if (mat[i][j] < 0)
541  mat[i][j] = 0;
542  if (mat[i][j] > 1)
543  mat[i][j] = 1;
544  }
545 
546  EV_DEBUG << "Generated Markov matrix from the steady state: " << endl;
547  for (int k = 0; k < numPos; ++k) {
548  for (int f = 0; f < numPos; ++f)
549  EV_DEBUG << mat[k][f] << " ";
550  EV_DEBUG << endl;
551  }
552 
553  for (int i = 0; i < numPos; ++i) {
554  delete[] temp1[i];
555  delete[] temp2[i];
556  delete[] temp3[i];
557  delete[] identity[i];
558  delete[] change[i];
559  }
560  delete[] temp1;
561  delete[] temp2;
562  delete[] temp3;
563  delete[] identity;
564  delete[] change;
565  delete[] sum;
566  delete[] changeSum;
567 
568  return mat;
569 }

Referenced by addSteadyState().

◆ findAreaType()

int inet::PostureTransition::findAreaType ( Coord  iLocation)
protected

Gets a location and finds the ID of the containing area type if there is.

Looks for the first containing area type for the given location.

If not, return -1.

It return the Id of the found area type. If no area type is found which contains the given location, it returns -1.

351 {
352  int locationID = 0;
353  AreaTypeList::const_iterator areaIt;
354  for (areaIt = areaTypeList.begin(); areaIt != areaTypeList.end(); areaIt++) {
355  std::vector<AreaBound *> boundList = (*areaIt)->boundries;
356 
357  std::vector<AreaBound *>::const_iterator bound;
358  for (bound = boundList.begin(); bound != boundList.end(); bound++) {
359  if (iLocation.isInBoundary((*bound)->low, (*bound)->high))
360  return locationID;
361  }
362  ++locationID;
363  }
364  EV_DEBUG << "Area Type not found" << endl;
365  return -1;
366 }

Referenced by getMatrix().

◆ findTimeDomain()

int inet::PostureTransition::findTimeDomain ( simtime_t  iTime)
protected

Gets a time and finds the ID of the containing time domain if there is.

Looks for the first containing time domain for the given time instance.

If not, return -1.

It return the Id of the found time domain. If no time domain is found which contains the given time instance, it returns -1.

329 {
330  int timeID = 0;
331  TimeDomainList::const_iterator timeIt;
332  for (timeIt = timeDomainList.begin(); timeIt != timeDomainList.end(); timeIt++) {
333  std::vector<TimeBound *> boundList = (*timeIt)->boundries;
334 
335  std::vector<TimeBound *>::const_iterator bound;
336  for (bound = boundList.begin(); bound != boundList.end(); bound++) {
337  if (iTime >= (*bound)->low && iTime < (*bound)->high)
338  return timeID;
339  }
340  ++timeID;
341  }
342  EV_DEBUG << "Time domain not found" << endl;
343  return -1;
344 }

Referenced by getMatrix().

◆ getMatrix()

double ** inet::PostureTransition::getMatrix ( simtime_t  iTime,
Coord  iLocation 
)

Gets a time and location, and returns the corresponding Markov transition matrix.

This function is actually the main usage of this class.

It gets a time instance and a location within the simulation area, and then looks for the first fitting combination. If found, it returns the specified Markov transition matrix for that combination as its output. If no combination is found, it returns the default matrix.

303 {
304  int timeID, locationID, matrixID;
305 
306  timeID = findTimeDomain(iTime);
307  locationID = findAreaType(iLocation);
308 
309  matrixID = defaultMatrixID;
310 
311  CombinationList::const_iterator combIt;
312  for (combIt = combinationList.begin(); combIt != combinationList.end(); combIt++) {
313  if ((*combIt)->timeID == timeID && (*combIt)->areaID == locationID) {
314  matrixID = (*combIt)->matrixID;
315  break;
316  }
317  }
318 
319  EV_DEBUG << "The corresponding Markov matrix for time" << iTime.dbl() << " and location " << iLocation.str() << " is: " << matrixList.at(matrixID)->name << endl;
320 
321  return matrixList.at(matrixID)->matrix;
322 }

Referenced by inet::MoBanCoordinator::selectPosture().

◆ isMarkovian() [1/2]

bool inet::PostureTransition::isMarkovian ( double *  vec)
protected

Checks if a vector can be the steady state of a Markov chain.

Verifies if a vector can be the steady state of a Markov model.

All elements should be in the range [0,1] and the sum of elements should be 1.

Each element of the matrix should be in the range [0 1]. Further, the sum of all elements should be one.

395 {
396  double sumCol = 0;
397  for (int i = 0; i < numPos; ++i) {
398  if (vec[i] < 0 || vec[i] > 1)
399  return false;
400  sumCol += vec[i];
401  }
402 
403  if (!math::close(sumCol, 1.0))
404  return false;
405  else
406  return true;
407 }

◆ isMarkovian() [2/2]

bool inet::PostureTransition::isMarkovian ( double **  matrix)
protected

Checks if a matrix can be a Markov transition matrix.

Verifies if a matrix can be a Markovian transition matrix.

All elements should be in the range [0,1] and elements of each column of the matrix should add up to 1.

Each element of the matrix should be in the range [0 1]. Further, all elements of each column should adds up to one.

373 {
374  double sumCol;
375  for (int j = 0; j < numPos; ++j) {
376  sumCol = 0;
377  for (int i = 0; i < numPos; ++i) {
378  if (matrix[i][j] < 0 || matrix[i][j] > 1)
379  return false;
380  sumCol += matrix[i][j];
381  }
382 
383  if (!math::close(sumCol, 1.0))
384  return false;
385  }
386 
387  return true;
388 }

Referenced by addMatrix(), and addSteadyState().

◆ multMatrix()

void inet::PostureTransition::multMatrix ( double **  mat1,
double **  mat2,
double **  res 
)
protected

Multiplies two matrices with dimension numPos*numPose .

Function to multiply two matrix with the known dimensions as number of postures.

413 {
414  int i, j, l;
415  for (i = 0; i < numPos; i++) {
416  for (j = 0; j < numPos; j++) {
417  res[i][j] = 0;
418  for (l = 0; l < numPos; l++)
419  res[i][j] += mat1[i][l] * mat2[l][j];
420  }
421  }
422 }

Referenced by extractMatrixFromSteadyState().

◆ multVector()

void inet::PostureTransition::multVector ( double *  vec,
double **  res 
)
protected

Multiply a vector of size numPos with its transpose.

Function to multiply a vector by its transpose (pi .

pi^T). The size in equal to the number of postures.

452 {
453  int i, j;
454  for (i = 0; i < numPos; i++) {
455  for (j = 0; j < numPos; j++)
456  res[i][j] = vec[i] * vec[j];
457  }
458 }

Referenced by extractMatrixFromSteadyState().

◆ setAreaBoundry()

bool inet::PostureTransition::setAreaBoundry ( int  id,
Coord  lowBound,
Coord  highBound 
)

Adds the given boundary to the existing area type specified by the given ID .

This function gets an index of an existing area type and adds the given boundary to the boundary list of that area type.

185 {
186  AreaBound *bound = new AreaBound;
187  bound->low = lowBound;
188  bound->high = highBound;
189 
190  areaTypeList.at(id)->boundries.push_back(bound);
191 
192  return true;
193 }

Referenced by inet::MoBanCoordinator::readConfigurationFile().

◆ setTimeBoundry()

bool inet::PostureTransition::setTimeBoundry ( int  id,
simtime_t  lowBound,
simtime_t  highBound 
)

Adds the given boundary to the existing time domain specified by the given ID .

This function gets an index of an existing time domain and adds the given boundary to the boundary list of that time domain.

220 {
221  TimeBound *bound = new TimeBound;
222  bound->low = lowBound;
223  bound->high = highBound;
224 
225  timeDomainList.at(id)->boundries.push_back(bound);
226 
227  return true;
228 }

Referenced by inet::MoBanCoordinator::readConfigurationFile().

◆ subtractMatrix()

void inet::PostureTransition::subtractMatrix ( double **  mat1,
double **  mat2,
double **  res 
)
protected

Subtracts two matrices with dimension numPos*numPose .

Function to subtract two matrix with the known dimensions as number of postures.

440 {
441  int i, j;
442  for (i = 0; i < numPos; i++) {
443  for (j = 0; j < numPos; j++)
444  res[i][j] = mat1[i][j] - mat2[i][j];
445  }
446 }

Referenced by extractMatrixFromSteadyState().

Member Data Documentation

◆ areaTypeList

AreaTypeList inet::PostureTransition::areaTypeList
protected

The list of all defined area types.

Referenced by addAreaType(), addCombination(), findAreaType(), setAreaBoundry(), and ~PostureTransition().

◆ combinationList

CombinationList inet::PostureTransition::combinationList
protected

The list of all given space-time combinations.

Referenced by addCombination(), getMatrix(), and ~PostureTransition().

◆ defaultMatrixID

int inet::PostureTransition::defaultMatrixID
protected

The index of the default (base) transition matrix.

If no default is set, the first matrix is supposed as the default. Default matrix is used for the cases that a time or space domain does not lie in any given area types or time domains. It is also used for generating the transition matrix in the case that a steady state vector is given for a space-time domain.

Referenced by addMatrix(), extractMatrixFromSteadyState(), getMatrix(), and PostureTransition().

◆ matrixList

TransMatrixList inet::PostureTransition::matrixList
protected

The list of all given transition matrices.

Referenced by addCombination(), addMatrix(), addSteadyState(), extractMatrixFromSteadyState(), getMatrix(), and ~PostureTransition().

◆ numPos

int inet::PostureTransition::numPos
protected

◆ timeDomainList

TimeDomainList inet::PostureTransition::timeDomainList
protected

The list of all defined time domains.

Referenced by addCombination(), addTimeDomain(), findTimeDomain(), setTimeBoundry(), and ~PostureTransition().


The documentation for this class was generated from the following files:
inet::PostureTransition::areaTypeList
AreaTypeList areaTypeList
The list of all defined area types.
Definition: PostureTransition.h:103
inet::PostureTransition::combinationList
CombinationList combinationList
The list of all given space-time combinations.
Definition: PostureTransition.h:134
inet::PostureTransition::timeDomainList
TimeDomainList timeDomainList
The list of all defined time domains.
Definition: PostureTransition.h:121
inet::PostureTransition::extractMatrixFromSteadyState
double ** extractMatrixFromSteadyState(double *)
Gets a steady state vector and return a matrix which is as close as posible to the default matrix and...
Definition: PostureTransition.cc:464
inet::PostureTransition::findAreaType
int findAreaType(Coord)
Gets a location and finds the ID of the containing area type if there is.
Definition: PostureTransition.cc:350
inet::PostureTransition::findTimeDomain
int findTimeDomain(simtime_t)
Gets a time and finds the ID of the containing time domain if there is.
Definition: PostureTransition.cc:328
inet::PostureTransition::matrixList
TransMatrixList matrixList
The list of all given transition matrices.
Definition: PostureTransition.h:85
inet::PostureTransition::multMatrix
void multMatrix(double **, double **, double **)
Multiplies two matrices with dimension numPos*numPose .
Definition: PostureTransition.cc:412
inet::PostureTransition::addMatrix
void addMatrix(double **, double **, double **)
Adds two matrices with dimension numPos*numPose .
Definition: PostureTransition.cc:427
inet::PostureTransition::defaultMatrixID
int defaultMatrixID
The index of the default (base) transition matrix.
Definition: PostureTransition.h:73
inet::math::close
bool close(double one, double two)
Tests whether two doubles are close enough to be declared equal.
Definition: INETMath.h:123
inet::PostureTransition::multVector
void multVector(double *, double **)
Multiply a vector of size numPos with its transpose.
Definition: PostureTransition.cc:451
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::PostureTransition::numPos
int numPos
Number of postures.
Definition: PostureTransition.h:67
inet::PostureTransition::subtractMatrix
void subtractMatrix(double **, double **, double **)
Subtracts two matrices with dimension numPos*numPose .
Definition: PostureTransition.cc:439
inet::PostureTransition::isMarkovian
bool isMarkovian(double **)
Checks if a matrix can be a Markov transition matrix.
Definition: PostureTransition.cc:372