-
Notifications
You must be signed in to change notification settings - Fork 0
StochOptim stochastic optimization in R
R has a number of tools for what is termed optimization. This is the process of finding the minimum (or maximum) of a function of a vector parameters, b, and exogenous data, Y, by varying the values of the elements of b to attain the least (or greatest) value of the function. There may be other conditions, or constraints imposed. Note that we can maximize a function by minimizing (-1) times that function, and we will generally minimize.
Many of the R optimization tools, either in the base distribution or in packages, particularly those in the official CRAN (https://cran.r-project.org) or other collections, are for functions that have just one optimum in a region. Other tools try to find the best of several multiple minima or the global minimum. Most of these tools use stochastic methods.
Many programmers have contributed over better than half a century to the development of optimization tools. This has led to a wide variety of ways in which the tools are invoked. In R, a wide variety of calling sequences exist for the different methods. This is burdensome for users. If they have prepared a function to minimize, they must learn and code a different call for each method.
To ease this burden, wrapper programs can be prepared that are invoked by a standard syntax within which a single argument (possibly augmented by some control parameters) selects one of a set of optimization solvers. This is the case for the package optimx (??ref??) for a number of optimization solvers that deal with finding a local minimum, possibly subject to lower and upper bounds on the objective function parameters. Moreover, there is the facility to use the "opm()" function to try several solvers in a single call and generate a comparison table of results.
For stochastic/global optimization solvers, there is no such wrapper as yet. The creation of such a wrapper is the goal of this proposal.
This project was proposed in the 2022 GSoC competition and a contributor started to work, but was unable to continue.
The optimx package gives an example that is closest to the goal of the current proposal.
There is also the R Optimization Infrastructure (ROI), but this uses a rather different approach and is less a wrapper than a set of interfaces.
This project will attempt to provide a common calling structure for a number of stochastic optimization tools already available for R.
We believe that the output of this project would be an R package similar in structure to optimx. That is, besides obeying R general package requirements, it should have tools to
- execute one of a set of stochastic optimizers using a standard syntax, given an appropriate character string "method" that specifies the particular solver
- execute a set of methods in a vector of character strings in "method" and return a data frame with the results.
Details of your coding project What exactly do you want your student to code in the 3-month deadline? What functions? What do they do? Docs? Tests? Vignettes?
optimx has proved helpful in allowing developers of other packages to offer multiple solvers with their programs with minimal extra effort. We believe a wrapper for stochastic optimizers will be at least as helpful.
It is also likely that a wrapper will permit better comparison and benchmarking of stochastic optimization tools in R.
No tool of this type exists at the moment to our knowledge.
- John C. Nash ([email protected]); Github https://github.com/nashjc/
- Hans Werner Borchers ([email protected]) ; https://github.com/hwborchers
- Paulo Cortez ([email protected])
Students, please contact mentors after completing at least some of the tests below.
All tests should be answered in a Rmarkdown file (part of the test is to see that you can do this). All program codes should be in R.
The Rastrigin function is a well-known test function with many local minima in n dimensions. Find an implementation of this function in R (or write your own). Display the function in a 3D plot and make a guess of what the global minimum might be.
Rated: Easy
Try to find several local minima of the Rastrigin function by employing 'optim()', for instance by using different starting points or varying other options.
Apply at least one other local minimizer -- as found in the section "General Purpose Continuous Solvers" of the Optimization Task View -- to the Rastrigin function and compare it with the minima found before.
Rated: Moderate
Try minimizing the Rastrigin function using three other (and preferably very different) stochastic optimization tools from CRAN. See section "Global and Stochastic Optimization" of the Optimization Task View.
What are some important options of the global solver tools that you employ? Can you improve the solutions by changing the values of some options?
Rated: Moderate
Find more test functions for global optimization. See for example the JSS report "Continuous Global Optimization in R" by Kate Mullen, or take a look at the book "Modern Optimization with R" by P. Cortez
Rated: Easy
Formulate your answers as an RMarkdown document. Package the test functions you looked at as an R package that can be checked with "R CMD check".
Rated: Moderate
Once we agree on the tests, we can provide solutions in a private file.
Arqam Patel, https://github.com/arqamrp , https://github.com/arqamrp/stochoptimtests .
Essam Wisam, GITHUB PROFILE, TEST RESULTS
EXAMPLE STUDENT 3, LINK TO GITHUB PROFILE, LINK TO TEST RESULTS.
R GSOC FAQ https://github.com/rstats-gsoc/gsoc2022/wiki/R-GSOC-FAQ