simmer v3.5.0 released on CRAN

October 27, 2016
By

(This article was first published on FishyOperations, and kindly contributed to R-bloggers)

We are proud to present simmer 3.5.0, a new release on CRAN of the Discrete-Event Simulator for R with a bunch of exciting features:

  • Simpler logging. So far, if we wanted arrivals to print something into the console, we had, for instance, to make a custom function returning zero, with a print() inside, and to put it into a timeout() activity. Now, with log_() it’s easier and, in addition, you get the simulation time and the arrival name:
library(simmer)

sayer <- create_trajectory() %>%
  log_("hello world!")

simmer() %>%
  add_generator("dummy", sayer, at(3, 6)) %>%
  run() %>% invisible
## 3: dummy0: hello world!
## 6: dummy1: hello world!
  • New resource modifiers. set_capacity() and set_queue_size() existed before, but they were not very useful. Now, these methods become activities and you can use them in your trajectories. They have their associated set_capacity_selected() and set_queue_size_selected(), just like seize() and release(), for a joint use with the resource selector select().
  • New generator modifiers. Activities activate(), deactivate() allow us to start/stop generators from within trajectories. Activities set_trajectory(), set_distribution() allow us to change a generator’s assigned trajectory or distribution respectively.
  • New interarrival communication activities, allowing asynchronous programming. send(), trap(), untrap() and wait() can be used to send signals, wait for signals, trap them and launch asynchronous handlers. Nothing better than an example to understand the possibilities of this mechanism:
library(simmer)

t_blocked <- create_trajectory() %>%
  trap("you shall pass",
       handler = create_trajectory() %>%
         log_("ok, I'm packing...") %>%
         timeout(1)) %>%
  log_("waiting...") %>%
  wait() %>%
  log_("and I'm leaving!")

t_signaler <- create_trajectory() %>%
  log_("you shall pass") %>%
  send("you shall pass")

simmer() %>%
  add_generator("blocked", t_blocked, at(0)) %>%
  add_generator("signaler", t_signaler, at(5)) %>%
  run() %>% invisible
## 0: blocked0: waiting...
## 5: signaler0: you shall pass
## 5: blocked0: ok, I'm packing...
## 6: blocked0: and I'm leaving!

Other interesting new features from past releases since our last post include post-seize and reject optional trajectories when seizing resources, arrival cloning and synchronizing, arrival batching and separating or reneging.

Please, refer to the updated Advanced Trajectory Usage vignette for more information and examples. Also remember that you can participate in our simmer-devel mailing list to get help, discuss methodologies… any feedback is always welcome.

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)