| Codomain {bbotk} | R Documentation |
A set of Param objects defining the codomain of a function. The parameter
set must contain at least one target parameter tagged with "minimize" or
"maximize". The codomain may contain extra parameters which are ignored
when calling the Archive methods $best(), $nds_selection() and
$cols_y. This class is usually constructed internally from a
paradox::ParamSet when Objective is initialized.
paradox::ParamSet -> Codomain
is_target(named logical())
Position is TRUE for target Params.
target_length(integer())
Returns number of target Params.
target_ids(character())
Number of contained target Params.
target_tags(named list() of character())
Tags of target Params.
maximization_to_minimization(integer())
Returns a numeric vector with values -1 and 1. Multiply with the outcome
of a maximization problem to turn it into a minimization problem.
new()Creates a new instance of this R6 class.
Codomain$new(params = named_list())
params(list())
List of Param, named with their respective ID.
Parameters are cloned.
clone()The objects of this class are cloneable with this method.
Codomain$clone(deep = FALSE)
deepWhether to make a deep clone.
# define objective function
fun = function(xs) {
c(y = -(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"),
time = p_dbl()
)
# create Objective object
objective = ObjectiveRFun$new(
fun = fun,
domain = domain,
codomain = codomain,
properties = "deterministic"
)