Learn R Programming

DiceView (version 3.1-3)

optim.stop: Title optim wrapper for early stopping criterion

Description

Title optim wrapper for early stopping criterion

Usage

optim.stop(
  par,
  fn,
  gr = NULL,
  fn.stop = NA,
  fn.NaN = NaN,
  control = list(),
  ...
)

Value

list with best solution and all solutions

Arguments

par

starting point for optim

fn

objective function, like in optim().

gr

gradient function, like in optim().

fn.stop

early stopping criterion

fn.NaN

replacement value of fn when returns NaN

control

control parameters for optim()

...

additional arguments passed to optim()

Author

Yann Richet, IRSN

Examples

Run this code
fn = function(x) x^6
o = optim( par=15, fn,lower=-20,upper=20,method='L-BFGS-B')
o.s = optim.stop( par=15, fn,lower=-20,upper=20,method='L-BFGS-B',fn.stop=0.1)
#check o.s$value == 0.1 && o.s$counts < o$counts

Run the code above in your browser using DataLab