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.
-
-
Field Summary
Fields Modifier and Type Field Description public final intnumClasses
-
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.
-
Method Summary
Modifier and Type Method Description intgetNumClasses()Gets the number of classes. voidaddValue(Matrix state, double value)Adds a pre-computed value for a specific state. voidaddValue(Array<int> state, double value)Adds a pre-computed value for a specific state given as an array. Doubleapply(Matrix ni)Applies the function to the given state. intsize()Gets the number of pre-computed values stored. StringtoString()-
-
Constructor Detail
-
PrecomputedCDFunction
PrecomputedCDFunction(int numClasses, double defaultValue)
Creates a new pre-computed class dependence function.- Parameters:
numClasses- the number of classes in the modeldefaultValue- 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 integersvalue- 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
-
-
-
-