Class QNModel

java.lang.Object
solvers.dataStructures.QNModel

public class QNModel extends Object
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
  • Field Details

    • R

      public int R
      Number of classes R
    • M

      public int M
      Number of queues M
    • N

      public PopulationVector N
      Contains total number of jobs for each class
    • Z

      public double[] Z
      Contains the mean delays (think time) for each class
    • multiplicities

      public MultiplicitiesVector multiplicities
      Contains the multiplicities for each queue
    • TempFileName

      public static final String TempFileName
      See Also:
  • Constructor Details

    • QNModel

      public QNModel(String filename) throws InputFileParserException
      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 classes
      M - The number of queues
      T - The type of each queue
      N - The array containing the population per class
      Z - The array containing the total delay per class
      multiplicities - The array containing the queue multiplicities
      D - 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 classes
      M - The number of queues
      T - The type of each queue
      N - The array containing the population per class
      Z - The array containing the total delay per class
      multiplicities - The array containing the queue multiplicities
      D - The array containing the service demands
      C - The number of servers of each queue
      Throws:
      InternalErrorException - Thrown if the arguments' sizes do not match.
    • QNModel

      public QNModel(QNModel qnm)
      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 index
      r - Class index
      Returns:
      The corresponding service demand
    • getDemandAsBigDecimal

      public BigDecimal getDemandAsBigDecimal(int k, int r)
      Returns the service demand of a class at a queue as a BigDecimal object. Indices start from 0.
      Parameters:
      k - Queue index
      r - Class index
      Returns:
      The corresponding service demand
    • getDemandAsBigInteger

      public BigInteger getDemandAsBigInteger(int k, int r)
      Returns the service demand of a class at a queue as a BigInteger object. Indices start from 0.
      Parameters:
      k - Queue index
      r - Class index
      Returns:
      The corresponding service demand
    • getDemandAsBigRational

      public BigRational getDemandAsBigRational(int k, int r)
      Returns the service demand of a class at a queue as a BigRational object. Indices start from 0.
      Parameters:
      k - Queue index
      r - 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

      public BigDecimal getDelayAsBigDecimal(int r)
      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

      public BigInteger getDelayAsBigInteger(int r)
      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

      public BigRational getDelayAsBigRational(int r)
      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

      public QNModel.QueueType getQueueType(int m)
      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 matrix
      X - Mean throughputs matrix
      Throws:
      InternalErrorException - Thrown on attempt to re-assign performance measures
    • setNormalisingConstant

      public void setNormalisingConstant(BigRational G) throws InternalErrorException
      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

      public String getPrettyNormalisingConstant()
      Returns a string containing the computed normalising constant G.
      Returns:
      A string containing the computed normalising constant G
    • getNormalisingConstant

      public BigRational getNormalisingConstant()
      Returns the computed normalising constant G.
      Returns:
      The computed normalising constant G
    • getMeanThroughputs

      public BigRational[] getMeanThroughputs()
      Returns the computed mean throughputs X of the current model.
      Returns:
      The computed mean throughputs X
    • getMeanQueueLengths

      public BigRational[][] getMeanQueueLengths()
      Returns the computed mean queue lengths Q of the current model.
      Returns:
      The computed mean queue lengths Q
    • getMaxG

      public BigInteger getMaxG() throws OperationNotSupportedException
      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

      public double getMaxModelValue() throws OperationNotSupportedException
      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

      public MultiplicitiesVector 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

      public PopulationVector 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)