The Brent method in the R optim implementation always returns the same local minimum
I am trying to minify the function shown above. I am looking between (-1,1). I am using the following code
optim(runif(1,min=-1,max=+1), ..., method = "Brent", lower = -1.0, upper = 1.0)
and I noticed that it always returns x = -0.73 instead of the correct answer x = 0.88. The reason is given in the help page optimise
:
The first estimate f is always at the point x_1 = a + (1-φ) (ba), where (a, b) = (lower, upper) and phi = (sqrt (5) - 1) / 2 = 0.61803 .. - ratio of the golden ratio. Almost always, the second estimate is x_2 = a + phi (ba). Note that the local minimum inside [x_1, x_2] will be found as a solution even if it is constant there, see the last example.
I'm curious if there is a way to use the Brent method without hitting the same local low every time.
The change method in "L-BFGS-B" works better (a random local minimum is returned each time):
optim(runif(1,min=-1,max=+1), ..., method = "L-BFGS-B", lower = -1.0, upper = 1.0)
source to share
Your function is NOT convex, so you will have multiple local / global lows or highs. For your function, I would run a non-traditional / derivative global optimizer like simulated annealing or genetic algorithm, and use the output as a starting point for BFGS or any other local optimizers to get the exact solution. Repeat the above step several times, you will find all global and local optimal points.
source to share