simmer 2.0: a performance boost & revised syntax

October 22, 2014

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

It was very clear that the performance of the first simmer version was
lagging behind. The 2.0 release introduces a C++ based engine and comes
with a significant performance boost versus the previous version. While
the performance can always be further improved I’m currently quite
satisfied with it. Future refinement of the code base will however focus
on further improving efficiency.

The syntax also had a massive overhaul. Most notably, a trajectory is
no longer based on a data frame but build up using the
magrittr-style piping philosophy.
The code, installation instructions and documentation can be found at
the simmer GitHub repo.

As an example a simple bank clerk – customer interaction process is


      create_trajectory("bank customer") %>%
      ## see the bank clerk
      add_seize_event("clerk",1) %>%
      add_timeout_event("rpois(1, 20)") %>%
      add_release_event("clerk",1) %>%
      ## with a 50% chance skip the next three steps
      add_skip_event("sample(c(0,3), 1)") %>%
      ## with a 50% chance see the bank director
      add_seize_event("director",1) %>%
      add_timeout_event("rpois(1, 15)") %>%

      # create simulation with 50 replications & a max time of 360
      create_simulator("bank process", n = 50, until = 360) %>%  
      add_resource("clerk", 1) %>%
      add_resource("director", 1) %>%
      # add 30 customers with a given inter-arrival time
      add_entities_with_interval(trajectory = bank_customer_trajectory, n = 30, name_prefix = "customer", interval = "rpois(1, 20)") %>%
      # run the simulation

Once the simulation has finished, we can have a look at the results.

# have a look at the flow time
    plot_evolution_entity_times(bank_process, type = "flow_time")

plot of chunk unnamed-chunk-3

# have a look at the overall resource utilization
    plot_resource_utilization(bank_process, c("clerk","director"))

plot of chunk unnamed-chunk-4

# have a look at the in use moments of the director for replication 5
    plot_resource_usage(bank_process, "director", replication_n = 5)

plot of chunk unnamed-chunk-5

As always, comments, questions, tips & suggestions are very welcome. Either post a GitHub issue or contact me by mail at [email protected]

The post simmer 2.0: a performance boost & revised syntax appeared first on FishyOperations.

To leave a comment for the author, please follow the link and comment on their blog: FishyOperations » R. 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.


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)