SphereOptimize: Conducting optimization on a unit sphere

Description Usage Arguments Value Examples

View source: R/SphereOptimize.R

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

1
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.

Examples

1
2
3
4
5
6
7
8
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

xieyj17/SphereOptimize documentation built on Sept. 3, 2020, 10:31 p.m.