shubert | R Documentation |
Shubert-Piyavskii Univariate Function Maximization
shubert(f, a, b, L, crit = 1e-04, nmax = 1000)
f |
function to be optimized. |
a, b |
search between a and b for a maximum. |
L |
a Lipschitz constant for the function. |
crit |
critical value |
nmax |
maximum number of steps. |
The Shubert-Piyavskii method, often called the Sawtooth Method, finds the global maximum of a univariate function on a known interval. It is guaranteed to find the global maximum on the interval under certain conditions:
The function f is Lipschitz-continuous, that is there is a constant L such that
|f(x) - f(y)| \le L |x - y|
for all x, y
in [a, b]
.
The process is stopped when the improvement in the last step is smaller
than the input argument crit
.
Returns a list with the following components:
xopt |
the x-coordinate of the minimum found. |
fopt |
the function value at the minimum. |
nopt |
number of steps. |
Y. K. Yeo. Chemical Engineering Computation with MATLAB. CRC Press, 2017.
findmins
# Determine the global minimum of sin(1.2*x)+sin(3.5*x) in [-3, 8].
f <- function(x) sin(1.2*x) + sin(3.5*x)
shubert(function(x) -f(x), -3, 8, 5, 1e-04, 1000)
## $xopt
## [1] 3.216231 # 3.216209
## $fopt
## [1] 1.623964
## $nopt
## [1] 481
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.