Separates function created with objective()
into value function
and gradient function. No memoisation is done here.
make_functions(objective, provides_gradient = TRUE)
objective | objective function, as created with |
---|---|
provides_gradient | logical, does |
same as in objective_functions()
.
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] 2594156034solver_funs$gradient(x)#> [1] -6208209534 -4059190749 -5551351184 -2246937119