nl_run R Documentation

Run NetLogo experiment

Description

Runs NetLogo model for defined every parameter and repetitions. Returns a list of data frames for each measure defined in experiment.

Usage

nl_run(experiment, print_progress = FALSE, gui = FALSE, parallel = FALSE,
  max_cores = NULL)

Arguments

experiment

NetLogo experiment object

print_progress

Set to TRUE if you want to follow the progress in the console

gui

Start NetLogo with GUI (by default NetLogo is run in headless mode)

parallel

Runs experiment in parallel worker processes (requires parallel package)

max_cores

(optional) only relevant if parallel = TRUE. If not defined all available processors will be used

Details

Model is run for each parameter combination defined in parameter sets If repetition (defined in experiment) is greater than 1 then each run for a parameter set is repeated accordingly. Before each run the parameters are set and setup procedure(s) are called. After each run criteria function(s) are calculated (if defined)

Use parallel option if there are more than a few runs per processor core.

Value

Returns an object of class nl_result. It is a list containing at most the following components:

step

a data frame with observations based on temporal (step) measures. It includes at least param_set_id (id of parameter set), run_id (ID of simulation repetition ), step_id (ID of simulation step ), and columns named after the temporal measures

run

a data frame with observations based on final run measures. It includes at least param_set_id (id of parameter set), run_id (ID of simulation repetition ), and columns named after the temporal measures

agents_after

a data frame with observations based on agents after each simulation run

agents_before

a data frame with observations based on agents before each simulation run

patches_after

a data frame with observations based on patches after each simulation run

patches_before

a data frame with observations based on patches before each simulation run

criteria

a data frame with values provided by criteria expressions (eval_criteria in experiment definition possibly aggregated by eval_aggregate_fun) and additional criteria defined by eval_mutate expressions

export

a filename list with reference to parameter sets and simulation repetitions

duration

time spent to complete the experiment (in difftime)

experiment

original NetLogo experiment object used

See Also

See nl_experiment for creating NetLogo experiment object.