nlrx (version 0.4.1)

run_nl_one: Execute one NetLogo simulation from a nl object

Description

Execute one NetLogo simulation from a nl object with a defined experiment and simdesign

Usage

run_nl_one(nl, seed, siminputrow, cleanup.csv = TRUE,
  cleanup.xml = TRUE, cleanup.bat = TRUE, silent = TRUE)

Arguments

nl

nl object

seed

a random seed for the NetLogo simulation

siminputrow

rownumber of the input tibble within the attached simdesign object that should be executed

cleanup.csv

TRUE/FALSE, if TRUE temporary created csv output files will be deleted after gathering results.

cleanup.xml

TRUE/FALSE, if TRUE temporary created xml output files will be deleted after gathering results.

cleanup.bat

TRUE/FALSE, if TRUE temporary created bat/sh output files will be deleted after gathering results.

silent

TRUE/FALSE, if FALSE prints the current seed and siminputrow after successful execution of a simulation (only for sequential execution).

Value

tibble with simulation output results

Details

run_nl_one executes one simulation of the specified NetLogo model within the provided nl object. The random seed is set within the NetLogo model to control stochasticity. The siminputrow number defines which row of the input data tibble within the simdesign object of the provided nl object is executed. The logical cleanup variables can be set to FALSE to preserve temporary generated output files (e.g. for debugging). cleanup.csv deletes/keeps the temporary generated model output files from each run. cleanup.xml deletes/keeps the temporary generated experiment xml files from each run. cleanup.bat deletes/keeps the temporary generated batch/sh commandline files from each run.

This function can be used to run single simulations of a NetLogo model.

Examples

Run this code
# NOT RUN {
# Load nl object from test data:
nl <- nl_lhs

# Run one simulation:
results <- run_nl_one(nl = nl,
                      seed = getsim(nl, "simseeds")[1],
                      siminputrow = 1)

# }

Run the code above in your browser using DataCamp Workspace