From nashjc at uottawa.ca  Fri Aug  6 22:54:41 2010
From: nashjc at uottawa.ca (Prof. John C Nash)
Date: Fri, 06 Aug 2010 16:54:41 -0400
Subject: [Rd] iteration count in optim()
In-Reply-To: <mailman.17.1281088807.25900.r-devel@r-project.org>
References: <mailman.17.1281088807.25900.r-devel@r-project.org>
Message-ID: <4C5C7691.2080700@uottawa.ca>


> Date: Fri, 6 Aug 2010 11:14:37 +0200
> From: Christophe Dutang <dutangc at gmail.com>
> To: r-devel at r-project.org
> Subject: [Rd] on the optim function
> Message-ID: <7E004A07-03E1-4DED-A506-6C564EDB6BD8 at gmail.com>
> Content-Type: text/plain; charset=us-ascii
>
> Dear useRs,
>
> I have just discovered that the R optim function does not return the number of iterations.
>
> I still wonder why line 632-634 of optim C, the iter variable is not returned (for the BFGS method for example) ?
>
> Is there any trick to compute the iteration number with function call number?
>
> Kind regards
>
> Christophe
>
> --
> Christophe Dutang
> Ph.D. student at ISFA, Lyon, France
> website: http://dutangc.free.fr

For BFGS the number of iterations is the number of gradient evaluations i.e., counts[2]

For most of the optimization tools available for R (not just in optim), these counts are a 
nightmare for developers who want some consistent naming and meaning, as Ravi Varadhan and 
I can attest in our efforts to build the optimx() wrapper. It can also be debated for some 
methods what constitutes an "iteration".

Best, JN



[Rd] iteration count in optim()
Prof. John C Nash