# define objective function
fun = function(xs) {
-(xs[[1]] - 2)^2 - (xs[[2]] + 3)^2 + 10
}
# set domain
domain = ps(
x1 = p_dbl(-10, 10),
x2 = p_dbl(-5, 5)
)
# set codomain
codomain = ps(y = p_dbl(tags = "maximize"))
# create Objective object
obfun = ObjectiveRFun$new(
fun = fun,
domain = domain,
codomain = codomain,
properties = "deterministic"
)
Run the code above in your browser using DataLab