Skip to contents

opal_build() resolves omitted parameters, maps, and bounds, then checks that the initial objective and gradient are finite. It does not optimise. opal_fit() and opal_mcmc() call it automatically.

Usage

opal_build(x, silent = TRUE)

opal_rtmb(x, fresh = FALSE)

Arguments

x

An opal_obj.

silent

Silence RTMB construction messages.

fresh

Build an isolated objective instead of accessing the cache.

Value

opal_build() returns the updated object; opal_rtmb() returns a transient RTMB objective. Use fresh = TRUE for isolated mutable work.

Details

Call opal_build() before requesting the runtime of an unresolved object. Use opal_rtmb(assessment, fresh = TRUE) for external optimisation, simulation, profiling, or other work that mutates RTMB state. The runtime is transient; save the assessment with opal_save(), not the RTMB object.

Examples

inputs <- opaka_quickstart_inputs()
assessment <- opal_build(opal_obj(inputs$data, inputs$parameters, inputs$map))
runtime <- opal_rtmb(assessment, fresh = TRUE)
runtime$fn(runtime$par)
#> [1] 67665.47