Abstract base class.
The Optimizer writes the final result to the .result
field by using
the $assign_result()
method. .result
stores a data.table::data.table
consisting of x values in the search space, (transformed) x values in the
domain space and y values in the codomain space of the Objective. The
user can access the results with active bindings (see below).
objective
(Objective).
search_space
terminator
(Terminator).
is_terminated
(logical(1)
).
archive
(Archive).
result
(data.table::data.table) Get result
result_x_search_space
(data.table::data.table) x part of the result in the search space.
result_x_domain
(list()
)
(transformed) x part of the result in the domain space of the objective.
result_y
(numeric()
)
Optimal outcome.
new()
Creates a new instance of this R6 class.
OptimInstance$new(objective, search_space = NULL, terminator)
objective
(Objective).
search_space
(paradox::ParamSet)
Specifies the search space for the Optimizer.
The paradox::ParamSet describes either a subset of the domain
of the Objective or it describes a set of parameters together with a trafo
function that transforms values from the search space to values of the domain.
Depending on the context, this value defaults to the domain of the objective.
terminator
(Terminator).
format()
Helper for print outputs.
OptimInstance$format()
print()
Printer.
OptimInstance$print(...)
...
(ignored).
eval_batch()
Evaluates all input values in xdt
by calling
the Objective. Applies possible transformations to the input values
and writes the results to the Archive.
Before each batch-evaluation, the Terminator is checked, and if it
is positive, an exception of class terminated_error
is raised. This
function should be internally called by the Optimizer.
OptimInstance$eval_batch(xdt)
xdt
(data.table::data.table()
)
x values as data.table()
with one point per row. Contains the value in
the search space of the OptimInstance object. Can contain additional
columns for extra information.
assign_result()
The Optimizer object writes the best found point and estimated performance value here. For internal use.
OptimInstance$assign_result(xdt, y)
xdt
(data.table::data.table()
)
x values as data.table()
with one row. Contains the value in the search
space of the OptimInstance object. Can contain additional columns for
extra information.
y
(numeric(1)
)
Optimal outcome.
objective_function()
Evaluates (untransformed) points of only numeric values. Returns a
numeric scalar for single-crit or a numeric vector for multi-crit. The
return value(s) are negated if the measure is maximized. Internally,
$eval_batch()
is called with a single row. This function serves as a
objective function for optimizers of numeric spaces - which should always
be minimized.
OptimInstance$objective_function(x)
x
(numeric()
)
Untransformed points.
Objective value as numeric(1)
, negated for maximization problems.
clone()
The objects of this class are cloneable with this method.
OptimInstance$clone(deep = FALSE)
deep
Whether to make a deep clone.