Skip to contents

It makes sure that if the inputs to the policy choices did not change or the policy choice are identical to the baseline, the simulation is not being executed again and again.

Usage

mod_generic_run_sim_server(
  id,
  run = reactive(NULL),
  presim = reactive(NULL),
  inps = reactive(NULL),
  all_inps = reactive(NULL),
  ceq_progress = reactive(NULL),
  fn_add_missing_inp = add_missing_inp_generic,
  fn_ceq_sim = ceq_sim_generic,
  fn_ceq_pre_postsim = ceq_pre_postsim_generic,
  ...
)

make_run_sim_server(
  fn_add_missing_inp = add_missing_inp_generic,
  fn_ceq_sim = ceq_sim_generic,
  fn_ceq_pre_postsim = ceq_pre_postsim_generic
)

add_missing_inp_generic(inps, all_inps, ...)

ceq_sim_generic(inp, presim, ...)

ceq_pre_postsim_generic(x, ...)

Arguments

run

reactive invalidation variable that signals to run the simulation.

presim

reactive with pre-simulation data

inps

reactive list#'

all_inps

reactive with a complete list of inputs that is passed to `fn_add_missing_inp`.

ceq_progress

is reactive tha contains progress function created with the `fct_make_ceq_progress`

fn_add_missing_inp

a function that takes two vectors with pol. ch. in (`inps` and `all_inps`) and adds missing elements to the first pol. ch. by name.#'

fn_ceq_sim

a function with two inputs: `inps` and `presim`. It must return a single data frame with the simulation results.

fn_ceq_pre_postsim

a function that performs some of the post-simulation calculations that is relevant to perform at this stage. This, for example could be aggregating deciles or creating a bulk of default plots.

Value

a `reactiveVal` object that contains a list of data sets with simulation results, pre-simulations and post simulation data. It is not meant to save space but rather hold all the information in one object. Such results object is a list that consists of: `run`, `policy_sim_raw`, `run_timestamp` and `policy_sim_agg`. All of it is passed to post-sim module.

a function which need to be supplied with arguments of the `mod_generic_run_sim_server` function such as `id`, `run`, `presim`, `inps`, `all_inps`, `ceq_progress`.

Functions

  • mod_generic_run_sim_server(): Generic CEQ runner server that uses CEQ functions to run the analysis based on the `persim` and `inp` args.

  • add_missing_inp_generic(): inputs that are missing to the CEQ inputs list.

  • ceq_sim_generic(): generic function for CEQ simulation

  • ceq_pre_postsim_generic(): generic function for CEQ pre-postsim