Individuals are mutated with an independent normal random variable on each component.
sdev
:: numeric
Standard deviation of normal distribuion. This is absolute if sdev_is_relative
is FALSE
, and
multiplied with each individual component's range (upper - lower) if sdev_is_relative
is TRUE
.
This may either be a scalar, in which case it is applied to all input components, or a vector,
in which case it must have the length of the input and applies to components in order in which
they appear in the priming ParamSet
. Must be set by the user.
sdev_is_relative
:: logical(1)
Whether sdev
is absolute (FALSE
) or relative to component range (TRUE
). Initialized to FALSE
.
truncated_normal
:: logical(1)
Whether to draw individuals from a normal distribution that is truncated at the bounds of each
component (TRUE
), or to draw from a normal distribution and then restrict to bounds afterwards
(FALSE
). The former (TRUE
) will lead to very few to no samples landing on the exact bounds
(analytically it would be none almost surely, but this is subject to machine precision), the latter
(FALSE
) can lead to a substantial number of samples landing on the exact bounds. Initialized to FALSE
.
This Mutator
can be created with the short access form mut()
(muts()
to get a list), or through the the dictionary
dict_mutators
in the following way:
miesmuschel::MiesOperator
-> miesmuschel::Mutator
-> miesmuschel::MutatorNumeric
-> MutatorGauss
set.seed(1)
mg = mut("gauss", sdev = 0.1)
p = ps(x = p_int(-5, 5), y = p_dbl(-5, 5))
data = data.frame(x = rep(0, 5), y = rep(0, 5))
mg$prime(p)
mg$operate(data)
#> x y
#> 1 -1 0.1836433
#> 2 -1 1.5952808
#> 3 0 -0.8204684
#> 4 1 0.7383247
#> 5 1 -0.3053884
mg$param_set$values$sdev = 100
mg$operate(data)
#> x y
#> 1 5 5
#> 2 -5 -5
#> 3 5 -5
#> 4 -5 5
#> 5 5 5