Site icon R-bloggers

simmer 3.0.0 is on CRAN

[This article was first published on FishyOperations, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’m very pleased to announce the first CRAN release of simmer. (https://cran.rstudio.com/web/packages/simmer/). This release has been realised thanks to the efforts made by Iñaki.

To reiterate a bit, simmer is a discrete-event simulation (DES) package for R. It is the first R package that focuses on creating a robust DES framework for R. It provides a framework somewhat similar as e.g SimPy and SimJulia but is arguably written from a bit more of an applied angle.

R might not be the most efficient language to implement a DES framework due to its method of memory allocation. Therefore, simmer implements a C++ backend by making use of Rcpp.

< !--more-->

This release follows the philosophy and workflow of the pre-release version but adds a more robust event-based C++ backend and a more flexible frontend. These are the main improvements:

A nice getting started manual is provided in the vignette: https://cran.r-project.org/web/packages/simmer/vignettes/introduction.html.

For feedback, questions and bug reports please create an issue at the GitHub repository: https://github.com/Bart6114/simmer. Here you can also find the latest development version.

Let’s close with a simple example:

library(simmer)

coffee_prep_duration<-function(){
  coffees<-list(espresso=runif(1, min=5, max=10),
                macchiato=runif(1, min=6, max=12),
                americano=runif(1, min=3, max=8))
  
  sample(coffees, 1)[[1]]
}

coffee_trajectory<-
  create_trajectory("I want coffee!") %>%
  seize("barista", 1) %>%
  timeout(coffee_prep_duration) %>%
  release("barista", 1)

env<-
    simmer("coffee shop") %>%
      add_resource("barista", 2) %>%
      add_generator("caffeine addict",
	      coffee_trajectory, 
	      function() abs(rnorm(1, 5, 2))) %>%
      run(until=480)
  
plot_evolution_arrival_times(env, type = "flow_time")

Have fun with it! (and let us know what we can improve further)

To leave a comment for the author, please follow the link and comment on their blog: FishyOperations.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.