Package jline.util

Class PrecomputedCDFunction

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

public class PrecomputedCDFunction extends Object implements SerializableFunction<Matrix,Double>, Serializable
A pre-computed class dependence function that stores function values for all possible state combinations.

This class is used to convert MATLAB function handles to Java by pre-computing all possible function values in MATLAB and storing them in a lookup table. When the function is called in Java, it looks up the pre-computed value.

The state is represented as a string key of the form "n1,n2,...,nR" where n_r is the number of jobs of class r at the station.

See Also:
  • Constructor Details

    • PrecomputedCDFunction

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

      public PrecomputedCDFunction(int numClasses)
      Creates a new pre-computed class dependence function with default value of 1.0.
      Parameters:
      numClasses - the number of classes in the model
  • Method Details

    • addValue

      public void addValue(Matrix state, double value)
      Adds a pre-computed value for a specific state.
      Parameters:
      state - the state vector as a Matrix (1 x numClasses)
      value - the function value for this state
    • addValue

      public void addValue(int[] state, double value)
      Adds a pre-computed value for a specific state given as an array.
      Parameters:
      state - the state as an array of integers
      value - the function value for this state
    • apply

      public Double apply(Matrix ni)
      Applies the function to the given state.
      Specified by:
      apply in interface Function<Matrix,Double>
      Parameters:
      ni - the state vector as a Matrix (1 x numClasses or numClasses x 1)
      Returns:
      the pre-computed function value, or the default value if not found
    • size

      public int size()
      Gets the number of pre-computed values stored.
      Returns:
      the number of pre-computed values
    • getNumClasses

      public int getNumClasses()
      Gets the number of classes.
      Returns:
      the number of classes
    • toString

      public String toString()
      Overrides:
      toString in class Object