dict_recombinators_sequential {miesmuschel} | R Documentation |
Run Multiple Recombinator Operations in Sequence
Description
Recombinator
that wraps multiple other Recombinator
s given during construction and uses them for mutation in sequence.
When subsequent Recombinator
s have mismatching n_indivs_out
/ n_indivs_in
, then RecombinatorSequential
tries to
match them by running them multiple times. If e.g. recombinators[[1]]$n_indivs_out
is 2 and recombinators[[2]]$n_indivs_in
is 1, then
recombinators[[2]]
is run twice, once for each output of recombinators[[1]]
.
When the allow_lcm_packing
argument is FALSE
, then an error is given if neither n_indivs_out
of a Recombinator
divides n_indivs_in
of the
following Recombinator
, nor n_indivs_in
of the latter divides n_indivs_out
of the former even when considering that the former is run multiple times.
If allow_lcm_packing
is TRUE
, then both recombinators are run multiple times, according to the lowest common multiple ("lcm")
of the two.
However, allow_lcm_packing
can lead to very large values of n_indivs_in
/ n_indivs_out
, so it may instead be preferred to add RecombinatorNull
objects
with fitting n_indivs_in
/ n_indivs_out
values to match subsequent recombinators.
Configuration Parameters
This operator has the configuration parameters of the Recombinator
s that it wraps: The configuration parameters of the operator given to the recombinators
construction
argument are prefixed with "recombinator_1"
, "recombinator_2"
, ... up to "recombinator_#"
, where #
is length(recombinators)
.
Additional configuration parameters:
-
shuffle_between
::logical(1)
Whether to reordervalues
between invocations of recombinators. Initialized toTRUE
.
Supported Operand Types
Supported Domain
classes are the set intersection of supported classes of the Recombinator
s given in recombinators
.
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("sequential", <recombinators>) recs("sequential", <recombinators>) # takes vector IDs, returns list of Recombinators # long form: dict_recombinators$get("sequential", <recombinators>)
Super classes
miesmuschel::MiesOperator
-> miesmuschel::Recombinator
-> RecombinatorSequential
Active bindings
recombinators
(
list
ofRecombinator
)
Recombinator
s being wrapped. These operators get run sequentially in order.allow_lcm_packing
(
logical(1)
)
Whether to allow lowest common multiple packing.
Methods
Public methods
Inherited methods
Method new()
Initialize the RecombinatorSequential
object.
Usage
RecombinatorSequential$new(recombinators, allow_lcm_packing = FALSE)
Arguments
recombinators
(
list
ofRecombinator
)
Recombinator
s to wrap. The operations are run in order given torecombinators
. The constructed object gets a clone of this argument. The$recombinators
field will reflect this value.allow_lcm_packing
(
logical(1)
)
Whether to allow lowest common multiple packing. DefaultFALSE
. The$allow_lcm_packing
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
RecombinatorSequential$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
RecombinatorSequential$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Other recombinators:
OperatorCombination
,
Recombinator
,
RecombinatorPair
,
dict_recombinators_cmpmaybe
,
dict_recombinators_convex
,
dict_recombinators_cvxpair
,
dict_recombinators_maybe
,
dict_recombinators_null
,
dict_recombinators_proxy
,
dict_recombinators_sbx
,
dict_recombinators_swap
,
dict_recombinators_xonary
,
dict_recombinators_xounif
Other recombinator wrappers:
OperatorCombination
,
dict_recombinators_cmpmaybe
,
dict_recombinators_maybe
,
dict_recombinators_proxy
Examples
set.seed(1)
ds = data.frame(a = c(0, 1), b = c(0, 1))
p = ps(a = p_dbl(0, 1), b = p_dbl(0, 1))
convex = rec("cvxpair", lambda = 0.7)
swap = rec("swap")
convex_then_swap = rec("sequential", list(convex, swap))
ds
convex$prime(p)$operate(ds)
swap$prime(p)$operate(ds)
convex_then_swap$prime(p)$operate(ds)