search for: pgtol

Displaying 20 results from an estimated 20 matches for "pgtol".

Did you mean: pgtcl
2012 Oct 28
0
lbfgsb from C
...d grad(int n, double *par, double *gr, void *ex) { gr[0] = 2*par[0]; gr[1] = 2*par[1]; } int main(void) { int n = 2; int m = 5; double init[] = {2,3}; double lower[] = {-100, -100}; double upper[] = {100, 100}; int nbd[] = {0, 0}; double Fmin; int fail; void *ex = 0; double factr = 1e7; double pgtol = 0; int fncount; int grcount; int maxit = 10; char msg[1000]; int trace = 0; int nREPORT = 10; /* from http://cran.r-project.org/doc/manuals/R-exts.html#Optimization void lbfgsb(int n, int lmm, double *x, double *lower, double *upper, int *nbd, double *Fmin, op...
2019 May 03
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...x,xx,ret= 10.001 10.001 100.02 > 3 in x,xx,ret= 9.999 9.999 100.02 > $par > [1] 10 > > $value > [1] 100 > > $counts > function gradient > ?????? 1??????? 1 > > $convergence > [1] 0 > > $message > [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" > > At the third call, xx has value 9.999 while it should have kept the > value 10.001. > A little follow-up: if you untie the link between xx and x by replacing the expression "xx <<- x" by "xx <<- x+0" it works as expected: > fn=local({n=0;...
2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
...turn(r) } gr <- function(x) { n <- length(x) r <- (b^(0:(n-1)))*(1/x) - 4000000*(sum(x)-k) return(r) } nvar <- 10 (sols <- optim(rep(20,nvar),f,gr,method="L-BFGS-B",lower=rep(0,nvar),upper=rep(k,nvar),control=list(fnscale=-1,parscale=rep(2000,nvar),factr=1e-300,pgtol=1e-300)))
2019 May 03
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...t;>> $value >>> [1] 100 >>> >>> $counts >>> function gradient >>> 1 1 >>> >>> $convergence >>> [1] 0 >>> >>> $message >>> [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" >>> >>> At the third call, xx has value 9.999 while it should have kept the >>> value 10.001. >>> >> A little follow-up: if you untie the link between xx and x by replacing >> the expression "xx <<- x" by "xx <<- x+0...
2019 May 02
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Dear all, when using optim() for a function that uses the parent environment, I see the following unexpected behavior: makeFn <- function(){ ??? xx <- ret <- NA ??? fn <- function(x){ ?????? if(!is.na(xx) && x==xx){ ?????????? cat("x=", xx, ", ret=", ret, " (memory)", fill=TRUE, sep="") ?????????? return(ret) ?????? } ?????? xx
2010 Aug 06
2
Stopping precision using 'optim'
Hi all~ I am wondering if it is possible to alter the stopping precision for parameters estimated using the 'optim'? If it helps, I am minimizing the log-likelihood of a function using constraints (i.e. L-BFG-S). -Jeremy
2019 May 06
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...>>>> >>>> $counts >>>> function gradient >>>> 1 1 >>>> >>>> $convergence >>>> [1] 0 >>>> >>>> $message >>>> [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" >>>> >>>> At the third call, xx has value 9.999 while it should have kept the >>>> value 10.001. >>>> >>> A little follow-up: if you untie the link between xx and x by replacing >>> the expression "xx <<- x" by...
2008 Mar 07
1
parameters for lbfgsb (function for optimization)
Can anyone help me with lbfgsb (function for optimization)? It takes the following parameters: void lbfgsb (int n, int lmm, double *x, double *lower, double *upper, int *nbd, double *Fmin, optimfn fn, optimgr gr, int *fail, void *ex, double factr, double pgtol, int *fncount, int *grcount, int maxit, char *msg, int trace, int nREPORT); What do I put for parameter ex (11th parameter)? I looked at optim.c codes at R sites and it's a structure that has bunch of objects such as SEXP R_fcall, SEXP R_gcall, SEXP R_env, double* ndeps, etc. I cannot figure...
2019 May 03
0
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...9 100.02 >> $par >> [1] 10 >> >> $value >> [1] 100 >> >> $counts >> function gradient >> ?????? 1??????? 1 >> >> $convergence >> [1] 0 >> >> $message >> [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" >> >> At the third call, xx has value 9.999 while it should have kept the >> value 10.001. >> > A little follow-up: if you untie the link between xx and x by replacing > the expression "xx <<- x" by "xx <<- x+0" it works as expecte...
2007 Jan 03
1
optim
...s: $par [1] 6.018101e-20 6.018101e-20 6.018101e-20 6.018101e-20 0.000000e+00 [6] 5.176245e-21 -4.002183e-21 -8.254019e-20 3.231412e-21 $value [1] 2.768593e-20 $counts function gradient 76 76 $convergence [1] 0 $message [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" Warning messages: 1: bounds can only be used with method L-BFGS-B in: optim(par, errorFunction, gr = NULL, method = "Nelder-Mead", 2: NAs introduced by coercion - What is wrong with the first version? Thanks for the help! Sarah
2019 May 03
0
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...>>>> >>>> $counts >>>> function gradient >>>> 1 1 >>>> >>>> $convergence >>>> [1] 0 >>>> >>>> $message >>>> [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" >>>> >>>> At the third call, xx has value 9.999 while it should have kept the >>>> value 10.001. >>>> >>> A little follow-up: if you untie the link between xx and x by replacing >>> the expression "xx <<- x" by...
2019 May 06
0
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...t; $counts >>>>> function gradient >>>>> 1 1 >>>>> >>>>> $convergence >>>>> [1] 0 >>>>> >>>>> $message >>>>> [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" >>>>> >>>>> At the third call, xx has value 9.999 while it should have kept the >>>>> value 10.001. >>>>> >>>> A little follow-up: if you untie the link between xx and x by replacing >>>> the expression "...
2019 May 06
1
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...t; function gradient >>>>>> 1 1 >>>>>> >>>>>> $convergence >>>>>> [1] 0 >>>>>> >>>>>> $message >>>>>> [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" >>>>>> >>>>>> At the third call, xx has value 9.999 while it should have kept the >>>>>> value 10.001. >>>>>> >>>>> A little follow-up: if you untie the link between xx and x by replacing >>>>&g...
2019 May 03
0
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
...,xx,ret= 10 NA NA out x,xx,ret= 10 10 100 2 in x,xx,ret= 10.001 10 100 out x,xx,ret= 10.001 10.001 100.02 3 in x,xx,ret= 9.999 9.999 100.02 $par [1] 10 $value [1] 100 $counts function gradient ?????? 1??????? 1 $convergence [1] 0 $message [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" At the third call, xx has value 9.999 while it should have kept the value 10.001. Serguei.
2012 May 01
0
Optim (fct): Parameters=LowerBounds
...> "L-BFGS-B",lower =c(0.01,0.01,0.01), upper =c(0.99,0.99,0.99)) >> > out > ----------------------------------- > *$par > [1] 0.01 0.01 0.01* > [...] > $convergence > [1] 0 > > *$message > [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= > PGTOL"*----------------------------------- >
2004 Aug 11
0
always NaN after some running in R, but all fine in S-plus
....2[1] NaN 1.001 10 0.2 0.2 0.2[1] NaN ................ 1 10 0.2 0.2 0.2[1] NaN $par [1] 1.0 10.0 0.2 0.2 0.2 0.1 0.1 0.1 0.1 0.2 0.3 0.5 $value [1] 1e+05 $counts function gradient 1 1 $convergence [1] 0 $message [1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL" Now, the problem seems lie in my C code and algorithm. However, in S-plus, it works fine: > is.loaded("like") [1] T > myoptim(data=data03) Initial parameters are 1 10 0.2 0.2 0.2 0.2 0.1 0.1 0.1 0.1 0.3 0.5 [1] 1.0 10.0 0.2 0.2 0.2 [1] 5834.419 [1] 1.001 10.000 0.2...
2008 Apr 04
2
suggested minor patch for optim.R
...feature freeze for 2.7.0 (?), but I'd appreciate any comments ... *** optim_orig.R 2008-04-04 18:55:42.000000000 -0400 --- optim_new.R 2008-04-04 18:58:56.000000000 -0400 *************** *** 37,46 **** --- 37,50 ---- type = 1, lmm = 5, factr = 1e7, pgtol = 0, tmax = 10, temp = 10.0) + orig.names <- names(con) if (method == "Nelder-Mead") con$maxit <- 500 if (method == "SANN") con$maxit <- 10000 con[(namc <- names(control))] <- control + newnames <- names(control)...
2013 Nov 19
2
Optim function & Hessian matrix
Dear R Users Hi, I have very emergency problems in my programming about finding MLE with optim command. I reproduced it with real data. I guess that my function object in optim is very sensitive because it has power function . Then optim give me lower or initial values for estimates with these warnings for Hessian matrix computation: 1: In log(B2 * (C2^(y + v))) : NaNs produced 2: In log(B3
2007 Oct 23
0
API for optimization with Simulated annealing
...ouble *, double *, void *); +typedef void sagenptry(int, double *, double *, double, void *); void vmmin(int n, double *b, double *Fmin, optimfn fn, optimgr gr, int maxit, int trace, @@ -82,8 +83,8 @@ double *Fmin, optimfn fn, optimgr gr, int *fail, void *ex, double factr, double pgtol, int *fncount, int *grcount, int maxit, char *msg, int trace, int nREPORT); -void samin(int n, double *pb, double *yb, optimfn fn, int maxit, - int tmax, double ti, int trace, void *ex); +void samin(int n, double *pb, double *yb, optimfn fn, sagenptry *new_candidate, + int maxit, int...
2009 Apr 15
2
issue with L-BFGS-B in optim (optim just hangs)
Dear R-Help List, I am using optim, with method=L-BFGS-B, to maximize a likelihood inside a large simulation exercise. This runs fine for most simulated data sets, but for some reason, about 1 out of 100 times, optim will just hang. Using a dumb approach to the problem (i.e. printing the parameter values each time the function being maximized is evaluated), I tracked down when this happens,