run_parallel: Title Runs run_simulation in parallel over parameters...

Description Usage Arguments Value Examples

Description

Title Runs run_simulation in parallel over parameters Provides a wrapper to perform a line search of a parameter and returns the results of run_simmulation with the parameters specified.

Usage

1
run_parallel(params, varied_parameter, from, to, by, ...)

Arguments

params

Parameters for 'run_simulation'

varied_parameter
from

Starting value of varied parameter, See 'seq'.

to

Final value of varied parameter. See 'seq'.

by

Increment value. See 'seq'.

mc_opts

Options for mclapply, setting mc.cores is a good idea.

Value

A list of the result of calling run_simulation with the varied parameter.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 params <- list(max_gens = 100,
                males_per_winner = 20,
                num_nests = 50,
                density = 1,
                metabolism = 1,
                female_mat_time = 10, 
                maturation_rate = 1,
                mutation_rate = 0.1,
                mutation_sd = 0.1,
                mass_to_energy = 10,
                growth_a = 0.5,
                growth_b = 0.1,
                initial_mass = 5,
                alpha_mean = 0,
                alpha_sd = 3,
                beta_sd = 3,
                beta_max = 20,
                beta_mean = 0,
                verbose = F,
                quiet = T)
 run_parallel(params, "density", 0.1, 4, 0.5, mc.cores = 4) -> sim
 Reduce(rbind, sim) -> df
 plot(df$generation, df$alpha, col = df$density)
 

johnWilshire/contest documentation built on May 19, 2019, 3:03 p.m.