Class RandomMonotonicPiecewiseLinear

java.lang.Object
edu.cmu.tetrad.search.utils.RandomMonotonicPiecewiseLinear

public class RandomMonotonicPiecewiseLinear extends Object
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

    Constructors
    Constructor
    Description
    RandomMonotonicPiecewiseLinear(int numPoints, double xMin, double xMax, double yMin, double yMax)
    Constructor to initialize a monotonic piecewise linear function.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    computeValue(double x)
    Compute the value of the monotonic piecewise linear function at a given x.
    static void
    main(String[] args)
    The main method serves as the entry point for testing the functionality of the RandomMonotonicPiecewiseLinear class.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static void main(String[] args)
      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.