As the posting guide says, please read the help carefully before posting. It does say:

     ‘maxit’ The maximum number of iterations. Defaults to ‘100’ for
          the derivative-based methods, and ‘500’ for ‘"Nelder-Mead"’.
          For ‘"SANN"’ ‘maxit’ gives the total number of function
          evaluations. There is no other stopping criterion.
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          Defaults to ‘10000’.

so this is indicating 'successful convergence' as documented.

On Tue, 20 Oct 2009, Prof. John C Nash wrote:

I think SANN method in optim() is failing to report that it has not converged. Here is an example

genrose.f<- function(x, gs=NULL){ # objective function
## One generalization of the Rosenbrock banana valley function (n parameters)
        n <- length(x)
       if(is.null(gs)) { gs=100.0 }
        fval<-1.0 + sum (gs*(x[1:(n-1)]^2 - x[2:n])^2 + (x[2:n] - 1)^2)
       return(fval)
}

xx<-rep(pi,10)
test<-optim(xx,genrose.f,method="SANN",control=list(maxit=1000,trace=1))
print(test)


Output is:

source("tsann.R")
sann objective function values
initial       value 40781.805639
iter      999 value 29.969529
final         value 29.969529
sann stopped after 999 iterations
$par
[1] 1.0135254 0.9886862 1.1348609 1.0798927 1.0327997 1.1087146 1.1642130
[8] 1.3038754 1.8628391 3.7569285

$value
[1] 29.96953

$counts
function gradient
   1000       NA

$convergence
[1] 0  <------ THIS SHOULD BE 1 ACCORDING TO THE DOCS

It _should_ be 0 according to the help page.


$message
NULL

Note terribly important, but maybe fixable.

Cheers,

John Nash

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


--
Brian D. Ripley,                  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to