ljoptim {cops}R Documentation

(Adaptive) Version of Luus-Jakola Optimization

Description

Adaptive means that the search space reduction factors in the number of iterations; makes convergence faster at about 100 iterations

Usage

ljoptim(
  x,
  fun,
  ...,
  red = ifelse(adaptive, 0.99, 0.95),
  lower,
  upper,
  acc = 1e-06,
  accd = 1e-04,
  itmax = 1000,
  verbose = 0,
  adaptive = TRUE
)

Arguments

x

optional starting values

fun

function to minimize

...

additional arguments to be passed to the function to be optimized

red

value of the reduction of the search region

lower

The lower contraints of the search region

upper

The upper contraints of the search region

acc

if the numerical accuracy of two successive target function values is below this, stop the optimization; defaults to 1e-6

accd

if the width of the search space is below this, stop the optimization; defaults to 1e-4

itmax

maximum number of iterations

verbose

numeric value hat prints information on the fitting process; >2 is extremely verbose

adaptive

should the adaptive version be used? defaults to TRUE.

Value

A list with the components (see also optim)

Examples

fbana <- function(x) {
x1 <- x[1]
x2 <- x[2]
100 * (x2 - x1 * x1)^2 + (1 - x1)^2
}
res1<-ljoptim(c(-1.2,1),fbana,lower=-5,upper=5,accd=1e-16,acc=1e-16)
res1

set.seed(210485)
fwild <- function (x) 10*sin(0.3*x)*sin(1.3*x^2) + 0.00001*x^4 + 0.2*x+80
plot(fwild, -50, 50, n = 1000, main = "ljoptim() minimising 'wild function'")
res2<-ljoptim(50, fwild,lower=-50,upper=50,adaptive=FALSE,accd=1e-16,acc=1e-16)
points(res2$par,res2$value,col="red",pch=19)
res2


[Package cops version 1.3-1 Index]