SequentialLineMin {scdensity} | R Documentation |
Minimize a function of r variables by sequential univariate searches.
Description
The function seeks to minimize fcn
, a scalar function of variables.
v0
is a starting solution and bounds
is a 2-vector giving upper and lower limits for
elements of the solution.
Usage
SequentialLineMin(fcn, bounds, v0, tol = .Machine$double.eps^0.25)
Arguments
fcn |
A function with taking an r-vector as its first argument: call as |
bounds |
A 2-vector giving the upper and lower limits for elements of a solution. |
v0 |
A starting solution, with increasing elements. An r-vector. Not used if r == 1. |
tol |
Tolerance passed to |
Details
This algorithm is designed to search for solutions of the form ,
where
bounds(1)
bounds(2)
. It loops through the solution vector
one variable at a time, and does a 1-D line search using optimize()
for an improving
value of that variable. So when optimizing , it searches the interval
to maintain the increasing nature of
. The overall search terminates once a
pass through all
elements of
fails to produce any changes to
.
Value
a list with elements:
minimizer |
An r-vector containing the solution. |
minimum |
The objective function value at the solution. |
Examples
fcn <- function(v) (v[1]+1)^2 + (v[2]-1)^2
SequentialLineMin(fcn, c(-5,5), c(-3,3))