Abstract Terminator
class that implements the base functionality each terminator must provide.
A terminator is an object that determines when to stop the optimization.
Termination of optimization works as follows:
Evaluations in a instance are performed in batches.
Before each batch evaluation, the Terminator is checked, and if it is positive, we stop.
The optimization algorithm itself might decide not to produce any more points, or even might decide to do a smaller batch in its last evaluation.
Therefore the following note seems in order: While it is definitely possible to execute a fine-grained control for termination, and for many optimization algorithms we can specify exactly when to stop, it might happen that too few or even too many evaluations are performed, especially if multiple points are evaluated in a single batch (c.f. batch size parameter of many optimization algorithms). So it is advised to check the size of the returned archive, in particular if you are benchmarking multiple optimization algorithms.
Terminator
subclasses can overwrite .status()
to support progress bars via the package progressr.
The method must return the maximum number of steps (max_steps
) and the currently achieved number of steps (current_steps
) as a named integer vector.
id
(character(1)
)
Identifier of the object.
Used in tables, plot and text output.
param_set
paradox::ParamSet
Set of control parameters.
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()
.
properties
(character()
)
Set of properties of the terminator.
Must be a subset of bbotk_reflections$terminator_properties
.
unit
(character()
)
Unit of steps.
new()
Creates a new instance of this R6 class.
Terminator$new(
id,
param_set = ps(),
properties = character(),
unit = "percent",
label = NA_character_,
man = NA_character_
)
id
(character(1)
)
Identifier for the new instance.
param_set
(paradox::ParamSet)
Set of control parameters.
properties
(character()
)
Set of properties of the terminator.
Must be a subset of bbotk_reflections$terminator_properties
.
unit
(character()
)
Unit of steps.
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()
.
with_params
(logical(1)
)
Add parameter values to format string.
...
(ignored).
...
(ignored).
status()
Returns how many progression steps are made (current_steps
) and the
amount steps needed for termination (max_steps
).
Terminator$status(archive)
archive
(Archive).
named integer(2)
.
remaining_time()
Returns remaining runtime in seconds. If the terminator is not
time-based, the reaming runtime is Inf
.
Terminator$remaining_time(archive)
archive
(Archive).
integer(1)
.
clone()
The objects of this class are cloneable with this method.
Terminator$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Terminator:
mlr_terminators
,
mlr_terminators_clock_time
,
mlr_terminators_combo
,
mlr_terminators_evals
,
mlr_terminators_none
,
mlr_terminators_perf_reached
,
mlr_terminators_run_time
,
mlr_terminators_stagnation
,
mlr_terminators_stagnation_batch