[Rd] optimize() and extrema at the interval bounds

Peter Ruckdeschel Peter.Ruckdeschel at uni-bayreuth.de
Tue May 2 11:34:06 CEST 2006


Dear r-devels,

by construction, optimize() only evaluates the objective function
*inside* the bounds of argument 'interval'.

It does not seem to be an 'extremely' rare case that extrema are attained
*at* the bounds of argument 'interval' :-)

It is fairly easy to write a wrapper to optimize()
enforcing an evaluation of the objective function at these
bounds, too, but wouldn't it be a good idea to a add an
extra argument 'evalbounds' of optimize() defaulting to FALSE
(behavior of optimize() as it is now), but which if TRUE
does evaluate the objective at the bounds?

I do not know how costly two extra evaluations are in general
as to computation time at evaluation of optimize(), nor
how many conflicts of unmatched arguments an extra argument
to optimize() would cause; so consider this just as a proposal.

Thank you for your attention,
Peter



More information about the R-devel mailing list