INET Framework for OMNeT++/OMNEST
|
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... | |
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.
|
protected |
Data type for the list of area types.
|
protected |
Data type for the list of space-time combinations.
|
protected |
Data type for the list of time domains.
|
protected |
Data type for a list of Markov transition matrices.
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.
inet::PostureTransition::~PostureTransition | ( | ) |
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.
Referenced by inet::MoBANCoordinator::readConfigurationFile().
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.
Referenced by inet::MoBANCoordinator::readConfigurationFile().
|
protected |
Adds two matrices with dimension numPos*numPose .
Function to add two matrix with the known dimensions as number of postures.
Referenced by extractMatrixFromSteadyState(), and inet::MoBANCoordinator::readConfigurationFile().
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.
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.
Referenced by inet::MoBANCoordinator::readConfigurationFile().
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.
Referenced by inet::MoBANCoordinator::readConfigurationFile().
|
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.
Referenced by addSteadyState().
|
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.
Referenced by getMatrix().
|
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.
Referenced by 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.
Referenced by inet::MoBANCoordinator::selectPosture().
|
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.
Referenced by addMatrix(), and addSteadyState().
|
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.
|
protected |
Multiplies two matrices with dimension numPos*numPose .
Function to multiply two matrix with the known dimensions as number of postures.
Referenced by extractMatrixFromSteadyState().
|
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.
Referenced by extractMatrixFromSteadyState().
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.
Referenced by inet::MoBANCoordinator::readConfigurationFile().
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.
Referenced by inet::MoBANCoordinator::readConfigurationFile().
|
protected |
Subtracts two matrices with dimension numPos*numPose .
Function to subtract two matrix with the known dimensions as number of postures.
Referenced by extractMatrixFromSteadyState().
|
protected |
The list of all defined area types.
Referenced by addAreaType(), addCombination(), findAreaType(), setAreaBoundry(), and ~PostureTransition().
|
protected |
The list of all given space-time combinations.
Referenced by addCombination(), getMatrix(), and ~PostureTransition().
|
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().
|
protected |
The list of all given transition matrices.
Referenced by addCombination(), addMatrix(), addSteadyState(), extractMatrixFromSteadyState(), getMatrix(), and ~PostureTransition().
|
protected |
Number of postures.
Referenced by addMatrix(), addSteadyState(), extractMatrixFromSteadyState(), isMarkovian(), multMatrix(), multVector(), PostureTransition(), subtractMatrix(), and ~PostureTransition().
|
protected |
The list of all defined time domains.
Referenced by addCombination(), addTimeDomain(), findTimeDomain(), setTimeBoundry(), and ~PostureTransition().