qnbd {n1qn1} | R Documentation |
This is an R port of the qnbd which is a BFGS-B optimization procedure in scilab. (R has L-BFGS-B).
qnbd(par, fn, gr, lower = -Inf, upper = Inf, environment = parent.frame(1), zero = sqrt(.Machine$double.eps/7e-07), maxFn = 10000L, maxIt = 10000L, epsf = sqrt(.Machine$double.eps), epsg = sqrt(.Machine$double.eps), epsx = sqrt(.Machine$double.eps), print.functions = FALSE)
par |
Initial parameter estimate |
fn |
Function |
gr |
Gradient |
lower |
Lower Bound for optimization |
upper |
Upper Bound for optimization |
environment |
Environment where call_eval/call_grad are evaluated. |
zero |
Tolerance for Zero |
maxFn |
Maximum function evaluations |
maxIt |
Maximum iterations |
epsf |
Function eps for exiting |
epsg |
Gradient eps for exiting |
epsx |
Parameter eps for exiting |
print.functions |
Boolean to control if the function value and parameter estimates are echoed every time a function is called. |
## Rosenbrock's banana function n=3; p=100 fr = function(x) { f=1.0 for(i in 2:n) { f=f+p*(x[i]-x[i-1]**2)**2+(1.0-x[i])**2 } f } grr = function(x) { g = double(n) g[1]=-4.0*p*(x[2]-x[1]**2)*x[1] if(n>2) { for(i in 2:(n-1)) { g[i]=2.0*p*(x[i]-x[i-1]**2)-4.0*p*(x[i+1]-x[i]**2)*x[i]-2.0*(1.0-x[i]) } } g[n]=2.0*p*(x[n]-x[n-1]**2)-2.0*(1.0-x[n]) g } x = c(1.02,1.02,1.02) op1 <- qnbd(x, fr, grr)