Recombinator that wraps multiple other Recombinators given during construction and uses them for mutation in sequence.
When subsequent Recombinators 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.
This operator has the configuration parameters of the Recombinators 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 reorder values between invocations of recombinators. Initialized to TRUE.
Supported Domain classes are the set intersection of supported classes of the Recombinators given in recombinators.
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>)
miesmuschel::MiesOperator -> miesmuschel::Recombinator -> RecombinatorSequential
recombinators(list of Recombinator)
Recombinators being wrapped. These operators get run sequentially in order.
allow_lcm_packing(logical(1))
Whether to allow lowest common multiple packing.
new()Initialize the RecombinatorSequential object.
RecombinatorSequential$new(recombinators, allow_lcm_packing = FALSE)recombinators(list of Recombinator)
Recombinators to wrap. The operations are run in order given to recombinators.
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. Default FALSE.
The $allow_lcm_packing field will reflect this value.
prime()See MiesOperator method. Primes both this operator, as well as the wrapped operators
given to recombinator and recombinator_not during construction.
RecombinatorSequential$prime(param_set)param_set(ParamSet)
Passed to MiesOperator$prime().
invisible self.
clone()The objects of this class are cloneable with this method.
RecombinatorSequential$clone(deep = FALSE)deepWhether to make a deep clone.
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
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)
Run the code above in your browser using DataLab