Description Usage Arguments Details Value Examples
Create parameter sets with Latin Hypercube sampling or monte carlo
1 2 3 4 5 | nl_param_random(n, ..., FUN)
nl_param_mc(n, ...)
nl_param_lhs(n, ...)
|
n |
Number of parameter sets |
... |
Parameters with ranges (numeric vectors) or a data frame with parameters as columns or a list of parameter values |
FUN |
A function with parameters n and k, returns a matrix with k columns and numeric double values in range from 0 to 1 |
nl_param_lhs
returns n parameter value sets with LHC sampling.
It uses lhs::randomLHS
function and requires lhs package.
nl_param_mc
returns n parameter value sets with random parameters.
nl_param_random
returns n parameter value sets with custom defined method.
A data frame with parameter value sets
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | experiment <- nl_experiment(
model_file = "models/Sample Models/Biology/Flocking.nlogo",
setup_commands = c("setup", "repeat 100 [go]"),
iterations = 5,
param_values = nl_param_lhs(
n = 100, # create 100 parameter value sets
world_size = 50,
population = 80,
vision = 6,
min_separation = c(0, 4),
max_align_turn = c(0, 20)
),
mapping = c(
min_separation = "minimum-separation",
max_align_turn = "max-align-turn"),
step_measures = measures(
converged = "1 -
(standard-deviation [dx] of turtles +
standard-deviation [dy] of turtles) / 2",
mean_crowding =
"mean [count flockmates + 1] of turtles"
),
eval_criteria = criteria(
c_converged = mean(step$converged),
c_mcrowding = mean(step$mean_crowding)
),
repetitions = 10, # repeat simulations 10 times
random_seed = 1:10,
eval_aggregate_fun = mean # aggregate over repetitions
)
# custom sampling method must return a n x k matrix:
nl_param_random(
n = 5,
foo = c(1, 2),
bar = c(100, 200),
baz = 4,
FUN = function(n, k) matrix(runif(n*k), ncol = k)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.