dict_recombinators_cmpmaybe {miesmuschel} | R Documentation |
Recombinator Choosing Action Component-Wise Independently
Description
Recombinator
that chooses which operation to perform probabilistically and independently for each component.
The Recombinator
wraps two other Recombinator
s given during construction,
and both of these operators are run. The ultimate result is sampled from the results of these operations independently for each individuum
and component: with probability p
(configuration parameter), the result from the Recombinator
given to
the recombinator
construction argument is used, and with probability p - 1
the one given to recombinator_not
is used.
The values of $n_indivs_in
and $n_indivs_out
is set to the corresponding values of the wrapped Recombinator
s. Both recombinator
and recombinator_not
must currently have the same respective $n_indivs_in
and $n_indivs_out
values.
Configuration Parameters
This operator has the configuration parameters of the Recombinator
s that it wraps: The configuration parameters of the operator given to the recombinator
construction argument
are prefixed with "cmpmaybe."
, the configuration parameters of the operator given to the recombinator_not
construction argument are prefixed with "cmpmaybe_not."
.
Additional configuration parameters:
-
p
::numeric(1)
Probability per component with which to use the result of applying the operator given to therecombinator
construction argument. Must be set by the user.
Supported Operand Types
Supported Domain
classes are the set intersection of supported classes of recombinator
and recombinator_not
.
Dictionary
This Recombinator
can be created with the short access form rec()
(recs()
to get a list), or through the the dictionary
dict_recombinators
in the following way:
# preferred: rec("cmpmaybe", <recombinator> [, <recombinator_not>]) recs("cmpmaybe", <recombinator> [, <recombinator_not>]) # takes vector IDs, returns list of Recombinators # long form: dict_recombinators$get("cmpmaybe", <recombinator> [, <recombinator_not>])
Super classes
miesmuschel::MiesOperator
-> miesmuschel::Recombinator
-> RecombinatorCmpMaybe
Active bindings
recombinator
(
Recombinator
)
Recombinator
being wrapped. This operator gets run with probabilityp
(configuration parameter).recombinator_not
(
Recombinator
)
AlternativeRecombinator
being wrapped. This operator gets run with probability1 - p
(configuration parameter).
Methods
Public methods
Inherited methods
Method new()
Initialize the RecombinatorCmpMaybe
object.
Usage
RecombinatorCmpMaybe$new(recombinator, recombinator_not = NULL)
Arguments
recombinator
(
Recombinator
)
Recombinator
to wrap. Component-wise results of this operator are used with probabilityp
(Configuration parameter).
The constructed object gets a clone of this argument. The$recombinator
field will reflect this value.recombinator_not
(
Recombinator
)
AnotherRecombinator
to wrap. Results from this operator are used whenrecombinator
is not chosen. By default, this isRecombinatorNull
, i.e. no operation, with bothn_indivs_in
andn_indivs_out
set to matchrecombinator
. This does not work whenrecombinator
hasn_indivs_in < n_indivs_out
, in which case this argument must be set explicitly.
With this default, theRecombinatorCmpMaybe
object applies therecombinator
operation with probabilityp
, and no operation at all otherwise.
The constructed object gets a clone of this argument. The$recombinator_not
field will reflect this value.
Method prime()
See MiesOperator
method. Primes both this operator, as well as the wrapped operators
given to recombinator
and recombinator_not
during construction.
Usage
RecombinatorCmpMaybe$prime(param_set)
Arguments
param_set
(
ParamSet
)
Passed toMiesOperator
$prime()
.
Returns
invisible self
.
Method clone()
The objects of this class are cloneable with this method.
Usage
RecombinatorCmpMaybe$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other recombinators:
OperatorCombination
,
Recombinator
,
RecombinatorPair
,
dict_recombinators_convex
,
dict_recombinators_cvxpair
,
dict_recombinators_maybe
,
dict_recombinators_null
,
dict_recombinators_proxy
,
dict_recombinators_sbx
,
dict_recombinators_sequential
,
dict_recombinators_swap
,
dict_recombinators_xonary
,
dict_recombinators_xounif
Other recombinator wrappers:
OperatorCombination
,
dict_recombinators_maybe
,
dict_recombinators_proxy
,
dict_recombinators_sequential
Examples
set.seed(1)
rm = rec("cmpmaybe", rec("swap"), p = 0.5)
p = ps(x = p_int(1, 8), y = p_dbl(1, 8), z = p_lgl())
data = data.frame(x = 1:8, y = 1:8, z = rep(TRUE, 4))
rm$prime(p)
rm$operate(data)
rm$param_set$values$p = 0.3
rm$operate(data)
# equivalent to rec("cmpmaybe", rec("swap", keep_complement = FALSE), p = 0.7)
rm2 = rec("cmpmaybe",
recombinator = rec("null", 2, 1),
recombinator_not = rec("swap", keep_complement = FALSE),
p = 0.3
)
rm2$prime(p)
rm2$operate(data)