# Simultaneous Parallel Replications

### From Support

To assess the variability of a simulation output series, it may be desirable to run several independent replications of the same model. Parallel replication has a number of advantages, such as making the detection of initialization bias much easier.

With event graphs, it is very easy to run these replications simultaneously. Simultaneous replication of a model is another application of event parameters and edge attributes. It might be useful here to think of parallel replicated simulations as an array of identical event graphs that are to be run at the same time.

To set up parallel replications, simply add two state variables to the model: one variable to identify the replication to which a particular event occurrence belongs and the other variable to tell how many simultaneous replications are desired. The replication index is globally added to the end of all edge attribute and event parameter strings. Also, every one of the original state variables gets an added array dimension for this index.

Consider the model of the single server queue (CARWASH.MOD). An event graph for running three simultaneous replications of this model is given below. The problem with this model is that, in addition to being messy, each time another replicate is desired a new sub-graph has to be appended.

We can solve this easily by using parameterized events; define R as the desired number of replicates and M as an index to identify the replicate to which an event vertex belongs. The resulting parameterized event graph now looks like that below.

Finally, as a more complicated example, consider BANK2.MOD, where we kept track of transient entities. Our queueing simulation event graph is parameterized for R simultaneous replications in the next figure. The event graphs in the above and below figures are complicated and good tests of your comprehension. Fortunately, event graphs for these models look almost the same as the simple model in CARWASH.MOD. In fact, these models were created from our basic queueing model by using an ASCII editor to globally add the parameter, M, to all edge attribute and vertex parameter strings and also to make M an additional state variable dimension. The only other change needed was to set up a loop on the initial RUN vertex to start each replicate.

Notice that if the same arrival rate is used for all three replications, one ENTER event could be used to generate arrivals for all three replications. This would automatically implement the variance reduction technique of common random number streams discussed in Inputs/Outputs. If our replicates represented small differences in some of the input parameter values, this technique could be used to estimate the gradient of the simulation response in a "single run" using finite differences between the averaged output series.

An implementation of parallel replications in SIGMA is given in the model, REPLCATE.MOD. Here we set up our basic model, CARWASH.MOD, for simultaneous parallel replication. The SIGMA graph for this model looks identical to that for CARWASH.MOD, with the single exception of the "do loop" for the RUN vertex. In the RUN vertex, each replication is STARTed and indexed by the value of M passed as a vertex parameter.