Thank you all very much for the suggestions, after testing, each of them would
be a viable solution in certain contexts. Code for benchmarking:
# preliminaries
install.packages("microbenchmark")
library(microbenchmark)
data <- new.env()
data$ans2 <- 0
data$ans3 <- 0
data$i <- 0
data$fun.value
Dear all,
I have used optim a lot in contexts where it would useful to be able to iterate
function myfun that, in addition to the primary objective to be minimized
('minimize.me'), could return other values such as alternative metrics of the
minimization, informative intermediate values from th