Home > front end >  Problem minimising a function using L-BFGS-B method in R?
Problem minimising a function using L-BFGS-B method in R?

Time:01-09

A similar question was asked image of objective function surface showing white (non-finite) values on x=y diagonal and at x=0 or y=0

it looks like your function is giving non-finite values if x=y or x=0 or y=0 ? You might want to catch those cases and return a finite value ...

In fact, that leads to a workaround, which is to not make the lower or upper bounds exactly equal, to stop R trying to evaluate the function in the bad places:

oo1 = optim(par = c(0.1, 0.2), fn, w = 0.1, 
   lower = c(-0.49, -0.48), 
   upper = c(0.5, 0.49), method="L-BFGS-B")

It probably would have been possible to diagnose this by looking at the objective function and thinking hard about where it would have non-finite values, but "thought is irksome and three minutes is a long time"

  •  Tags:  
  • Related