adaptive_shell_solver: shell_solver with precision

Description Usage Arguments Examples

View source: R/shell_solver.R

Description

A shell_solver that can compute the qoi with expected precision. precision becomes mandatory argument of run() method.

Usage

1
2
3
4
5
6
7
8
adaptive_shell_solver(
  cmd,
  nparams,
  qoi_file,
  required_args = "precision",
  arg_combine_fn = function(x, precision, ...) paste(c(x, precision), collapse = " "),
  ...
)

Arguments

cmd

command to run the solver executable.

nparams

numeric, number of parameters, must be provided.

qoi_file

name of file containing the computed quantity of interest, may be absolute or relative to wd, cannot be NULL.

required_args

character, mandatory args for run().

arg_combine_fn

function producing appropriate numeric scalar from point and precision for solver command line

...

other args passed to shell_solver().

Examples

1
2
3
4
5
6
7
8
9
rscript_path <- file.path(R.home(), "bin", "Rscript")
solver_path <-
  file.path(find.package("solvergater"), "exec", "fake_adaptive.R")
nparams <- 2
nqoi <- 5
solver_cmd <- paste(rscript_path, solver_path, nparams, nqoi)
s <- adaptive_shell_solver(solver_cmd, nparams = nparams,
qoi_file = "output_qoi", jacobian_file = "output_jacobian", wd = tempdir())
run(s, c(20, 5), precision = 90)

maciejsmolka/solvergater documentation built on Jan. 1, 2021, 8:28 a.m.