Separates function created with objective() into value function and gradient function. No memoisation is done here.

make_functions(objective, provides_gradient = TRUE)

Arguments

objective

objective function, as created with objective().

provides_gradient

logical, does objective prodive gradient?

Value

same as in objective_functions().

Examples

s <- fake_adaptive_solver(4, 5) result <- run(s, c(10, 10, 10, 10), precision = 5.0, silent = TRUE) observed_data <- result$qoi x <- c(10.5, 9.44, 10.21, 8.14) obj <- objective(s, observed_data, precision = 30.0, silent = TRUE) solver_funs <- make_functions(obj) solver_funs$value(x)
#> [1] 2594156034
solver_funs$gradient(x)
#> [1] -6208209534 -4059190749 -5551351184 -2246937119