dict_mutators_maybe | R Documentation |
Mutator
that chooses which operation to perform probabilistically. The Mutator
wraps two other Mutator
s given during construction,
and for each individuum, the operation to perform is sampled: with probability p
(configuration parameter), the Mutator
given to the mutator
construction argument is applied, and with probability p - 1
the one given to mutator_not
is applied.
This operator has the configuration parameters of the Mutator
s that it wraps: The configuration parameters of the operator given to the mutator
construction argument
are prefixed with "maybe."
, the configuration parameters of the operator given to the mutator_not
construction argument are prefixed with "maybe_not."
.
Additional configuration parameters:
p
:: numeric(1)
Probability per individual with which to apply the operator given to the mutator
construction argument. Must be set by the user.
Supported Domain
classes are the set intersection of supported classes of mutator
and mutator_not
.
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:
# preferred: mut("maybe", <mutator> [, <mutator_not>]) muts("maybe", <mutator> [, <mutator_not>]) # takes vector IDs, returns list of Mutators # long form: dict_mutators$get("maybe", <mutator> [, <mutator_not>])
miesmuschel::MiesOperator
-> miesmuschel::Mutator
-> MutatorMaybe
mutator
(Mutator
)
Mutator
being wrapped. This operator gets run with probability p
(configuration parameter).
mutator_not
(Mutator
)
Alternative Mutator
being wrapped. This operator gets run with probability 1 - p
(configuration parameter).
new()
Initialize the MutatorMaybe
object.
MutatorMaybe$new(mutator, mutator_not = MutatorNull$new())
mutator
(Mutator
)
Mutator
to wrap. This operator gets run with probability p
(configuration parameter).
The constructed object gets a clone of this argument.
The $mutator
field will reflect this value.
mutator_not
(Mutator
)
Another Mutator
to wrap. This operator runs when mutator
is not chosen. By
default, this is MutatorNull
, i.e. no operation. With this default, the
MutatorMaybe
object applies the mutator
operation with probability p
, and
no operation at all otherwise.
The constructed object gets a clone of this argument.
The $mutator_not
field will reflect this value.
prime()
See MiesOperator
method. Primes both this operator, as well as the wrapped operators
given to mutator
and mutator_not
during construction.
MutatorMaybe$prime(param_set)
param_set
(ParamSet
)
Passed to MiesOperator
$prime()
.
invisible self
.
clone()
The objects of this class are cloneable with this method.
MutatorMaybe$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other mutators:
Mutator
,
MutatorDiscrete
,
MutatorNumeric
,
OperatorCombination
,
dict_mutators_cmpmaybe
,
dict_mutators_erase
,
dict_mutators_gauss
,
dict_mutators_null
,
dict_mutators_proxy
,
dict_mutators_sequential
,
dict_mutators_unif
Other mutator wrappers:
OperatorCombination
,
dict_mutators_cmpmaybe
,
dict_mutators_proxy
,
dict_mutators_sequential
set.seed(1)
mm = mut("maybe", mut("gauss", sdev = 5), p = 0.5)
p = ps(x = p_int(-5, 5), y = p_dbl(-5, 5))
data = data.frame(x = rep(0, 5), y = rep(0, 5))
mm$prime(p)
mm$operate(data)
mm$param_set$values$p = 0.3
mm$operate(data)
mm2 = mut("maybe",
mutator = mut("gauss", sdev = 0.01),
mutator_not = mut("gauss", sdev = 10),
p = 0.5
)
mm2$prime(p)
mm2$operate(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.