define_optimizer | R Documentation |
This function specifies the framework for a numerical optimizer.
Two wrappers for well-known optimizers are already available:
optimizer_nlm()
for the nlm
optimizer
optimizer_optim()
for the optim
optimizer
define_optimizer(
.optimizer,
.objective,
.initial,
.value,
.parameter,
.direction,
...,
.output_ignore = character(0),
.validate = FALSE,
.validation_settings = list(objective_test = TestFunctions::TF_ackley, objective_add =
list(), initial = round(stats::rnorm(2), 2), check_seconds = 10)
)
optimizer_nlm(
...,
.output_ignore = character(0),
.validate = FALSE,
.validation_settings = list()
)
optimizer_optim(
...,
.direction = "min",
.output_ignore = character(0),
.validate = FALSE,
.validation_settings = list()
)
.optimizer |
A
|
.objective |
A |
.initial |
A |
.value |
A |
.parameter |
A |
.direction |
A |
... |
Additional arguments to be passed to the optimizer. Without specifications, the default values of the optimizer are used. |
.output_ignore |
A |
.validate |
A |
.validation_settings |
Ignored if
|
An optimizer
object.
An optimizer
object is a list
of six elements:
A function
, the optimization algorithm.
A character
, the name of
optimizer
.
A named list
, where each element
is an additional function argument for optimizer
.
Either "min"
if the optimizer minimizes
or "max"
if the optimizer maximizes.
A named list
of four
character
:
the name of the function input of optimizer
the name of the starting parameter values input of
optimizer
the name of the optimal function value in the output list
of optimizer
the name of the optimal parameter vector in the
output list of optimizer
.
A character
vector of element
names in the output list
of optimizer
that are ignored.
The elements value
and parameter
are added automatically to
output_ignore
, because they are saved
separately, see the output documentation of apply_optimizer
.
Use apply_optimizer()
to apply an optimizer
object for numerical
optimization.
define_optimizer(
.optimizer = pracma::nelder_mead, # optimization function
.objective = "fn", # name of function input
.initial = "x0", # name of initial input
.value = "fmin", # name of value output
.parameter = "xmin", # name of parameter output
.direction = "min", # optimizer minimizes
.output_ignore = c("restarts", "errmess"), # ignore some outputs
tol = 1e-6, # additional optimizer argument
.validate = TRUE # validate the object
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.