Abstract base class.

Technical details

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).

Public fields

objective

(Objective).

search_space

(paradox::ParamSet).

terminator

(Terminator).

is_terminated

(logical(1)).

archive

(Archive).

Active bindings

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.

Methods

Public methods


Method new()

Creates a new instance of this R6 class.

Usage

OptimInstance$new(objective, search_space = NULL, terminator)

Arguments

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).


Method format()

Helper for print outputs.

Usage

OptimInstance$format()


Method print()

Printer.

Usage

OptimInstance$print(...)

Arguments

...

(ignored).


Method 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.

Usage

OptimInstance$eval_batch(xdt)

Arguments

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.


Method assign_result()

The Optimizer object writes the best found point and estimated performance value here. For internal use.

Usage

OptimInstance$assign_result(xdt, y)

Arguments

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.


Method 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.

Usage

OptimInstance$objective_function(x)

Arguments

x

(numeric())
Untransformed points.

Returns

Objective value as numeric(1), negated for maximization problems.


Method clone()

The objects of this class are cloneable with this method.

Usage

OptimInstance$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.