Objective function
Objective.RdThis class defines the objective that is used for optimization.
Active bindings
archive(
data.table()) Archive of all calls to$eval_store.log_funs(
list()) A list containing logging functions. Each function must have argument.xdim(
integer(1)) Input dimension off.transform_id(
character(1)) Identifier of the active transform.
Methods
Method new()
Creates a new instance of this R6 class.
Usage
Objective$new(
id,
fun,
label = "f",
xdim,
lower = NA,
upper = NA,
xtest = NULL,
minimize = FALSE,
transform = objective_transform_identity(),
label_base = NULL,
...
)Arguments
id(
character(1))
Id of the object.fun(
functionThe objective function. The first argument must be a numerical input of lengthxdim.label(
character(1)The label of the objective, i.e. a.xdim(
integer(1)) The input dimension offun. Usexdim = NAfor an arbitrary input dimension.lower(
numeric(xdim)) The lower boundaries for inputs tofun. Mustupper(
numeric(xdim)) The upper boundaries for inputs tofun. Must be of lengthxdim.xtest(
numeric()) Test value forfunduring 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).transform(
objective_transform()) Optional scalar transformation applied to the objective value. Defaults toobjective_transform_identity().label_base(
character(1)) Optional base label used when appending transform identifiers. Defaults tolabel....
Additional arguments passed tofun.
Method eval()
Evaluate the objective function.
Method eval_store()
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 $add_log_fun.
Method assert_x()
Assert a numeric input if it is suitable or not.
Arguments
x(
numeric()) Input value forfun....Additional arguments passed to
assertNumeric(...).
Method set_transform()
Update the active transformation for the objective.
Arguments
transform(
objective_transform()) Transformation descriptor created viaobjective_transform().test(
logical(1)) IfTRUE, validates the transform by evaluating the objective at the stored test point.
Method get_transform()
Retrieve the active transformation descriptor.
Returns
An object created by objective_transform().