The input operator is wrapped: individuals are fed to it as-is, and output is rounded. Upper and lower bounds are both shifted by 0.5 down or up, respectively, to retain a fair distribution.

intifyMutator(operator)

intifyRecombinator(operator)

Arguments

operator

[ecr_operator] ecr_operator that supports continuous variables.

Value

ecr_operator operator that operates on integers.

Examples

library(mlrCPO) # Create parameter set ps <- pSS( numb: numeric[1, 10], int: integer[0, 5]) # Define mutator # If Gaussian mutator is applied to integer parameter, # it does not return an integer combo.mut <- combine.operators(ps, numeric = mutGauss, int = mutGauss) combo.mut(list(numb = 1.5, int = 3))
#> $numb #> [1] 1.455298 #> #> $int #> [1] 2.974077 #>
# Turn continuous-space operator mutGauss into integer-space operator mutGaussInt <- intifyMutator(mutGauss) combo.mut.int <- combine.operators(ps, numeric = mutGauss, int = mutGaussInt) combo.mut.int(list(numb = 1.5, int = 3))
#> $numb #> [1] 1.517556 #> #> $int #> [1] 3 #>
# Turn continuous-space operator recSBX into integer-space operator recSBXInt <- intifyRecombinator(recSBX) combo.rec.int <- combine.operators(ps, numeric = recSBX, int = recSBXInt) combo.rec.int(list(list(numb = 1.5, int = 3), list(numb = 3, int = 0)))
#> [[1]] #> [[1]]$numb #> [1] 3.02757 #> #> [[1]]$int #> [1] 3 #> #> #> [[2]] #> [[2]]$numb #> [1] 1.559393 #> #> [[2]]$int #> [1] 0 #> #> #> attr(,"multiple") #> [1] TRUE