simmer: 'simmer': Discrete-Event Simulation for R

Description Usage Arguments Value Author(s) See Also Examples

View source: R/simulator-methods.R

Description

A process-oriented and trajectory-based Discrete-Event Simulation (DES) package for R. Designed to be a generic framework like SimPy or SimJulia, it leverages the power of Rcpp to boost the performance and turning DES in R feasible. As a noteworthy characteristic, simmer exploits the concept of trajectory: a common path in the simulation model for entities of the same type. It is pretty flexible and simple to use, and leverages the chaining/piping workflow introduced by the magrittr package.

This method initialises a simulation environment.

Usage

1
simmer(name = "anonymous", verbose = FALSE)

Arguments

name

the name of the simulator.

verbose

enable showing activity information.

Value

Returns a simulation environment.

Author(s)

I<c3><b1>aki Ucar and Bart Smeets

See Also

simmer's homepage http://r-simmer.org and GitHub repository https://github.com/r-simmer/simmer.

Methods for dealing with a simulation environment: reset, now, peek, onestep, run, add_resource, add_generator, get_mon_arrivals, get_mon_attributes, get_mon_resources, get_n_generated, get_capacity, get_queue_size, get_server_count, get_queue_count.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
# introduction to simmer
vignette("A-introduction")

# more vignettes
vignette(package = "simmer")

## End(Not run)

t0 <- trajectory("my trajectory") %>%
  ## add an intake activity
  seize("nurse", 1) %>%
  timeout(function() rnorm(1, 15)) %>%
  release("nurse", 1) %>%
  ## add a consultation activity
  seize("doctor", 1) %>%
  timeout(function() rnorm(1, 20)) %>%
  release("doctor", 1) %>%
  ## add a planning activity
  seize("administration", 1) %>%
  timeout(function() rnorm(1, 5)) %>%
  release("administration", 1)

env <- simmer("SuperDuperSim") %>%
  add_resource("nurse", 1) %>%
  add_resource("doctor", 2) %>%
  add_resource("administration", 1) %>%
  add_generator("patient", t0, function() rnorm(1, 10, 2)) %>%
  run(until=80)

simmer documentation built on May 20, 2017, 1:21 a.m.

Search within the simmer package
Search all R packages, documentation and source code