Package jline.util

Class PrecomputedRateFunction

java.lang.Object
jline.util.PrecomputedTableFunction
jline.util.PrecomputedRateFunction
All Implemented Interfaces:
Serializable, Function<Matrix,Double>, SerializableFunction<Matrix,Double>

public class PrecomputedRateFunction extends PrecomputedTableFunction implements SerializableFunction<Matrix,Double>, Serializable
A pre-computed scalar rate function that stores function values for all possible state combinations.

This class is used to convert the MATLAB mu(c) handle of a pass-and-swap (PAS) or order-independent (OI) queue to Java, by pre-computing the rate over every ordered class sequence in MATLAB and storing it in a lookup table (see PrecomputedTableFunction). The state c is the ordered list of 0-based class indices, keyed as "c1,c2,...,cp".

Unlike the dimensionless class dependence of PrecomputedCDFunction, mu(c) is a total service RATE and is consumed as a scalar (QueueNodeParam.svcRateFun), hence the Double return type.

See Also:
  • Constructor Details

    • PrecomputedRateFunction

      public PrecomputedRateFunction(int numClasses, double defaultValue)
      Creates a new pre-computed rate function.
      Parameters:
      numClasses - the number of classes in the model
      defaultValue - the default rate to return when a state is not found
    • PrecomputedRateFunction

      public PrecomputedRateFunction(int numClasses)
      Creates a new pre-computed rate function defaulting to a zero rate on states absent from the table.
      Parameters:
      numClasses - the number of classes in the model
  • Method Details

    • apply

      public Double apply(Matrix c)
      Applies the rate function to the given ordered class sequence.
      Specified by:
      apply in interface Function<Matrix,Double>
      Parameters:
      c - the ordered list of 0-based class indices as a row Matrix
      Returns:
      the pre-computed total service rate, or the default if not found