setup_genz_function

pyapprox.benchmarks.setup_genz_function(nvars, test_name, coeff_type=None, w=0.25, c_factor=1, coeff=None)[source]

Setup one of the six Genz integration benchmarks fd(x):RDR, where x=[x1,,xD]. The number of inputs D and the anisotropy (relative importance of each variable and interactions) of the functions can be adjusted. The definition of each function is in the Notes section.

For example, the two-dimensional oscillatory Genz problem can be defined using

>>> from pyapprox.benchmarks.benchmarks import setup_benchmark
>>> benchmark=setup_benchmark('genz',nvars=2,test_name='oscillatory')
>>> print(benchmark.keys())
dict_keys(['fun', 'mean', 'variable'])
Parameters:
nvarsinteger

The number of variables of the Genz function

test_namestring

The test_name of the specific Genz function. See notes for options the string needed is given in brackets e.g. (‘oscillatory’). Choose from [“oscillatory”, “product_peak”, “corner_peak”, “c0continuous”, “discontinuous”]

coef_typestring

Choose from [“no_decay”, “quadratic_decay”, “quartic_decay”, “exponential_decay”. “squared_exponential_decay”]

wfloat 0<=w<=1

Set wd=w,d=1,,D.

c_factorfloat c_factor>0

Scale the integrand.

coefftuple (ndarray (nvars, 1), ndarray (nvars, 1))

The coefficients cd and wd If provided it will overwite the coefficients defined by coeff_type, w and c_factor

Returns:
benchmarkpyapprox.benchmarks.Benchmark

Object containing the benchmark attributes

funcallable

The function being analyzed

variableJointVariable

Class containing information about each of the nvars inputs to fun

mean: np.ndarray (nvars)

The mean of the function with respect to the PDF of var

Notes

The six Genz test function are:

Oscillatory (‘oscillatory’)

f(z)=cos(2πw1+d=1Dcdzd)

Product Peak (‘product_peak’)

f(z)=d=1D(cd2+(zdwd)2)1

Corner Peak (‘corner_peak’)

f(z)=(1+d=1Dcdzd)(D+1)

Gaussian Peak (‘gaussian’)

f(z)=exp(d=1Dcd2(zdwd)2)

C0 Continuous (‘c0continuous’)

f(z)=exp(d=1Dcd|zdwd|)

Discontinuous (‘discontinuous’)

f(z)={0z1>w1orz2>w2exp(d=1Dcdzd)otherwise

Increasing c will in general make the integrands more difficult.

The 0wd1 parameters do not affect the difficulty of the integration problem. We set w1=w2==WD.

The coefficient types implement different decay rates for cd. This allows testing of methods that can identify and exploit anisotropy. They are as follows:

No decay (none)

c^d=d+0.5D

Quadratic decay (qudratic)

c^d=1(D+1)2

Quartic decay (quartic)

c^d=1(D+1)4

Exponential decay (exp)

c^d=exp(log(cmin)d+1D)

Squared-exponential decay (sqexp)

c^d=10(log10(cmin)(d+1)2D)

Here cmin is argument that sets the minimum value of cD.

Once the formula are used the coefficients are normalized such that

cd=cfactorc^dd=1Dc^d.

References