Objective function
Objective.Rd
This class defines the objective that is used for optimization.
Public fields
id
(`character(1)` The id of the objective.
label
(`character(1)` The label of the objective, i.e. a.
limits_lower
(`numeric()`) The lower limits for each dimension.
limits_upper
(`numeric()`) The upper limits for each dimension.
minimize
(`logical(1)`) Is the problem a minimization problem?
Active bindings
archive
(`data.table()`) Archive of all calls to `$evalStore`.
log_funs
(`list()`) A list containing logging functions. Each function must have argument.
xdim
(`integer(1)`) Input dimension of `f`.
Methods
Method new()
Creates a new instance of this [R6][R6::R6Class] class.
Usage
Objective$new(
id,
fun,
label = "f",
xdim,
limits_lower = NA,
limits_upper = NA,
xtest = NULL,
minimize = FALSE,
...
)
Arguments
id
(`character(1)` The id of the objective.
fun
(`function` The objective function. The first argument must be a numerical input of length `xdim`.
label
(`character(1)` The label of the objective, i.e. a.
xdim
(`integer(1)`) The input dimension of `fun`. Use `xdim = NA` for an arbitrary input dimension.
limits_lower
(`numeric(xdim)`) The lower boundaries for inputs to `fun`. Must
limits_upper
(`numeric(xdim)`) The upper boundaries for inputs to `fun`. Must be of length `xdim`.
xtest
(`numeric()`) Test value for `fun` during initialization. If not defined, `xtest = rep(0, ifelse(is.na(xdim), 2, xdim))` is used.
minimize
(`logical(1)`) Is the problem a minimization problem? Default is no (`FALSE`).
...
Additional arguments passed to `fun`.
Method eval()
Evaluate the objective function.
Method evalStore()
Evaluate the objective function and log into the archive. Each call logs the input vector `x`, result of fun `fval`, the gradient `grad`, the norm of the gradient `gnorm`, and additional logs that were added by `$addLogFun`.