Skip to contents

Builds a deterministic, globally shuffled task plan and groups tasks into batches for staged execution.

Usage

cs_plan_campaign(
  dgp_list,
  estimator_list,
  n_seeds,
  batch_size = 50L,
  campaign_seed = 1L,
  strategy_map = list()
)

Arguments

dgp_list

Character vector of DGP ids.

estimator_list

Character vector of estimator ids.

n_seeds

Integer count or integer vector of seeds.

batch_size

Integer batch size (tasks per batch).

campaign_seed

Integer seed for deterministic shuffling.

strategy_map

List of defaults and/or per-estimator overrides. Use list(defaults = list(...), overrides = list(est_id = list(...))). The resolved config is attached to each task (defaults + per-estimator overrides via modifyList). Common fields include:

  • n: sample size per run (required by the worker; overrides any global n).

  • seed: per-task RNG seed (usually not overridden; use n_seeds instead).

  • ci_method: one of "none", "default", "bootstrap", "native" (see cs_ci_methods).

  • n_boot: number of bootstrap draws.

  • tau: custom quantile grid (numeric vector).

  • num_threads: force single-threaded estimators.

  • estimator-specific hyperparameters (e.g., num_trees, n_draws).

Value

A tibble with columns batch_id and tasks (list-column).

Examples

plan <- cs_plan_campaign(
  dgp_list = c("synth_baseline"),
  estimator_list = c("lm_att", "ipw_att"),
  n_seeds = 1:4,
  batch_size = 2,
  campaign_seed = 123,
  strategy_map = list(
    defaults = list(n = 200, n_boot = 200, ci_method = "bootstrap"),
    overrides = list(ipw_att = list(n_boot = 100))
  )
)
plan
#> # A tibble: 4 × 2
#>   batch_id tasks            
#>      <int> <named list>     
#> 1        1 <tibble [2 × 11]>
#> 2        2 <tibble [2 × 11]>
#> 3        3 <tibble [2 × 11]>
#> 4        4 <tibble [2 × 11]>
if (FALSE) { # \dontrun{
# Advanced planned-batch execution
cs_run_campaign(
  plan = plan,
  staging_dir = "staging_batches",
  workers = 2,
  experimental_parallel = TRUE
)

# Ordinary grid execution uses the dedicated grid entry point
cs_run_grid(
  dgp_ids = c("synth_baseline"),
  estimator_ids = c("lm_att", "ipw_att"),
  seeds = 1:4,
  n = 200,
  config = list(ci_method = "bootstrap")
)
} # }