Null-recombinator that does not perform any operation on its input. Useful in particular with operator-wrappers such as RecombinatorMaybe
or
RecombinatorCombination
.
n_indivs_in
and n_indivs_out
can be set during construction, where n_indivs_out
must be less or equal n_indivs_in
. If it is strictly less,
then the operation returns only the first n_indivs_out
individuals out of each n_indivs_in
sized group.
This operator has no configuration parameters.
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:
Other recombinators:
OperatorCombination
,
Recombinator
,
RecombinatorPair
,
dict_recombinators_cmpmaybe
,
dict_recombinators_convex
,
dict_recombinators_cvxpair
,
dict_recombinators_maybe
,
dict_recombinators_proxy
,
dict_recombinators_sbx
,
dict_recombinators_sequential
,
dict_recombinators_swap
,
dict_recombinators_xonary
,
dict_recombinators_xounif
miesmuschel::MiesOperator
-> miesmuschel::Recombinator
-> RecombinatorNull
new()
Initialize base class components of the Recombinator
.
RecombinatorNull$new(n_indivs_in = 1, n_indivs_out = n_indivs_in)
n_indivs_in
(integer(1)
)
Number of individuals to consider at the same time. When operating, the number of input individuals must be divisible by this number.
Setting this number to a number unequal 1 is mostly useful when incorporating this operator in wrappers such as RecombinatorMaybe
or
RecombinatorCombination
.
Default 1.
The $n_indivs_in
field will reflect this value.
n_indivs_out
(integer(1)
)
Number of individuals that result for each n_indivs_in
lines of input. Must be at most n_indivs_in
. If this is less than n_indivs_in
,
then only the first n_indivs_out
individuals out of each n_indivs_in
sized group are returned by an operation.
Setting this number to a number unequal 1 is mostly useful when incorporating this operator in wrappers such as RecombinatorMaybe
or
RecombinatorCombination
.
Default equal to n_indivs_in
.
The $n_indivs_out
field will reflect this value.
rn = rec("null")
p = ps(x = p_int(-5, 5), y = p_dbl(-5, 5), z = p_lgl())
data = data.frame(x = 1:4, y = 0:3, z = rep(TRUE, 4))
rn$prime(p)
rn$operate(data)
#> x y z
#> 1 1 0 TRUE
#> 2 2 1 TRUE
#> 3 3 2 TRUE
#> 4 4 3 TRUE
rn_half = rec("null", n_indivs_in = 2, n_indivs_out = 1)
rn_half$prime(p)
rn_half$operate(data)
#> x y z
#> 1 1 0 TRUE
#> 2 3 2 TRUE