Description Usage Arguments Examples
View source: R/lineSearch_NAPA.R
line searching algorithm used inside non-APA optimization algorithms.
1 2 3 4 5 6 7 8 9 10 | lineSearch_NAPA(
x_curr,
dk,
func,
grad_Fx = NULL,
stepMod = 0,
tolerance = 10^-8,
lineSearchMaxSteps = 10,
...
)
|
x_curr |
starting x value |
dk |
direction vector to search along |
func |
function to perform line search on |
grad_Fx |
(defaults to NULL) if not NULL, the gradient of func at x_curr |
lineSearchMaxSteps |
maximum number of iterations before stopping |
... |
extra parameters passed on to func |
1 2 3 4 5 6 7 8 9 10 11 | # simple 1D quadratic function optimization
lineSearch_NAPA(x_curr = 1, dk = -0.2, lineSearchMaxSteps = 100, func = function(x) {x^2})
# simple 2D quadratic function optimization
func2 <- function(par, centerx=0, centery=0) {
(par[1]-centerx)^2+(par[2]-centery)^2
}
lineSearch_NAPA(x_curr = c(.015,-.015), dk = c(-0.2,0.2), func=func2)
lineSearch_NAPA(x_curr = c(2.05), dk = c(-0.2), func=function(x) { -prod(dpois(c(1,2,3), x))})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.