Class QNModel
java.lang.Object
solvers.dataStructures.QNModel
This class contains an implementation of the input file reader and parser,
as well as a storage data structure for the model and performance evaluation
values. It also implements some useful operations using the model, such as
various estimations.
- Author:
- Michail Makaronidis, 2010
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionintNumber of queues MContains the multiplicities for each queueContains total number of jobs for each classintNumber of classes Rstatic final Stringdouble[]Contains the mean delays (think time) for each class -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new QNModel object and initialises in according to the given arguments.QNModel(int R, int M, int[] T, Integer[] N, double[] Z, Integer[] multiplicities, double[][] D, int[] C) Creates a new QNModel object and initialises in according to the given arguments.Creates a new QNModel object and initialises it according to an input file.Copy constructor which creates a new QNModel object and initialises it according to an existing QNModel. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetDelay(int r) Returns the delay (think time) of a class.getDelayAsBigDecimal(int r) Returns the delay (think time) of a class as a BigDecimal object .getDelayAsBigInteger(int r) Returns the delay (think time) of a class as a BigInteger object .getDelayAsBigRational(int r) Returns the delay (think time) of a class as a BigRational object .doublegetDemand(int k, int r) Returns the service demand of a class at a queue.getDemandAsBigDecimal(int k, int r) Returns the service demand of a class at a queue as a BigDecimal object.getDemandAsBigInteger(int k, int r) Returns the service demand of a class at a queue as a BigInteger object.getDemandAsBigRational(int k, int r) Returns the service demand of a class at a queue as a BigRational object.getMaxG()Returns the maximum possible normalising constant of the queueing network.doubleReturns the maximum value of the queueing network model.BigRational[][]Returns the computed mean queue lengths Q of the current model.double[][]Returns the mean queue lengths as an MxR array of doubles.Returns the computed mean throughputs X of the current model.double[]Returns the mean throughputs as an array of R doubles.This method returns a copy of the current MultiplicitiesVector with the values contained in this QNModel object (quening network model).Returns the computed normalising constant G.intgetNumberOfServers(int m) Returns the number of servers of the station/queue indexed by m.This method returns a copy of the current PopulationVector with the values contained in this QNModel object (quening network model).Returns a string containing the computed normalising constant G.getQueueType(int m) Returns the type of the station/queue indexed by m.booleanhasNoFractionalPart(double d) Checks whether a double has a zero fractional part, i.e.voidPrints out model and model solutions in easily readable format.voidPrints the parsed data of the current QNModel object.voidAdded by Jack Bradshaw Prints the preformance measures computed for the model.voidsetM(int m) voidsetN(int n2) voidStores the normalising constant (G) in the model description object (QNModel).voidsetPerformanceMeasures(BigRational[][] Q, BigRational[] X) Stores the performance measures (mean throughputs X and mean queue lengths Q) in the model description object (QNModel).voidsetR(int r) voidWrites the current QNModel to a file so it can be reused in the future.
-
Field Details
-
R
public int RNumber of classes R -
M
public int MNumber of queues M -
N
Contains total number of jobs for each class -
Z
public double[] ZContains the mean delays (think time) for each class -
multiplicities
Contains the multiplicities for each queue -
TempFileName
- See Also:
-
-
Constructor Details
-
QNModel
Creates a new QNModel object and initialises it according to an input file.- Parameters:
filename- The path to the input file- Throws:
InputFileParserException- An exception is thrown if any error is encountered during input file parsing
-
QNModel
public QNModel(int R, int M, int[] T, Integer[] N, double[] Z, Integer[] multiplicities, double[][] D) throws InternalErrorException Creates a new QNModel object and initialises in according to the given arguments.- Parameters:
R- The number of classesM- The number of queuesT- The type of each queueN- The array containing the population per classZ- The array containing the total delay per classmultiplicities- The array containing the queue multiplicitiesD- The array containing the service demands- Throws:
InternalErrorException- Thrown if the arguments' sizes do not match.
-
QNModel
public QNModel(int R, int M, int[] T, Integer[] N, double[] Z, Integer[] multiplicities, double[][] D, int[] C) throws InternalErrorException Creates a new QNModel object and initialises in according to the given arguments.- Parameters:
R- The number of classesM- The number of queuesT- The type of each queueN- The array containing the population per classZ- The array containing the total delay per classmultiplicities- The array containing the queue multiplicitiesD- The array containing the service demandsC- The number of servers of each queue- Throws:
InternalErrorException- Thrown if the arguments' sizes do not match.
-
QNModel
Copy constructor which creates a new QNModel object and initialises it according to an existing QNModel.- Parameters:
qnm- The QNModel to copy from.
-
-
Method Details
-
getDemand
public double getDemand(int k, int r) Returns the service demand of a class at a queue. Indices start from 0.- Parameters:
k- Queue indexr- Class index- Returns:
- The corresponding service demand
-
getDemandAsBigDecimal
Returns the service demand of a class at a queue as a BigDecimal object. Indices start from 0.- Parameters:
k- Queue indexr- Class index- Returns:
- The corresponding service demand
-
getDemandAsBigInteger
Returns the service demand of a class at a queue as a BigInteger object. Indices start from 0.- Parameters:
k- Queue indexr- Class index- Returns:
- The corresponding service demand
-
getDemandAsBigRational
Returns the service demand of a class at a queue as a BigRational object. Indices start from 0.- Parameters:
k- Queue indexr- Class index- Returns:
- The corresponding service demand
-
getDelay
public double getDelay(int r) Returns the delay (think time) of a class. Indices start from 0.- Parameters:
r- Class index- Returns:
- The corresponding delay (think time)
-
getDelayAsBigDecimal
Returns the delay (think time) of a class as a BigDecimal object . Indices start from 0.- Parameters:
r- Class index- Returns:
- The corresponding delay (think time)
-
getDelayAsBigInteger
Returns the delay (think time) of a class as a BigInteger object . Indices start from 0.- Parameters:
r- Class index- Returns:
- The corresponding delay (think time)
-
getDelayAsBigRational
Returns the delay (think time) of a class as a BigRational object . Indices start from 0.- Parameters:
r- Class index- Returns:
- The corresponding delay (think time)
-
getQueueType
Returns the type of the station/queue indexed by m.- Parameters:
m- The index of the station/queue to get the type for.- Returns:
- The type of the station/queue m.
-
getNumberOfServers
public int getNumberOfServers(int m) Returns the number of servers of the station/queue indexed by m.- Parameters:
m- The index of the station/queue to get the number of servers for.- Returns:
- The number of servers of the station/queue m.
-
writeToFile
public void writeToFile()Writes the current QNModel to a file so it can be reused in the future. -
printModel
public void printModel()Prints the parsed data of the current QNModel object. -
prettyPrint
public void prettyPrint()Prints out model and model solutions in easily readable format. -
setPerformanceMeasures
public void setPerformanceMeasures(BigRational[][] Q, BigRational[] X) throws InternalErrorException Stores the performance measures (mean throughputs X and mean queue lengths Q) in the model description object (QNModel). The function can only be used once.- Parameters:
Q- Mean queue lengths matrixX- Mean throughputs matrix- Throws:
InternalErrorException- Thrown on attempt to re-assign performance measures
-
setNormalisingConstant
Stores the normalising constant (G) in the model description object (QNModel). The function can only be used once.- Parameters:
G- The normalising constant- Throws:
InternalErrorException- Thrown on attempt to re-assign performance measures
-
getPrettyNormalisingConstant
Returns a string containing the computed normalising constant G.- Returns:
- A string containing the computed normalising constant G
-
getNormalisingConstant
Returns the computed normalising constant G.- Returns:
- The computed normalising constant G
-
getMeanThroughputs
Returns the computed mean throughputs X of the current model.- Returns:
- The computed mean throughputs X
-
getMeanQueueLengths
Returns the computed mean queue lengths Q of the current model.- Returns:
- The computed mean queue lengths Q
-
getMaxG
Returns the maximum possible normalising constant of the queueing network.- Returns:
- The maximum value as a BigInteger object
- Throws:
OperationNotSupportedException- Thrown if the maximum normalising constant cannot be computed
-
getMaxModelValue
Returns the maximum value of the queueing network model.- Returns:
- The maximum value
- Throws:
OperationNotSupportedException- Thrown if the maximum value cannot be computed
-
hasNoFractionalPart
public boolean hasNoFractionalPart(double d) Checks whether a double has a zero fractional part, i.e. it represents an integer number.- Parameters:
d- The number to check- Returns:
- True if it is an integer, false otherwise
-
getMultiplicitiesVector
This method returns a copy of the current MultiplicitiesVector with the values contained in this QNModel object (quening network model).- Returns:
- The MultiplicitiesVector object
-
getPopulationVector
This method returns a copy of the current PopulationVector with the values contained in this QNModel object (quening network model).- Returns:
- The PopulationVector object
-
getMeanQueueLengthsAsDoubles
public double[][] getMeanQueueLengthsAsDoubles()Returns the mean queue lengths as an MxR array of doubles.- Returns:
- The double[M][R] array.
-
getMeanThroughputsAsDoubles
public double[] getMeanThroughputsAsDoubles()Returns the mean throughputs as an array of R doubles.- Returns:
- The double[R] array.
-
printPerformanceMeasures
public void printPerformanceMeasures()Added by Jack Bradshaw Prints the preformance measures computed for the model. -
setM
public void setM(int m) -
setR
public void setR(int r) -
setN
public void setN(int n2)
-