Sorry if this is already mentioned somewhere, could not find anything.
I adapted the code from the README slightly to add a dependency.
The code now breaks at private$.primed_ps$assert_dt(values) during recombination because a value should suddenly be NA.
library("bbotk")
library("paradox")
lgr::threshold("warn")
objective <- ObjectiveRFun$new(
fun = function(xs) {
if(is.null(xs$y)) xs$y = 2
z <- exp(-xs$x^2 - xs$y^2) + 2 * exp(-(2 - xs$x)^2 - (2 - xs$y)^2)
list(Obj = z)
},
domain = ps(
x = p_dbl(-2, 4),
y = p_dbl(-2, 4, depends = d == 1),
d = p_int(lower = 0, upper = 1)
),
codomain = ps(Obj = p_dbl(tags = "maximize"))
)
# Get a new OptimInstance
oi <- OptimInstanceSingleCrit$new(objective,
terminator = trm("evals", n_evals = 100)
)
library("miesmuschel")
# Get operators
op.m <- mut("gauss")
op.r <- rec("xounif", p = .3)
op.parent <- sel("random")
op.survival <- sel("best")
# Create OptimizerMies object
mies <- opt("mies", mutator = op.m, recombinator = op.r,
parent_selector = op.parent, survival_selector = op.survival,
mu = 3, lambda = 2)
mies$optimize(oi)
Sorry if this is already mentioned somewhere, could not find anything.
I adapted the code from the
README
slightly to add a dependency. The code now breaks atprivate$.primed_ps$assert_dt(values)
during recombination because a value should suddenly beNA
.