g3_optim: Wrapper for stats::optim that returns the g3_cpp parameter...

View source: R/g3_optim.R

g3_optimR Documentation

Wrapper for stats::optim that returns the g3_cpp parameter template with optimised values

Description

Wrapper for stats::optim that returns the g3_cpp parameter template with optimised values

Usage

g3_optim(
  model,
  params,
  use_parscale = TRUE,
  method = "BFGS",
  control = list(),
  print_status = FALSE,
  print_id = "g3_optim",
  check_finite = TRUE,
  ...
)

Arguments

model

Either a g3 model of class 'g3_cpp', i.e., model <- gadget3::g3_to_tmb(actions), or an objective function from gadget3::g3_tmb_adfun(model, param)

params

The parameter template for a g3_cpp classed model.

use_parscale

Should parscale be used g3_tmb_parscale(params), see optim

method

The optimisation method, see optim

control

List of control options for optim, see optim

print_status

Print step comments, does not suppress comments from optim call (see control$trace)

print_id

A character string appended to the print statements (useful for when running g3_optim in parallel)

check_finite

boolean Should we check that initial/final conditions produce finite results before running?

...

Further arguments to be passed gadget3::g3_tmb_adfun, see g3_tmb_adfun

Value

A g3_cpp parameter template with optimised values


gadget-framework/gadgetutils documentation built on Nov. 11, 2024, 6:25 p.m.