run.algorithm: Apply a template algorithm file to an objective function

View source: R/algorithm.R

run.algorithmR Documentation

Apply a template algorithm file to an objective function

Description

Apply a template algorithm file to an objective function

Usage

run.algorithm(
  algorithm_file,
  objective_function,
  input,
  output = NULL,
  options = NULL,
  work_dir = ".",
  trace = function(...) cat(paste0(..., "\n")),
  silent = FALSE,
  save_data = TRUE
)

Arguments

algorithm_file

templated algorithm file

objective_function

function to apply algorithm on

input

list of input arguments of function (eg. list(x1=list(min=0,max=1),x2=list(min=10,max=20)))

output

list of output names

options

algorithm options to overload default ones

work_dir

working directory to run algorithm. will store output files, images, ..

trace

display running info

silent

quietness

save_data

enable (by default) saving of data (in .Rds) along algorithm iterations.

Value

algorithm result (and algorithm object & files as attributes)

Examples

run.algorithm(
  system.file("Brent.R", package="templr"),
  function(x) sin(x)-0.75,
  list(x=list(min=0,max=pi/2)),
  work_dir=tempdir()
  )

templr documentation built on Oct. 25, 2022, 5:05 p.m.