The following was pointed out by user David Robinson:
As it stands, for each simulation replicate, we run
# Set the seed
set.seed(sim$config$seed)
set.seed(as.integer((1e9*runif(i))[i]))
Now, for high number of replicates, this takes an incredibly long time. If N is the number of replicates, then we must generate 1 + 2 + ... + N = (N + 1) N / 2 random numbers using runif, which is O(N^2). In my current project, N is in the millions, and this seeding takes way longer than the replicate script itself. For SimEngine to be usable for simulations with large numbers of replicates, this must be changed.
A possible solution would be to precomputed seeds with seeds <- as.integer((1e9*runif(N)) that are stored for the simulation and fetched for each replicate.
This needs to work with update_sim().
The following was pointed out by user David Robinson:
As it stands, for each simulation replicate, we run
Now, for high number of replicates, this takes an incredibly long time. If N is the number of replicates, then we must generate 1 + 2 + ... + N = (N + 1) N / 2 random numbers using runif, which is O(N^2). In my current project, N is in the millions, and this seeding takes way longer than the replicate script itself. For SimEngine to be usable for simulations with large numbers of replicates, this must be changed.
A possible solution would be to precomputed seeds with
seeds <- as.integer((1e9*runif(N))that are stored for the simulation and fetched for each replicate.This needs to work with
update_sim().