adcomp icon indicating copy to clipboard operation
adcomp copied to clipboard

After R-3.5.0, tests that use nlminb with bounds fail

Open kaskr opened this issue 7 years ago • 1 comments

Since the recent release of R-3.5.0 all TMB travis tests that uses nlminb with bounds have been failing.

Problem seems to occur on very few systems only. I have tracked down the cause of the problem to be a change in R's Fortran compiler flags from

SAFE_FFLAGS = -g -O2 -ffloat-store

to

SAFE_FFLAGS = -g -O2 -msse2 -mfpmath=sse

If you suddenly experience weird nlminb convergence problems after upgrading R you might be affected by this issue. A simple way to check whether your system is OK seems to be:

f <- function(x) sum( log(diff(x)^2+.01) + (x[1]-1)^2 )
opt <- nlminb(rep(0, 10), f, lower=-1, upper=3)
abs(opt$objective - 9 * log(.01)) < 1e-4  ## OK if TRUE

kaskr avatar May 03 '18 12:05 kaskr

I am getting FALSE for the test above using the following version of R platform x86_64-redhat-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 5.0
year 2018
month 04
day 23
svn rev 74626
language R
version.string R version 3.5.0 (2018-04-23) nickname Joy in Playing

bradbell avatar Aug 02 '18 13:08 bradbell