Provides a replacement and extension of the optim() function to call to several function minimization codes in R in a single statement. These methods handle smooth, possibly box constrained functions of several or many parameters. Note that function 'optimr()' was prepared to simplify the incorporation of minimization codes going forward. Also implements some utility codes and some extra solvers, including safeguarded Newton methods. Many methods previously separate are now included here. This is the version for CRAN.
NEWS about R package optimx
TODO o Rvmmin gives warning when called with no gradient. Use control "usenumDeriv=TRUE" to overcome this. 130411
o The bdmsk vector is set clumsily for Rvmmin.
o Fix obscure bug when Inf specified for one bound only for Rvmmin.
o Keep hessOK TRUE even if we must symmetrize Hessian. o Fix issue that gr=NULL did not use "grfwd" for Rvmmin, Rcgmin
o Change startup to avoid warning messages for missing methods. Add function to check which methods available. o UOBYQA is present in optimx.run.R, but is not included in the list of "all.methods" in optimx.setup.R. It should be possible to run UOBYQA by including "uobyqa" in the list of methods in a direct call to optimx.run.R.
o patch for missing "details" behaviour o point to example of use of "follow.on" control
o added control usenumDeriv
o improved coef() function to extract parameters
o removed optansout.R, get.result.R, get.best.R (no longer needed)
o added optimx<-.coef
o removed help pages documenting obsolete features
o nmkb and hjkb had no ... arguments in call. Fixed. o L-BFGS-B (and possibly other optim() methods) return no gevals (count[]) on failure. Forced to NA in case of try-error.
o Fixed maximize of function without gradient function. Also glitch (not tested or encountered) with user supplied Hessian function when maximizing. o Separate .Rd files for coef() and summary() o Use have.bounds to select bounds and unconstrained methods where there is a choice to avoid duplication of tests. This has been done for hjk, nmk, Rcgmin, Rvmmin o Revision of output description in optimx.Rd; some simplifications. o Parameter names preserved from starting vector, or "p1", "p2", etc. used. There is a test for these in the ox demo().
o in summary.optimx no re-ordering is now specified using order = NULL o Fixup of examples -- simplified, corrected call to details
o in summary.optimx the order= argument may now be an unevaluated expression (as before), a string representation of that expression or a character vector of names, e.g. these all work: order = value # unevaluated expression order = "value" # character string containing column name order = list(fevals, gevals) # unevaluated list order = c("fevals", "gevals") # character vector of column names order = list(round(value,3), fevals) # unevaluated list order = "list(round(value,3),fevals)" # expression as string
o Note that asking for a method that is NOT in the results will return a row with rowname (the method name) as "NA". Note that this will NOT test TRUE with is.na() on the rowname. Use instead a test like (row.names(ans8missmeth["Rvmmin",])[] == "NA") o kkt1 and kkt2 in results now returned TRUE/FALSE as in 2012 versions o Fixed error in kkt2 test (using old name evnhatend rather than hev) o Results are no longer sorted by optimx, but can be using the 'summary()' function. This can be called in a variety of ways. ?? see examples in?? o The 'details' are always kept in a matrix form, even when only one method has been used. o 'convcode' is used in place of 'convergence' in result structure o There is a directory inst/interactive-test that contains ox.R test script that pauses so user can see interim results. o As a result of several issues, the result structure is changed from that of optimx 2012 versions. It is now a data frame with a `details' attribute. Also an 'npar' attribute to give the number of parameters, and a 'maximize' attribute that is TRUE when the function is to be maximized.
o print.optimx dropped. Not needed as print defaults to print.data.frame. o added summary.optimx which has order= and par.select= arguments o order= is an expression or list of expressions using the column names of the "optimx" object as variables (plus the variable rownames). o par.select = FALSE now has same meaning as par.select = 0 (rather than being an error) o [.optimx now subsets details attribute too o method column from details attribute dropped and moved to row names
o created unit test framework with 2 unit tests in inst/unitTests/runit.all.R. To run: demo("unitTests")
o [.optimx and as.data.frame.optimx added o coef.optimx fixed to reflect new ans.ret
o ans.ret structure changed
o maximize works with print(x, best.only=TRUE) o KKT checks can be switched off. Decided to NOT separate the code from optimx.run UNTESTED o optimx.setup, optimx.run, optimx.check are NOT exported in NAMESPACE, but a knowledgeable user could use these codes directly, either from the source code or by modifying the package locally.
o removed method= and columns= arguments from print.optimx and added best.only o removed print.optimx help page and moved it to the optimx help page o the row names of the optimx output now show the method and the method column has been removed
o Removed all user accessible functions except optimx and added print.optimx.
TODOS: Check the maximize flag works in all routines, especially get.best. Splitting of optimx so preparation and loading is separate from running. all.methods = TRUE ?? o get.result now emits a warning if method requested is not in optimx solution o attempt 2013-3-17 to include summary() in methods to replace trimpars()