Samples

The syntax for sampling in an interval or region is the following:

sample(n,lb,ub,S::SamplingAlgorithm)

where lb and ub are, respectively, the lower and upper bounds. There are many sampling algorithms to choose from:

  • Grid sample
  • Uniform sample
Surrogates.sampleMethod

sample(n,lb,ub,::UniformRandom)

Returns a Tuple containing uniform random numbers.

source
  • Sobol sample
  • Latin Hypercube sample
Surrogates.sampleMethod

sample(n,lb,ub,::LatinHypercube)

Returns a Tuple containing LatinHypercube sequences.

source
  • Low Discrepancy sample
Surrogates.sampleMethod

sample(n,lb,ub,S::LowDiscrepancySample)

Low discrepancy sample:

  • Dimension 1: Van der Corput sequence
  • Dimension > 1: Halton sequence

If dimension d > 1, all bases must be coprime with each other.

source

Adding a new sampling method

Adding a new sampling method is a two- step process:

  1. Adding a new SamplingAlgorithm type
  2. Overloading the sample function with the new type.

Example

struct NewAmazingSamplingAlgorithm{OPTIONAL} <: SamplingAlgorithm end

function sample(n,lb,ub,::NewAmazingSamplingAlgorithm)
    if lb is  Number
        ...
        return x
    else
        ...
        return Tuple.(x)
    end
end