Reflection 1, expansion 2, contraction 1/2 and shrink 1/2 with the ordering and acceptance rules of Lagarias et al. (1998); the initial simplex is x0 plus step_i e_i, step_i = 0.1 max(1, |x0_i|). Stops when the simplex diameter about the best vertex is at most xtol and the value spread at most ftol.
References
Nelder, J. A. and Mead, R. (1965). A simplex method for function minimization. Computer Journal 7, 308-313. Lagarias, J. C., Reeds, J. A., Wright, M. H. and Wright, P. E. (1998). SIAM Journal on Optimization 9, 112-147.
Examples
NelderMead(function(x) (x[1] - 1)^2 + (x[2] + 2)^2, c(0, 0))$x
#> [1] 1 -2
