The function compiles the code to C++ and uses Armadillo and ensmallen to optimize it.

compile_optimization_problem(data = list(), evaluate, gradient,
  optimizer = optimizer_SA())

Arguments

data

a named list of prior data you would like to supply to the evaluate function.

evaluate

a function that is to be minimized. It should return a single numeric.

gradient

optional, a function computing the gradient of evaluate

optimizer

one of the many optimizers

Examples

if (FALSE) { optimize <- compile_optimization_problem( data = list(), evaluate = function(x) { return(2 * norm(x)^2) }, optimizer = optimizer_SA() ) # should be roughly c(0, 0, 0) result <- optimize(matrix(c(1, -1, 1), ncol = 1)) }