tao_cpp: Use TAO to minimize an objective function

Description Usage Arguments Value Examples

Description

tao_cpp is an internal function of this package. It is recommended that users call tao instead, which has a more convenient syntax and performs thorough input checking.

Usage

1
tao_cpp(functions, start_values, method, options, n, lower_bounds, upper_bounds)

Arguments

functions

is a list of Rcpp functions. The first is always the objective function. The second and third are optionally the Jacobian and the Hessian functions.

start_values

is a vector containing the starting values of the parameters.

method

is a string that determines the type of optimizer to be used.

options

is a list containing option values for the optimizer

n

is the number of elements in the objective function.

lower_bounds

is a vector with lower bounds

upper_bounds

is a vector with upper bounds

Value

a list with the objective function and the final parameter values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# use pounders
objfun = function(x) c((x[1] - 3), (x[2] + 1))
ret = tao_cpp(functions = list(objfun = objfun), 
              start_values = c(1, 2), 
              method = "pounders", 
              options = list(), 
              n = 2,
              lower_bounds = c(-2, -2),
              upper_bounds = c(5, 5))
ret$x
    
# use Nelder-Mead
objfun = function(x) sum(c((x[1] - 3)^2, (x[2] + 1))^2)
ret = tao_cpp(functions = list(objfun = objfun), 
                  start_values = c(1, 2), 
                  method = "nm", 
                  options = list(),
                  n = 1,
                  lower_bounds = c(-2, -2),
                  upper_bounds = c(5, 5))
ret$x

jtilly/taoR documentation built on May 20, 2019, 3:13 a.m.