Title: | Function Minimum Approximator |
---|---|
Description: | Tool to find where a function has its lowest value(minimum). The functions can be any dimensions. Recommended use is with eps=10^-10, but can be run with 10^-20, although this depends on the function. Two more methods are in this package, simple gradient method (Gradmod) and Powell method (Powell). These are not recommended for use, their purpose are purely for comparison. |
Authors: | János Hevner |
Maintainer: | János Hevner <[email protected]> |
License: | GPL-3 |
Version: | 1.0.5 |
Built: | 2024-09-01 06:51:22 UTC |
Source: | CRAN |
Approximate a functions minimum with double monoton method.
BarBor(exp,eps,x,v,n)
BarBor(exp,eps,x,v,n)
exp |
Expression of the function to be minimized. |
eps |
Precision of the approximation, recommended value is 10^-10. |
x |
Starting point of the approximation. |
v |
A character vector of the functions variables, for instance the two dimension fuction x1*x1+10*x2*x2 needs a c("x1","x2") vector. |
n |
Maximum setps to make while approximating, if the calculation reaches this number it exits with the current value and point. Recommended to be 10000. |
test1 = expression(x1*x1+10*x2*x2) eps = 10^-15 x = c(3,4) v = c("x1","x2") n = 10000 BarBor(test1,eps,x,v,n)
test1 = expression(x1*x1+10*x2*x2) eps = 10^-15 x = c(3,4) v = c("x1","x2") n = 10000 BarBor(test1,eps,x,v,n)
Same approximation method as the BarBor function, but this doesn't print out anything. Its recommended use is for timing the approximation.
BarBorNoPrint(exp,eps,x,v,n)
BarBorNoPrint(exp,eps,x,v,n)
exp |
Expression of the function to be minimized. |
eps |
Precision of the approximation, recommended value is 10^-10. |
x |
Starting point of the approximation. |
v |
A character vector of the functions variables, for instance the two dimension fuction x1*x1+10*x2*x2 needs a c("x1","x2") vector. |
n |
Maximum setps to make while approximating, if the calculation reaches this number it exits with the current value and point. Recommended to be 10000. |
test1 = expression(x1*x1+10*x2*x2) eps = 10^-15 x = c(3,4) v = c("x1","x2") n = 10000 BarBorNoPrint(test1,eps,x,v,n)
test1 = expression(x1*x1+10*x2*x2) eps = 10^-15 x = c(3,4) v = c("x1","x2") n = 10000 BarBorNoPrint(test1,eps,x,v,n)
Gradient method for approximating a functions minimum value. The purpose of this method is to compare its result with the BarBor method.
Gradmod(exp,eps,G,B,m,x,v,n)
Gradmod(exp,eps,G,B,m,x,v,n)
exp |
Expression of the function to be minimized. |
eps |
Precision of the approximation, recommended value is 10^-10. |
G |
Inner approximation coefficient, recommended value is 10^-2. |
B |
Inner approximation coefficient, recommended value is 0.5. |
m |
Inner steps, recommended value is 20. |
x |
Starting point of the approximation. |
v |
A character vector of the functions variables. Exmaple: the two dimension fuction x1*x1+10*x2*x2 needs a c("x1","x2") vector. |
n |
Maximum setps to make while approximating, if the calculation reaches this number it exits with the current value and point. Recommended to be 10000. |
test1 = expression(x1*x1+10*x2*x2) eps = 10^-10 G = 10^-2 B = 0.5 m = 20 x = c(3,4) v = c("x1","x2") n = 10000 Gradmod(test1,eps,G,B,m,x,v,n)
test1 = expression(x1*x1+10*x2*x2) eps = 10^-10 G = 10^-2 B = 0.5 m = 20 x = c(3,4) v = c("x1","x2") n = 10000 Gradmod(test1,eps,G,B,m,x,v,n)
Powell's method for finding a function local minimum. The function need not be differentiable, and no derivatives are taken. The function must be a real-valued function of a fixed number of real-valued inputs.
Powell(exp,eps,G,eta,m,k,x,v,n)
Powell(exp,eps,G,eta,m,k,x,v,n)
exp |
Expression of the function to be minimized. |
eps |
Precision of the approximation, recommended value is 10^-10. |
G |
Inner approximation coefficient, recommended value is 10^-2. |
eta |
Inner approximation coefficient, recommended value is G*2. |
m |
Inner steps, recommended value is 20. |
k |
Second inner approximation steps, recommended value is 20. |
x |
Starting point of the approximation. |
v |
A character vector of the functions variables. Exmaple: the two dimension fuction x1*x1+10*x2*x2 needs a c("x1","x2") vector. |
n |
Maximum setps to make while approximating, if the calculation reaches this number it exits with the current value and point. Recommended to be 10000. |
test1 = expression(100*(x1*x1-x2)*(x1*x1-x2)+(1-x1)*(1-x1)) eps = 10^-5 G = 10^-2 eta = G *2 m = 20 k = 20 n = 10000 max = 1000 x = c(1,1) v = c("x1","x2") Powell(test1,eps,G,eta,m,k,x,v,n)
test1 = expression(100*(x1*x1-x2)*(x1*x1-x2)+(1-x1)*(1-x1)) eps = 10^-5 G = 10^-2 eta = G *2 m = 20 k = 20 n = 10000 max = 1000 x = c(1,1) v = c("x1","x2") Powell(test1,eps,G,eta,m,k,x,v,n)