r - DEoptim getting stuck in local minimum of noisy objective function -


i having little trouble getting deoptim want. sure largely due naive usage. understanding of differential optimisation is technique aims avoid getting stuck in local minima of objective function. degree successful depends on how irregular objective function is.

this objective function:

n <- 10000  obj.func <- function(x) {     set.seed(x*100000)     #     # generate monte carlo estimate of pi     #     r <- sqrt(runif(n, -1, 1)**2 + runif(n, -1, 1)**2)     #     pi.estimate = sum(r <= 1) / n * 4     #     # objective function     #     return((x - pi.estimate)**2) } 

this rather extreme example. real application has objective function not quite noisy multi-dimensional. thought first play around toy example while figuring out how deoptim works.

the objective function plotted below scatter plot evaluated @ intervals of 0.00001. red noise-free objective function (which symmetric around pi) , dashed blue line location of actual minimum in noisy objective function, located @ x = 3.15719.

objective function

after fiddling around options of deoptim found got reasonable results with

> library(deoptim) > set.seed(1) > deoptim(obj.func, lower = 2, upper = 4, +         control = deoptim.control(trace = 10, strategy = 6, itermax = 10000)) iteration: 10 bestvalit: 0.000000 bestmemit:    3.105490 iteration: 20 bestvalit: 0.000000 bestmemit:    3.130510 iteration: 30 bestvalit: 0.000000 bestmemit:    3.130510 iteration: 40 bestvalit: 0.000000 bestmemit:    3.148317 iteration: 50 bestvalit: 0.000000 bestmemit:    3.148317 iteration: 60 bestvalit: 0.000000 bestmemit:    3.151152 iteration: 70 bestvalit: 0.000000 bestmemit:    3.151152 iteration: 80 bestvalit: 0.000000 bestmemit:    3.151152 iteration: 90 bestvalit: 0.000000 bestmemit:    3.151152 iteration: 100 bestvalit: 0.000000 bestmemit:    3.158387 iteration: 110 bestvalit: 0.000000 bestmemit:    3.158387 iteration: 120 bestvalit: 0.000000 bestmemit:    3.158387 iteration: 130 bestvalit: 0.000000 bestmemit:    3.158387 iteration: 140 bestvalit: 0.000000 bestmemit:    3.158387 iteration: 150 bestvalit: 0.000000 bestmemit:    3.158387 

the output has been cut short because algorithm seems stuck @ solution. if let run through specified number of iterations (10000), still stubbornly sitting @ result of x = 3.158387. value of objective function @ point is

> obj.func(3.158387) [1] 1.69e-10 

whereas @ real minimum is

> obj.func(3.15719) [1] 1e-10 

so difference small , not important @ all. but, since goal here learning deoptim, understand happening.

what know (1) why deoptim getting stuck @ value , (2) how can search around more , find real minimum?

thanks, andrew.

try find option this: (because using implementation in matlab)

f_vtr "value reach" (stop when ofunc < f_vtr)

this option can set small value, like:

f_vtr = 1e-16; 

then algorithm find global minimum or find out has stuck @ local mimima.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -