optimize for global optimization.The univariate optimize can stop at arbitrarily bad points when
f is not unimodal. This functions mitigates this effect in a very naive way:
interval is subdivided into nsub equally sized subintervals,
optimize is run on all of them (and on the original big interval) and
the best obtained point is returned.
optimizeSubInts(
f,
interval,
...,
lower = min(interval),
upper = max(interval),
maximum = FALSE,
tol = .Machine$double.eps^0.25,
nsub = 50L
)See optimize.