Package edu.cmu.tetrad.search.utils
Class RandomMonotonicPiecewiseLinear
java.lang.Object
edu.cmu.tetrad.search.utils.RandomMonotonicPiecewiseLinear
A class that generates and evaluates a monotonic piecewise linear function defined over a specified domain and range.
The y-values of the function are randomly generated while ensuring monotonicity. The function supports both
interpolation within the range and extrapolation outside the range.
-
Constructor Summary
ConstructorsConstructorDescriptionRandomMonotonicPiecewiseLinear(int numPoints, double xMin, double xMax, double yMin, double yMax) Constructor to initialize a monotonic piecewise linear function. -
Method Summary
Modifier and TypeMethodDescriptiondoublecomputeValue(double x) Compute the value of the monotonic piecewise linear function at a given x.static voidThe main method serves as the entry point for testing the functionality of the RandomMonotonicPiecewiseLinear class.
-
Constructor Details
-
RandomMonotonicPiecewiseLinear
public RandomMonotonicPiecewiseLinear(int numPoints, double xMin, double xMax, double yMin, double yMax) Constructor to initialize a monotonic piecewise linear function.- Parameters:
numPoints- Number of points for the piecewise linear function.xMin- Minimum x-value for the domain.xMax- Maximum x-value for the domain.yMin- Minimum y-value for the range.yMax- Maximum y-value for the range.
-
-
Method Details
-
main
The main method serves as the entry point for testing the functionality of the RandomMonotonicPiecewiseLinear class. It initializes parameters for creating an instance of the class, generates a monotonic piecewise linear function, and evaluates the function over a specified range of x-values.- Parameters:
args- Command-line arguments passed to the program. Not used in this method.
-
computeValue
public double computeValue(double x) Compute the value of the monotonic piecewise linear function at a given x.- Parameters:
x- The x-value where the function is evaluated.- Returns:
- The interpolated y-value.
-