I have a self-developed function foo(a,b) taking two Parameters and Returns a value that I want to minimize. I know that a is between 0 and 1 but b is unconstrained.
Do you have some recommoendation, which package / function I can use to find the Minimum depending on my Parameters a and b?
I can use gridSearch(foo, a, b) (NMOF package) but this is just brute-force.
Thank you for the discussion!
1 Answer
optim() is a base R function that will do what you want. It implements a bunch of optimization routines. Some methods such as L-BFGS-B also allow for box constraints if you know the range of the parameters.
If this does not fit your needs, there are lots of packages offering more optimization algorithms, have a look at the CRAN task view.