| dict_recombinators_cvxpair {miesmuschel} | R Documentation |
Convex Combination Recombinator for Pairs
Description
Numeric Values between various individuals are recombined via component-wise convex combination (or weighted mean). Exactly two
individuals are being recombined, and the lambda configuration parameter determines the relative weight of the first
individual in each pair for the first result, and the relative weight of the second indivudual for the complement, if
initialized with keep_complement set to TRUE.
Configuration Parameters
-
lambda::numeric
Combination weight. Ifkeep_complementisTRUE, then two individuals are returned for each pair of input individuals: one corresponding tolambda * <1st individual> + (1-lambda) * <2nd individual>, and one corresponding to(1-lambda) * <1st individual> + lambda * <2nd individual>(i.e. the complement). Otherwise, only the first of these two is generated. Must either be a scalar, or a vector with length equal to the number of components in the values being operated on. Must be between 0 and 1.
Initialized to 0.5.
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 -> miesmuschel::RecombinatorPair -> RecombinatorConvexPair
Methods
Public methods
Inherited methods
Method new()
Initialize the RecombinatorConvexPair object.
Usage
RecombinatorConvexPair$new(keep_complement = TRUE)
Arguments
keep_complement(
logical(1))
Whether the operation should keep both resulting individuals (TRUE), or only the first and discard the complement (FALSE). DefaultTRUE. The$keep_complementfield will reflect this value.
Method clone()
The objects of this class are cloneable with this method.
Usage
RecombinatorConvexPair$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
Other recombinators:
OperatorCombination,
Recombinator,
RecombinatorPair,
dict_recombinators_cmpmaybe,
dict_recombinators_convex,
dict_recombinators_maybe,
dict_recombinators_null,
dict_recombinators_proxy,
dict_recombinators_sbx,
dict_recombinators_sequential,
dict_recombinators_swap,
dict_recombinators_xonary,
dict_recombinators_xounif
Examples
set.seed(1)
rcvx = rec("cvxpair")
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)
rcvx$prime(p)
rcvx$operate(data) # mean of groups of 2
# with the default value of lambda = 0.5, the default of
# keep_complement = TRUE means that pairs of equal values are generated;
# consider setting keep_complement = FALSE int that case.
rcvx$param_set$values$lambda = 0.1
rcvx$operate(data)