[Rd] optim-Bug (PR#6720)
kestler at neuro.informatik.uni-ulm.de
kestler at neuro.informatik.uni-ulm.de
Tue Mar 30 19:21:40 CEST 2004
Full_Name: Dr. Hans A. Kestler
Version: 1.8.1.
OS: Linux, Win, Mac OSX
Submission from: (NULL) (134.60.73.116)
The code below produces after a different number of iterations i the following
error:
Error in optim(par = rep(0.5, length(edges)), loglik, method = "L-BFGS-B", :
non-finite value supplied by optim
This was reproducible on different machines (Mac G4 OSX, AMD Opteron Linux SUSE
9.0, Intel P4 Suse 9.0, P4 Windows XP Prof), only with different i.
The non-deterministic behaviour made us recompile R with debug options and use
valgrind for memory-leak checking. The result was horrible. We are now in the
process of going through the f2c code of lbfgsb.c. The problem seems to be a
access violation of wn1 at run time.
Cheers
Hans
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
for (i in 1:1000) {
set.seed(0,NULL)
cat(i,"\n")
pvec<-c(19,1,1,5,5,6,4,6,15,7,15,2,16,2,5,6,25,1,3,1,5,3,5,5,20,31)
qvec<-c(6,24,4,0,2,0,2,1,0,8,1,14,4,4,1,19,6,30,0,2,0,2,15,15,11,10)
edges<-c(1,2,16)
loglik <- function(q) {
y = pvec[edges]%*%log(1-q) + qvec[edges]%*%log(q) -
(pvec[edges[1]]+qvec[edges[1]])*log(1-prod(q))
tt<-format(c(y, q),nsmall=20)
# cat(tt,"\n")
return(-y)
}
result <- optim(par=rep(0.5, length(edges)), loglik,
method="L-BFGS-B", lower=rep(0.001,length(edges)),
upper=rep(0.999,length(edges)))
}
More information about the R-devel
mailing list