简体   繁体   中英

Discrete Event simulation in R

From google am trying to understand "simmer" package in R for discrete event simulation.

As per the example given in the link , am trying to create the simulator using create_simulator function. but am getting the below error

Code Used:

      trajectory <- read.table(header=T, text=                           "event_id  description   resource        amount  duration          successor                         1         registration  administration  1       runif(1,3,10)     2                         2         intake        nurse           1       runif(1,10,20)    3                         3         consultation  doctor          1       runif(1,5,15)     NA"  )


    sim <-  create_simulator(name = "SuperDuperSim") %>%  add_trajectory(name = "simple_trajectory", trajectory_df = trajectory) %>%  add_resource(name = "administration", capacity = 1) %>%  add_resource(name = "nurse", capacity = 1) %>%  add_resource(name = "doctor", capacity = 2) %>%  add_entities_with_interval(n = 10, name_prefix = "patient", trajectory_name = "simple_trajectory", interval = "rnorm(1,10)") %>%  replicator(15)

Error:

   Error in eval(expr, envir, enclos) : 
     could not find function "create_simulator"

I have never used this package before but it appears to me that the create_simulator function does not exist in the current version of the package (the add_trajectory function doesn't seem to exist too). Information about the simmer package is available at https://github.com/r-simmer/simmer . More specifically, an introduction is given at: https://cran.r-project.org/web/packages/simmer/vignettes/A-introduction.html . It appears to me from this site that the creation of the simulator is now done by typing simmer(nameOfMySimulator) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM