Package jline.util

Class PrecomputedCDFunction

  • All Implemented Interfaces:
    java.io.Serializable , java.util.function.Function , jline.util.SerializableFunction

    
    public class PrecomputedCDFunction
     implements SerializableFunction<T, U>, 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final int numClasses
    • Constructor Summary

      Constructors 
      Constructor Description
      PrecomputedCDFunction(int numClasses, double defaultValue) Creates a new pre-computed class dependence function.
      PrecomputedCDFunction(int numClasses) Creates a new pre-computed class dependence function with default value of 1.0.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      int getNumClasses() Gets the number of classes.
      void addValue(Matrix state, double value) Adds a pre-computed value for a specific state.
      void addValue(Array<int> state, double value) Adds a pre-computed value for a specific state given as an array.
      Double apply(Matrix ni) Applies the function to the given state.
      int size() Gets the number of pre-computed values stored.
      String toString()
      • Methods inherited from class java.util.function.Function

        andThen, compose, identity
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrecomputedCDFunction

        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

        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 Detail

      • getNumClasses

         int getNumClasses()

        Gets the number of classes.

        Returns:

        the number of classes

      • addValue

         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

         void addValue(Array<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

         Double apply(Matrix ni)

        Applies the function to the given state.

        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

         int size()

        Gets the number of pre-computed values stored.

        Returns:

        the number of pre-computed values