The Objective
class describes a black-box objective function that maps an arbitrary domain to a numerical codomain.
callbacks
(list of mlr3misc::Callback)
Callbacks applied during the optimization.
context
(ContextBatch)
Stores the context for the callbacks.
id
(character(1)
)).
properties
(character()
).
domain
(paradox::ParamSet)
Specifies domain of function, hence its input parameters, their types
and ranges.
codomain
(paradox::ParamSet)
Specifies codomain of function, hence its feasible values.
constants
(paradox::ParamSet).
Changeable constants or parameters that are not subject to tuning can be
stored and accessed here. Set constant values are passed to $.eval()
and $.eval_many()
as named arguments.
check_values
(logical(1)
)
label
(character(1)
)
Label for this object.
Can be used in tables, plot and text output instead of the ID.
man
(character(1)
)
String in the format [pkg]::[topic]
pointing to a manual page for this object.
The referenced help package can be opened via method $help()
.
xdim
(integer(1)
)
Dimension of domain.
ydim
(integer(1)
)
Dimension of codomain.
new()
Creates a new instance of this R6 class.
Objective$new(
id = "f",
properties = character(),
domain,
codomain = ps(y = p_dbl(tags = "minimize")),
constants = ps(),
check_values = TRUE,
label = NA_character_,
man = NA_character_
)
id
(character(1)
).
properties
(character()
).
domain
(paradox::ParamSet)
Specifies domain of function.
The paradox::ParamSet should describe all possible input parameters of the objective function.
This includes their id
, their types and the possible range.
codomain
(paradox::ParamSet)
Specifies codomain of function.
Most importantly the tags of each output "Parameter" define whether it should
be minimized or maximized. The default is to minimize each component.
constants
(paradox::ParamSet)
Changeable constants or parameters that are not subject to tuning can be stored and accessed here.
check_values
(logical(1)
)
Should points before the evaluation and the results be checked for validity?
label
(character(1)
)
Label for this object.
Can be used in tables, plot and text output instead of the ID.
man
(character(1)
)
String in the format [pkg]::[topic]
pointing to a manual page for this object.
The referenced help package can be opened via method $help()
.
...
(ignored).
eval()
Evaluates a single input value on the objective function. If
check_values = TRUE
, the validity of the point as well as the validity
of the result is checked.
Objective$eval(xs)
xs
(list()
)
A list that contains a single x value, e.g. list(x1 = 1, x2 = 2)
.
list()
that contains the result of the evaluation, e.g. list(y = 1)
.
The list can also contain additional named entries that will be stored in the
archive if called through the OptimInstance.
These extra entries are referred to as extras.
eval_many()
Evaluates multiple input values on the objective function. If
check_values = TRUE
, the validity of the points as well as the validity
of the results are checked. bbotk does not take care of
parallelization. If the function should make use of parallel computing,
it has to be implemented by deriving from this class and overwriting this
function.
Objective$eval_many(xss)
xss
(list()
)
A list of lists that contains multiple x values, e.g.
list(list(x1 = 1, x2 = 2), list(x1 = 3, x2 = 4))
.
data.table::data.table()] that contains one y-column for
single-criteria functions and multiple y-columns for multi-criteria functions,
e.g. data.table(y = 1:2)
or data.table(y1 = 1:2, y2 = 3:4)
.
It may also contain additional columns that will be stored in the archive if
called through the OptimInstance.
These extra columns are referred to as extras.
eval_dt()
Evaluates multiple input values on the objective function
Objective$eval_dt(xdt)
xdt
(data.table::data.table()
)
Set of untransformed points / points from the search space.
One point per row, e.g. data.table(x1 = c(1, 3), x2 = c(2, 4))
.
Column names have to match ids of the search_space
.
However, xdt
can contain additional columns.
data.table::data.table()] that contains one y-column for
single-criteria functions and multiple y-columns for multi-criteria
functions, e.g. data.table(y = 1:2)
or data.table(y1 = 1:2, y2 = 3:4)
.
clone()
The objects of this class are cloneable with this method.
Objective$clone(deep = FALSE)
deep
Whether to make a deep clone.
Objective
objects can have the following properties: "noisy"
, "deterministic"
, "single-crit"
and "multi-crit"
.