<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/simmer-4-0-1/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.enchufa2.es/archives/simmer-4-0-1.html"> R – Enchufa2</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>The 4.0.1 release of <a rel="nofollow" href="http://r-simmer.org/" target="_blank">simmer</a>, the Discrete-Event Simulator for R, is on CRAN since a couple of weeks ago. There are few changes, notably new getters (<code>get_sources()</code>, <code>get_resources()</code>, <code>get_trajectory()</code>) for <code>simmer</code> environments and some improvements in resource selection policies (see details in <code>help(select)</code>).</p>
<p>A new convenience function, <code>when_activated</code>, makes it easier to generate arrivals on demand, triggered from trajectories. Let us consider, for instance, a simple restocking pattern:</p>
<pre><code><span>library</span>(simmer)

restock &lt;- trajectory() %>%
  log_(<span>&quot;restock&quot;</span>)

serve &lt;- trajectory() %>%
  log_(<span>&quot;serve&quot;</span>) %>%
  activate(<span>&quot;Restock&quot;</span>)

env &lt;- simmer() %>%
  add_generator(<span>&quot;Customer&quot;</span>, serve, at(<span>1</span>, <span>2</span>, <span>3</span>)) %>%
  add_generator(<span>&quot;Restock&quot;</span>, restock, when_activated()) %>%
  run()</code></pre>
<pre><code>## 1: Customer0: serve
## 1: Restock0: restock
## 2: Customer1: serve
## 2: Restock1: restock
## 3: Customer2: serve
## 3: Restock2: restock</code></pre>
<p>Finally, this release leverages the <a rel="nofollow" href="https://www.enchufa2.es/archives/boost-the-speed-of-r-calls-from-rcpp.html" target="_blank">new fast evaluation framework</a> offered by <code>Rcpp</code> (>= 0.12.18) by default, and includes some minor improvements and bug fixes.</p>
<div>
<h3>New features:</h3>
<ul>
<li>New getters (#159):
<ul>
<li><code>get_sources()</code> and <code>get_resources()</code> retrieve a character vector of source/resource names defined in a simulation environment.</li>
<li><code>get_trajectory()</code> retrieves a trajectory to which a given source is attached.</li>
</ul>
</li>
<li>New resource selection policies: <code>shortest-queue-available</code>, <code>round-robin-available</code>, <code>random-available</code> (#156). These are the same as the existing non-<code>available</code> ones, but they exclude unavailable resources (capacity set to zero). Thus, if all resources are unavailable, an error is raised.</li>
</ul>
</div>
<div>
<h3>Minor changes and fixes:</h3>
<ul>
<li>Rename <code>-DRCPP_PROTECTED_EVAL</code> (Rcpp >= 0.12.17.4) as <code>-DRCPP_USE_UNWIND_PROTECT</code> (6d27671).</li>
<li>Keep compilation quieter with <code>-DBOOST_NO_AUTO_PTR</code> (70328b6).</li>
<li>Improve <code>log_</code> print (7c2e3b1).</li>
<li>Add <code>when_activated()</code> convenience function to easily generate arrivals on demand from trajectories (#161 closing #160).</li>
<li>Enhance <code>schedule</code> printing (9c66285).</li>
<li>Fix generator-manager name clashing (#163).</li>
<li>Deprecate <code>set_attribute(global=TRUE)</code>, <code>get_attribute(global=TRUE)</code> and <code>timeout_from_attribute(global=TRUE)</code> (#164), the <code>*_global</code> versions should be used instead.</li>
</ul>
</div>
<p><em>Article originally published in Enchufa2.es: <a rel="nofollow" href="https://www.enchufa2.es/archives/simmer-4-0-1.html" target="_blank">simmer 4.0.1</a></em>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.enchufa2.es/archives/simmer-4-0-1.html"> R – Enchufa2</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/ozNzBdayKGE" height="1"></a></div>