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 Summary
ConstructorsConstructorDescriptionPrecomputedCDFunction(int numClasses) Creates a new pre-computed class dependence function with default value of 1.0.PrecomputedCDFunction(int numClasses, double defaultValue) Creates a new pre-computed class dependence function. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValue(int[] state, double value) Adds a pre-computed value for a specific state given as an array.voidAdds a pre-computed value for a specific state.Applies the function to the given state.intGets the number of classes.intsize()Gets the number of pre-computed values stored.toString()
-
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 modeldefaultValue- 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
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 integersvalue- the function value for this state
-
apply
Applies the function to the given state. -
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
-