SphereOptimize {SphereOptimize} | R Documentation |
Conducting optimization on a unit sphere
Description
The function SphereOptimize conducts optimization on a unit sphere. If the size of neighbor near the initial value is specified, the L-BFGS-B opitmization algorithm will be called. Otherwise this function searches the whole unit sphere using Nelder-Mead algorithm by default. Other optimization methods are allowed.
Usage
SphereOptimize(par, fn, neighbor = NULL, ...)
Arguments
par |
Initial values for the parameters to be optimized over. Must be in Cartesian coordinates and on a unit sphere. |
fn |
A function to be minimized (or maximized). |
neighbor |
Radius of neighbor to search for the optimal results. If not specified, this function will search for the whole unit sphere. |
... |
Extra arguments that can be passed to optim(). |
Value
A list compose three items.
par The optimal restuls found.
value The value of fn corresponding to par.
method The optimization algorithm used.
Examples
fn = function(s){
return(sum(s^3))
}
s = c(sqrt(2)/2,sqrt(2)/2)
k = SphereOptimize(s, fn, control = list(fnscale = -1))
k$value
k$par