dict_recombinators_xonary {miesmuschel} | R Documentation |
N-ary Crossover Recombinator
Description
Values are chosen componentwise independently at random from multiple individuals.
The number of individuals must be determined during construction as n_indivs_in
.
The number of output individuals is always 1, i.e. n_indivs_in
are used to create one output value. When using this
recombinator in a typical EA setting, e.g. with mies_generate_offspring
, it is therefore recommended to use a parent-selector
where the expected quality of selected parents does not depend on the number of parents selected when n_indivs_in
is large:
sel("tournament")
is preferred to sel("best")
.
Configuration Parameters
-
p
::numeric
|matrix
Sampling weights these are normalized to sum to 1 internally. Must either be a vector of lengthn_indivs_in
, or a matrix withn_indivs_in
rows and as many columns as there are components in the values being operated on. Must be non-negative, at least one value per column must be greater than zero, but it is not necessary that they sum to 1.
Initialized torep(1, n_indivs_in)
, i.e. uniform sampling from all individuals being operated on.
Supported Operand Types
Supported Domain
classes are: p_dbl
('ParamDbl')
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("convex") recs("convex") # takes vector IDs, returns list of Recombinators # long form: dict_recombinators$get("convex")
Super classes
miesmuschel::MiesOperator
-> miesmuschel::Recombinator
-> RecombinatorCrossoverNary
Methods
Public methods
Inherited methods
Method new()
Initialize the RecombinatorConvex
object.
Usage
RecombinatorCrossoverNary$new(n_indivs_in = 2)
Arguments
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. Default 2.
The$n_indivs_in
field will reflect this value.
Method clone()
The objects of this class are cloneable with this method.
Usage
RecombinatorCrossoverNary$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_sequential
,
dict_recombinators_swap
,
dict_recombinators_xounif
Examples
set.seed(1)
rxon = rec("xonary", n_indivs_in = 3)
p = ps(x = p_dbl(-5, 5), y = p_dbl(-5, 5), z = p_dbl(-5, 5))
data = data.frame(x = 0:5, y = 0:5, z = 0:5)
rxon$prime(p)
rxon$operate(data) # uniform sampling from groups of 3
rxon = rec("xonary", 3, p = c(0, 1, 2))$prime(p)
# for groups of 3, take with probability 1/3 from 2nd and with probability 2/3 from 3rd row
rxon$operate(data)
pmat = matrix(c(0, 1, 2, 1, 1, 1, 1, 0, 0), ncol = 3)
pmat
rxon = rec("xonary", 3, p = pmat)$prime(p)
rxon$operate(data) # componentwise different operation