Bug 15103 - optim() with L-BFGS-B: mismatch printing of initial evaluation according to trace
optim() with L-BFGS-B: mismatch printing of initial evaluation according to t...
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Analyses
R 2.15.1 patched
All All
: P5 minor
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-08 22:31 UTC by Mat
Modified: 2013-01-02 17:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mat 2012-11-08 22:31:27 UTC
Hi

As a non.expert user, I found the trace output of optim() with L-BFGS-B quite difficult to follow. Indeed, with iter 0, it is not the initial function evaluation that is shown. More confusing is that with trace=3, what is called iteration 0 seems to correspond to the initial evaluation. 


My feeling is that with trace=1, iter 0 (i) actually reports iter 1 (i+1), but i might be wrong. See however quick example:

> fr2 <- function(x)  100 * (x[2] - x[1] )^2 
+ fr2(c(1.5,5))
[1] 1225
+ par <-optim(c(1.5,5), fr2, control=list(trace=1,REPORT=1), method="L-BFGS-B")$par
iter    0 value 435.050506
iter    1 value 0.000000
[skip]
+ par <-optim(c(1.5,5), fr2, control=list(trace=3,REPORT=1), method="L-BFGS-B")$par
[skip]
At iterate     0  f=         1225  |proj g|=          700
At iterate     1  f =       435.05  |proj g|=        417.16
[skip]

Best

Matthieu