Learn R Programming

PhotoGEA (version 1.4.0)

optimizers: Optimizers

Description

These functions return optimizers that meet requirements for the optim_fun input argument of fit_c3_aci, fit_c3_variable_j, fit_c4_aci, and fit_c4_aci_hyperbola. Essentially, they are wrappers for optimizers from other libraries that serve to standardize their inputs and outputs.

Usage

optimizer_deoptim(itermax, VTR = -Inf)

optimizer_hjkb(tol, maxfeval = Inf, target = Inf)

optimizer_nlminb(rel.tol, eval.max = 200, iter.max = 200, abs.tol = 0)

optimizer_nmkb(tol, maxfeval = 2000, restarts.max = 10)

optimizer_null()

Value

Each of these functions returns an optimizer function optim_fun. The returned optim_fun function has four input arguments: an initial guess (guess), an error function (fun), lower bounds (lower), and upper bounds (upper). It returns a list with four named elements:

par, convergence, feval, and convergence_msg.

Arguments

tol

A convergence tolerance value; to be passed to nmkb or hjkb via their control input arguments. A typical value is 1e-7.

maxfeval

A maximum value for the number of function evaluations to allow during optimization; to be passed to nmkb or hjkb via their control input arguments.

target

A real number restricting the absolute function value; to be passed to hjkb via its control input argument.

rel.tol

A relative convergence tolerance value; to be passed to nlminb via its control input argument. A typical value is 1e-10.

eval.max

A maximum value for the number of function evaluations; to be passed to nlminb via its control input argument.

iter.max

A maximum value for the number of iterations; to be passed to nlminb via its control input argument.

abs.tol

An absolute convergence tolerance value; to be passed to nlminb via its control input argument.

restarts.max

A maximum value for the number of restarts allowed during optimization; to be passed to nmkb via its control input argument.

itermax

The maximum number of generations to be used; to be passed to DEoptim via its control input argument. Note that when VTR is -Inf, the optimizer will always use the maximum number of generations. A typical value is 200.

VTR

The value to be reached; to be passed to DEoptim via its control input argument.

Details

optimizer_deoptim is a wrapper for DEoptim.

optimizer_hjkb is a wrapper for hjkb.

optimizer_nlminb is a wrapper for nlminb.

optimizer_nmkb is a wrapper for nmkb.

optimizer_null simply returns the initial guess without doing any optimization; it can be useful for viewing initial guesses.

See the documentation for those functions for more information about how the optimizers work.

Examples

Run this code
# Here we just show examples of the optim_fun results. Other examples using the
# optimizers can be found throughout PhotoGEA, such as in the user guides and
# the documentation for fit_c3_aci, fit_c4_aci, etc.

optimizer_deoptim(200)

optimizer_hjkb(1e-7)

optimizer_nlminb(1e-7)

optimizer_nmkb(1e-7)

optimizer_null()

Run the code above in your browser using DataLab