Skip to contents

Each scenario/iteration/MP has independent OM, observation, and EM state. Environmental random seeds are shared across MPs, not their realised data. Separate EM seeds prevent stochastic estimators affecting the OM stream. Results contain one row per annual decision, plus a manifest and final states.

Usage

run_mse(
  om,
  mps,
  scenarios,
  iterations,
  years,
  seed = 271828L,
  cores = 1L,
  checkpoint_dir = NULL,
  resume = TRUE,
  rng = c("keyed", "cra2_legacy"),
  max_steps = Inf,
  progress = NULL
)

Arguments

om

An mse_om() or om_decamod() adapter.

mps

A list of mp() objects, with unique identifiers.

scenarios

Unique scenario identifiers understood by the OM adapter.

iterations

Positive integer iteration identifiers, not a count.

years

Consecutive modelled projection years.

seed

Non-negative integer master seed.

cores

Worker count. Fork parallelism is available on Unix; other platforms use serial execution. Default one avoids an unexpected large run.

checkpoint_dir

Optional directory for annual RDS checkpoints.

resume

Whether to resume matching checkpoints.

rng

"keyed" uses deterministic seeds keyed by scenario/iteration/year. "cra2_legacy" reproduces the toy seed formula for numerical regression tests; it requires positive integer scenario IDs and rejects designs with overlapping scenario/iteration seeds.

max_steps

Maximum number of additional scenario/year steps this call. Useful for smoke tests; the unchanged design can subsequently resume.

progress

Optional function receiving the newly completed annual rows.

Value

A decamod_mse list with data, manifest, states, and complete.

Details

Checkpoints are immutable, atomic annual files. Resume checks the complete specifications, input fingerprints, runtime versions, and package R code. Existing files are never overwritten, even with resume=FALSE. Cores, progress callbacks, and the execution budget may change on resume.