R Under development (unstable) (2024-05-17 r86566 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(minqa) > > maxfn <- function(x) + 10 - (crossprod(x, seq_along(x)))^2 > negmaxfn <- function(x) -maxfn(x) > > (ans.mx <- newuoa(rep(pi, 4), negmaxfn, control=list(iprint=1))) start par. = 3.141593 3.141593 3.141593 3.141593 fn = 976.9604 At return eval: 83 fn: -10.00000 par: 7.63620 2.53057 -1.63870 -1.94531 parameter estimates: 7.63620390505104, 2.53056961139933, -1.63869581934617, -1.94531390526111 objective: -10 number of function evaluations: 83 > > (ans.mxf<-newuoa(rep(pi, 4), negmaxfn, control=list(iprint=1,maxfun=25))) start par. = 3.141593 3.141593 3.141593 3.141593 fn = 976.9604 At return eval: 25 fn: -9.9998684 par: 7.63098 2.53325 -1.62866 -1.95574 parameter estimates: 7.63097842784621, 2.53325015042389, -1.62865964934577, -1.95574297694737 objective: -9.99986839029905 number of function evaluations: 25 Warning message: In commonArgs(par + 0, fn, control, environment()) : maxfun < 10 * length(par)^2 is not recommended. > > > proc.time() user system elapsed 0.18 0.06 0.23