make_functions: Make two functions out of objective

Description Usage Arguments Value Examples

View source: R/objective.R

Description

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

Usage

1
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

1
2
3
4
5
6
7
8
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)
solver_funs$gradient(x)

maciejsmolka/solvergater documentation built on Jan. 1, 2021, 8:28 a.m.