R/MutatorProxy.R
dict_mutators_proxy.Rd
Mutator that performs the operation in its operation
configuration parameter. This is useful, e.g., to make
OptimizerMies
's mutation operation fully parametrizable.
operation
:: Mutator
Operation to perform. Must be set by the user.
This is primed when $prime()
of MutatorProxy
is called, and also when $operate()
is called, to make changing
the operation as part of self-adaption possible. However, if the same operation gets used inside multiple MutatorProxy
objects, then it is recommended to $clone(deep = TRUE)
the object before assigning them to operation
to avoid
frequent re-priming.
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:
Other mutators:
Mutator
,
MutatorDiscrete
,
MutatorNumeric
,
OperatorCombination
,
dict_mutators_cmpmaybe
,
dict_mutators_erase
,
dict_mutators_gauss
,
dict_mutators_maybe
,
dict_mutators_null
,
dict_mutators_sequential
,
dict_mutators_unif
Other mutator wrappers:
OperatorCombination
,
dict_mutators_cmpmaybe
,
dict_mutators_maybe
,
dict_mutators_sequential
miesmuschel::MiesOperator
-> miesmuschel::Mutator
-> MutatorProxy
prime()
See MiesOperator
method. Primes both this operator, as well as the operator given to the operation
configuration parameter.
Note that this modifies the $param_set$values$operation
object.
param_set
(ParamSet
)
Passed to MiesOperator
$prime()
.
invisible self
.
set.seed(1)
mp = mut("proxy", operation = 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))
mp$prime(p)
mp$operate(data)
#> x y
#> 1 -1 0.1836433
#> 2 -1 1.5952808
#> 3 0 -0.8204684
#> 4 1 0.7383247
#> 5 1 -0.3053884
mp$param_set$values$operation = mut("null")
mp$operate(data)
#> x y
#> 1 0 0
#> 2 0 0
#> 3 0 0
#> 4 0 0
#> 5 0 0