Uploaded image for project: 'Commons RNG'
  1. Commons RNG
  2. RNG-134

BoxSampler to sampler uniformly from a box (or hyperrectangle)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Implemented
    • 1.4
    • 1.4
    • sampling
    • None

    Description

      Create a sampler to sample uniformly within a hyperrectangle.

      Alternative names for a hyperrectangle are a box or an orthotope. Below I use the term box for simplicity and to match the BallSampler for an n-ball.
       

      public abstract class BoxSampler implements 
              SharedStateSampler<BoxSampler> {
          public static BoxSampler of(double[] a,
                                      double[] b,
                                      UniformRandomProvider rng);
      }
      

      Inputs a and b are the minimum and maximum of the box in each dimension.

      Sampling can be performed using the same method as the LineSampler but using a uniform deviate for each dimension (instead of the same deviate for all dimensions):

      p = a + u * (b - a)
        = a + ub - ua
        = (1 - u)a + ub
      

      This will produce the same results as using an instance of the the ContinuousUniformSampler for each dimension with all samplers using a common RNG.
       

      Attachments

        Issue Links

          Activity

            People

              aherbert Alex Herbert
              aherbert Alex Herbert
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h