In
f <- function(x, control, for_f) {
print(for_f)
sum(x^2)
}
apply_optimizer(optimizer_optim(), f, 1:3, control = list("something" = 1), for_f = "hi")
#> Warning message:
#> In (function (par, fn, gr = NULL, ..., method = c("Nelder-Mead", :
#> unbekannte Namen in control: something
both arguments control and for_f should be passed to f, but only for_f actually is. That is because control instead is passed to optimizer_optim(). However, additional arguments for the optimizer should not be passed via the ... argument in apply_optimizer() but rather in define_optimizer().
Check implementation of apply_optimizer().
In
both arguments
controlandfor_fshould be passed tof, but onlyfor_factually is. That is becausecontrolinstead is passed tooptimizer_optim(). However, additional arguments for the optimizer should not be passed via the...argument inapply_optimizer()but rather indefine_optimizer().Check implementation of
apply_optimizer().