Description Usage Arguments Value See Also Examples
Function factory producing functions for use in optimization. These are
objective function and its gradient. They can be used, e.g., as parameters
fn
and gr
of stats::optim()
. Note that the functions compute their
values through objective()
, however, calls to the latter are
memoised, so actual solver should never be called twice for the same
data (x
). In particular, computing value and gradient for a given x
requires only a single solver run. To obtain non-memoised functions
use make_functions()
composed with objective()
(see example in
make_functions()
).
1 | objective_functions(solver, data, ...)
|
solver |
object of class |
data |
observed ('exact') data. |
... |
additional args passed to |
List with one or two components:
value
objective value function,
gradient
objective gradient function, missing if solver does not compute Jacobian matrix.
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)
solver_funs <- objective_functions(s, observed_data, precision = 30.0,
silent = TRUE)
solver_funs$value(x)
solver_funs$gradient(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.