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. If keep_complement is TRUE, then two individuals are returned for each pair of input individuals: one corresponding to lambda * <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 Param classes are: 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")

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). Default TRUE. The $keep_complement field will reflect this value.


Method clone()

The objects of this class are cloneable with this method.

Usage

RecombinatorConvexPair$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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
#>     x   y   z
#> 1 0.5 0.5 0.5
#> 2 0.5 0.5 0.5
#> 3 2.5 2.5 2.5
#> 4 2.5 2.5 2.5
#> 5 4.5 4.5 4.5
#> 6 4.5 4.5 4.5
# 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)
#>     x   y   z
#> 1 0.9 0.9 0.9
#> 2 0.1 0.1 0.1
#> 3 2.9 2.9 2.9
#> 4 2.1 2.1 2.1
#> 5 4.9 4.9 4.9
#> 6 4.1 4.1 4.1