new_optimizer: Construct 'optimizer' object

View source: R/legacy.R

new_optimizerR Documentation

Construct optimizer object

Description

This function constructs an S3 optimizer object.

Usage

new_optimizer(
  x = list(),
  .optimizer = function() {
 },
  optimizer_name = character(),
  optimizer_arguments = list(),
  .objective = character(),
  .initial = character(),
  .value = character(),
  .parameter = character(),
  .direction = character(),
  .output_ignore = character()
)

Arguments

x

A list.

.optimizer

A function, a numerical optimizer. Four conditions must be met:

  1. It must have an input named .objective for a function, the objective function which is optimized over its first argument.

  2. It must have an input named .initial for a numerical vector, the initial parameter vector.

  3. It must have a ... argument for additional parameters to the objective function.

  4. The output must be a named list, including the optimal function value and the optimal parameter vector.

optimizer_name

A character, the name of optimizer.

optimizer_arguments

A list of additional and named arguments to be passed to optimizer.

.objective

A character, the name of the function input of optimizer.

.initial

A character, the name of the starting parameter values input of optimizer.

.value

A character, the name of the optimal function value in the output list of optimizer.

.parameter

A character, the name of the optimal parameter vector in the output list of optimizer.

.direction

A character, indicates whether the optimizer minimizes ("min") or maximizes ("max").

.output_ignore

A character vector of element names in the output of .optimizer that are not saved. The elements .value and .parameter are added automatically to .output_ignore, because they are saved separately, see the output documentation of apply_optimizer.

Value

An S3 object of class optimizer.

Format

An optimizer object is a list of six elements:

optimizer

A function, the optimization algorithm.

optimizer_name

A character, the name of optimizer.

optimizer_arguments

A named list, where each element is an additional function argument for optimizer.

optimizer_direction

Either "min" if the optimizer minimizes or "max" if the optimizer maximizes.

optimizer_labels

A named list of four character:

objective

the name of the function input of optimizer

initial

the name of the starting parameter values input of optimizer

value

the name of the optimal function value in the output list of optimizer

parameter

the name of the optimal parameter vector in the output list of optimizer.

output_ignore

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.


optimizeR documentation built on April 4, 2025, 1:56 a.m.