Skip to content

Clash between additional function and optimizer arguments in apply_optimizer() #1

@loelschlaeger

Description

@loelschlaeger

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().

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions