com.net2plan.libraries

## Class TrafficMatrixGenerationModels

• ```public class TrafficMatrixGenerationModels
extends Object```

Set of methods implementing different traffic generation models based on traffic matrices.

Important: In `Net2Plan` self-demands are not allowed, thus the diagonal of the traffic matrices must be always zero.

Author:
Pablo Pavon-Marino, Jose-Luis Izquierdo-Zaragoza
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static double` ```activityFactor(double UTC, double timezoneOffset, double minValueFactor, double maxValueFactor)```
Returns the activity factor of a node, given the current UTC hour and its timezone (see ).
`static DoubleMatrix2D` ```bimodalUniformRandom(int N, double percentageThreshold, double minValueClass1, double maxValueClass1, double minValueClass2, double maxValueClass2)```
Generates a traffic matrix using a bimodal uniform random distribution, that is, a distribution in which a value is taken for a uniform random distribution with probability p, and from the other one with probability 1-p.
`static void` `checkTrafficMatrix(DoubleMatrix2D trafficMatrix)`
Checks whether the input traffic matrix is valid: non-negative square matrix with zero diagonal.
`static List<DoubleMatrix2D>` ```computeMatricesCAGR(DoubleMatrix2D trafficMatrix, double cagr, int numMatrices)```
Computes a set of matrices from a seminal one, using a traffic forecast based on the compound annual growth rate (CAGR) concept.
`static List<DoubleMatrix2D>` ```computeMatricesRandomGaussianVariation(DoubleMatrix2D trafficMatrix, double cv, double maxRelativeVariation, int numMatrices)```
Computes a set of matrices from a seminal one, using a random Gaussian distribution.
`static List<DoubleMatrix2D>` ```computeMatricesRandomUniformVariation(DoubleMatrix2D trafficMatrix, double maxRelativeVariation, int numMatrices)```
Computes a set of matrices from a seminal one, using a random uniform distribution.
`static DoubleMatrix2D` ```constantTrafficMatrix(int N, double value)```
Generates a constant traffic matrix.
`static DoubleMatrix2D` ```gravityModel(double[] ingressTrafficPerNode, double[] egressTrafficPerNode)```
Generates a traffic matrix using a 'gravity model' (see ).
`static DoubleMatrix2D` ```normalizationPattern_incomingTraffic(DoubleMatrix2D trafficMatrix, double[] incomingTraffic)```
Normalizes the input traffic matrix with respect to a given incoming traffic vector.
`static DoubleMatrix2D` ```normalizationPattern_outgoingTraffic(DoubleMatrix2D trafficMatrix, double[] outgoingTraffic)```
Normalizes the input traffic matrix with respect to a given outgoing traffic vector.
`static DoubleMatrix2D` ```normalizationPattern_totalTraffic(DoubleMatrix2D trafficMatrix, double totalTraffic)```
Normalizes the input traffic matrix so that the sum of all entries is equal to a given value.
`static DoubleMatrix2D` ```normalizeToLinkLoad(DoubleMatrix2D trafficMatrix, double linkCapacity, double load)```
Normalizes the load of a traffic matrix in an effort to assess the merits of the algorithms for different traffic load conditions.
`static DoubleMatrix1D` ```normalizeTraffic_linkCapacity_xde(NetPlan netPlan, String solverName, String solverLibraryName, NetworkLayer... optionalLayerParameter)```
Returns the maximum scaled version of the offered traffic vector that can be carried by the network, provided that no link is oversubscribed.
`static DoubleMatrix1D` ```normalizeTraffic_networkCapacity(NetPlan netPlan, NetworkLayer... optionalLayerParameter)```
Returns the maximum scaled version of the offered traffic vector so that the network capacity (summation of capacity of all links) is exhausted.
`static DoubleMatrix2D` ```populationDistanceModel(DoubleMatrix2D distanceMatrix, double[] populationVector, int[] levelVector, DoubleMatrix2D levelMatrix, double randomFactor, double populationOffset, double populationPower, double distanceOffset, double distancePower, boolean normalizePopulationFactor, boolean normalizeDistanceFactor)```
Generates a traffic matrix using the population-distance model.
`static void` `symmetrizeTrafficMatrix(DoubleMatrix2D trafficMatrix)`
Symmetrizes the input traffic matrix setting each node-pair traffic value equal to the average between the traffic in both directions.
`static DoubleMatrix2D` ```uniformRandom(int N, double minValue, double maxValue)```
Generates a traffic matrix using a uniform random distribution.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Method Detail

• #### bimodalUniformRandom

```public static DoubleMatrix2D bimodalUniformRandom(int N,
double percentageThreshold,
double minValueClass1,
double maxValueClass1,
double minValueClass2,
double maxValueClass2)```
Generates a traffic matrix using a bimodal uniform random distribution, that is, a distribution in which a value is taken for a uniform random distribution with probability p, and from the other one with probability 1-p.
Parameters:
`N` - Number of nodes
`percentageThreshold` - Mixture coefficient
`minValueClass1` - Minimum traffic value for class 1
`maxValueClass1` - Maximum traffic value for class 1
`minValueClass2` - Minimum traffic value for class 2
`maxValueClass2` - Maximum traffic value for class 2
Returns:
Traffic matrix
• #### checkTrafficMatrix

`public static void checkTrafficMatrix(DoubleMatrix2D trafficMatrix)`
Checks whether the input traffic matrix is valid: non-negative square matrix with zero diagonal.
Parameters:
`trafficMatrix` - Traffic matrix
• #### computeMatricesCAGR

```public static List<DoubleMatrix2D> computeMatricesCAGR(DoubleMatrix2D trafficMatrix,
double cagr,
int numMatrices)```

Computes a set of matrices from a seminal one, using a traffic forecast based on the compound annual growth rate (CAGR) concept.

Traffic forecast for node pair (i,j) on year k from the reference one is given by:

TM(i,j,k) = TM(i,j,0) * (1+CAGRk)

Parameters:
`trafficMatrix` - Seminal traffic matrix
`cagr` - Compound Annual Growth Rate (0.2 means an increase of 20% with respect to the previous year)
`numMatrices` - Number of matrices to generate
Returns:
New traffic matrices
• #### computeMatricesRandomGaussianVariation

```public static List<DoubleMatrix2D> computeMatricesRandomGaussianVariation(DoubleMatrix2D trafficMatrix,
double cv,
double maxRelativeVariation,
int numMatrices)```
Computes a set of matrices from a seminal one, using a random Gaussian distribution.
Parameters:
`trafficMatrix` - Seminal traffic matrix
`cv` - Coefficient of variation
`maxRelativeVariation` - Maximum relative variation from the mean value (0.2 means a maximum variation of +-20%)
`numMatrices` - Number of matrices to generate
Returns:
New traffic matrices
• #### computeMatricesRandomUniformVariation

```public static List<DoubleMatrix2D> computeMatricesRandomUniformVariation(DoubleMatrix2D trafficMatrix,
double maxRelativeVariation,
int numMatrices)```
Computes a set of matrices from a seminal one, using a random uniform distribution.
Parameters:
`trafficMatrix` - Seminal traffic matrix
`maxRelativeVariation` - Maximum relative variation from the mean value (0.2 means a maximum variation of +-20%)
`numMatrices` - Number of matrices to generate
Returns:
New traffic matrices
• #### constantTrafficMatrix

```public static DoubleMatrix2D constantTrafficMatrix(int N,
double value)```
Generates a constant traffic matrix.
Parameters:
`N` - Number of nodes
`value` - Traffic value
Returns:
Traffic matrix
• #### normalizationPattern_incomingTraffic

```public static DoubleMatrix2D normalizationPattern_incomingTraffic(DoubleMatrix2D trafficMatrix,
double[] incomingTraffic)```
Normalizes the input traffic matrix with respect to a given incoming traffic vector.
Parameters:
`trafficMatrix` - Input traffic matrix
`incomingTraffic` - Vector of incoming traffic to each node
Returns:
Traffic matrix normalized to the specified incoming traffic per node
• #### normalizationPattern_outgoingTraffic

```public static DoubleMatrix2D normalizationPattern_outgoingTraffic(DoubleMatrix2D trafficMatrix,
double[] outgoingTraffic)```
Normalizes the input traffic matrix with respect to a given outgoing traffic vector.
Parameters:
`trafficMatrix` - Input traffic matrix
`outgoingTraffic` - Vector of outgoing traffic to each node
Returns:
Traffic matrix normalized to the specified outgoing traffic per node
• #### normalizationPattern_totalTraffic

```public static DoubleMatrix2D normalizationPattern_totalTraffic(DoubleMatrix2D trafficMatrix,
double totalTraffic)```
Normalizes the input traffic matrix so that the sum of all entries is equal to a given value.
Parameters:
`trafficMatrix` - Input traffic matrix
`totalTraffic` - Total traffic expected
Returns:
Traffic matrix normalized to the specified total traffic

```public static DoubleMatrix2D normalizeToLinkLoad(DoubleMatrix2D trafficMatrix,

Normalizes the load of a traffic matrix in an effort to assess the merits of the algorithms for different traffic load conditions. The value `load` represents the average amount of traffic between two nodes, among all the entries, during the highest loaded time, measured in number of links.

Consequently, a value of `load`=0.5 corresponds to the case when the (maximum) average traffic between two nodes equals 50% of a single link capacity. In constrast, a value of `load`=10 captures cases in which the (maximum) average traffic between two nodes fills on average 10 links.

Parameters:
`trafficMatrix` - Input traffic matrix
`linkCapacity` - Link capacity (in same units as `trafficMatrix`)
`load` - Load factor (measured in number of links). The highest value of the resulting traffic matrix will be equal to `load`*`linkCapacity`
Returns:

```public static DoubleMatrix1D normalizeTraffic_linkCapacity_xde(NetPlan netPlan,
String solverName,
String solverLibraryName,
NetworkLayer... optionalLayerParameter)```

Returns the maximum scaled version of the offered traffic vector that can be carried by the network, provided that no link is oversubscribed. It is assumed no protection capacity is reserved.

Important: `JOM` library is required here.

Parameters:
`netPlan` - Network design with physical topology (nodes and links) and a set of demands
`solverName` - The solver name to be used by JOM
`solverLibraryName` - The solver library full or relative path, to be used by JOM. Leave blank to use JOM default
`optionalLayerParameter` - Network layer (optional)
Returns:
Scaled version of the offered traffic vector
• #### normalizeTraffic_networkCapacity

```public static DoubleMatrix1D normalizeTraffic_networkCapacity(NetPlan netPlan,
NetworkLayer... optionalLayerParameter)```

Returns the maximum scaled version of the offered traffic vector so that the network capacity (summation of capacity of all links) is exhausted.

Parameters:
`netPlan` - Network design with physical topology (nodes and links) and a set of demands
`optionalLayerParameter` - Network layer (optional)
Returns:
Scaled version of the offered traffic vector
• #### populationDistanceModel

```public static DoubleMatrix2D populationDistanceModel(DoubleMatrix2D distanceMatrix,
double[] populationVector,
int[] levelVector,
DoubleMatrix2D levelMatrix,
double randomFactor,
double populationOffset,
double populationPower,
double distanceOffset,
double distancePower,
boolean normalizePopulationFactor,
boolean normalizeDistanceFactor)```

Generates a traffic matrix using the population-distance model.

Reference: `R. S. Cahn, <i>Wide area network design: concepts and tools for optimization</i>, Morgan Kaufmann Publishers Inc., 1998`

Parameters:
`distanceMatrix` - Distance matrix, where cell (i, j) represents the distance from node i to node j
`populationVector` - Vector with N elements in which each element is the population of the corresponding node
`levelVector` - Vector with N elements in which each element is the level (i.e. type) of the corresponding node
`levelMatrix` - Level matrix
`randomFactor` - Random factor
`populationOffset` - Population offset
`populationPower` - Population power
`distanceOffset` - Distance offset
`distancePower` - Distance power
`normalizePopulationFactor` - Indicates whether population products must be normalized by the maximum population among all nodes
`normalizeDistanceFactor` - Indicates whether node-pair distances must be normalized by the maximum distance among all node-pairs
Returns:
Traffic matrix
• #### symmetrizeTrafficMatrix

`public static void symmetrizeTrafficMatrix(DoubleMatrix2D trafficMatrix)`
Symmetrizes the input traffic matrix setting each node-pair traffic value equal to the average between the traffic in both directions.
Parameters:
`trafficMatrix` - Traffic matrix
• #### uniformRandom

```public static DoubleMatrix2D uniformRandom(int N,
double minValue,
double maxValue)```
Generates a traffic matrix using a uniform random distribution.
Parameters:
`N` - Number of nodes
`minValue` - Minimum traffic value
`maxValue` - Maximum traffic value
Returns:
Traffic matrix