mosmafs (version 0.1.2)

intifyMutator: Turn Continuous-Space Operators into Integer-Space Operators

Description

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.

Usage

intifyMutator(operator)

intifyRecombinator(operator)

Value

ecr_operator operator that operates on integers.

Arguments

operator

[ecr_operator] ecr_operator that supports continuous variables.

Examples

Run this code
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))

# 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))

# 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)))

Run the code above in your browser using DataLab