This case study is an extension of the Modelling Requests to a Courier Service case study. It examines ways to determine the inputs for the simulation model and also how to analyse the outputs from the simulation.

Before starting this case study you will need to complete the Modelling Requests to a Courier Service case study.

See the Modelling Requests to a Courier Service case study for the details of the problem formulation. The complete logic for the model is shown as an Arena model in Figure 1.

**Figure 1** Arena model for a courier service

As discussed previously, the courier company has recorded data on their delivery requests and delivery runs. This data is given courier.xls.

We can use Arena's built-in Input Analyzer to determine distributions that fit the data well. First, we need to break the data up into separate text files as shown in Figure 5.

**Figure 5** Splitting data into text files

Then, we can use the Input Analyzer to determine the appropriate input distributions. The Input Analyzer uses the Chi Square and Kolmogorov-Smirnov goodness-of-fit tests to determine which distributions fit best. Once you have determined the best distributions, you can cut-and-paste their expressions into the appropriate submodels and run your simulation model again. The following flash tutorial shows how to add use the Input Analyzer to determine the input distribution for Inner City delivery requests:

After using the best fit for both the time between delivery requests and them time to make a delivery run, you should get an error while running replications as shown in Figure 6.

**Figure 6** Error while running simulation with best fit distributions

This error happens because we are creating a batch of size 0 (`Invalid set size: 0`

). This can only happen if we start loading when there are no requests in the `Wait for Inner City Delivery`

queue, which can only happen via a timed trigger. Thus, a timed trigger has started a delivery when there are no delivery requests in the queue. This can happen if the `Inner City Oldest Undelivered`

entity is delivered via a *maximum load* trigger and no new requests arrive before the timer expires and *also* triggers a delivery. In this case the condition for triggering a delivery in `Is Inner City Oldest Undelivered`

, i.e., `TNOW - Inner City Oldest Undelivered >=`

`Inner City Max Time`

is satisfied, even though the oldest undelivered has actually been delivered.

Fortunately the bug fix is easy. We just need to make sure there are delivery requests waiting before triggering a timed delivery, i.e., makes the change shown in Table 1.

Name | `Is Inner City Oldest Undelivered?` |
---|---|

Type | `2-way by Condition` |

If | `Expression` |

Value | `(NQ(Wait for Inner City Delivery.Queue) > 0) && (TNOW - Inner City Oldest Undelivered >=` `Inner City Max Time)` |

After fixing this bug you should get the results are shown in Figure 6.

**Figure 6** Results after input analysis

**IMPORTANT** You should save your model file under a new name before adding the empirical distributions as shown below. In the Results section we will compare the 2 model files.

Instead of using the Input Analyzer to estimate distributions, we can use the empirical distribution. The empirical distribution uses the histogram of the data to create a cumulative distribution function which it then uses to generate either discrete or continuous observations. In this example we will use the continuous distribution to generate interarrival times and processing times, i.e., the time taken for a courier run. The following flash tutorial shows how to get the empirical distribution for Inner City delivery requests:

Note that the once you have changed the generation of delivery requests, you can check your model. However, you will get an error complaining about using a value of 0.00 for an interarrival time. The first entry of your empirical distributions is (0.00, 0.00, ...), i.e., there is a very small (0.00 to 3 significant figures) chance of an observation of 0.00. If this happens an infinite number of times for an interarrival time (very small probability, but theoretically possible), then there may be an infinite loop, so Arena does not allow this. Simply remove the first 2 0.00 entries (thus removing the possibility of a 0.00 interarrival time, a reasonable assumption) and your Arena model will run (note that this is shown in the previous flash tutorial).

Now we have finished building simulation models with different input distributions, we will compare our models. We can compare two simulations by creating data files giving output for each replication and comparing them in Arena's Output Analyzer.

First, add a Statistic to both models (for the fitted input distributions and the empirical distributions) that records the average utilization of the Inner City Courier and the time for an Inner City delivery request to be made. The following flash tutorial shows how to add these statistics for the input distribution model:

Table 2 and Table 3 show the input values for the statistics for both models. **Make sure to give your output files different names** for the two models.

**Table 2** Statistic Inputs for Input Distribution Model

Name | `Inner City Busy` |
---|---|

Type | `Output` |

Expression | DAVG(Inner City Courier.NumberBusy) |

Output File | `inner_city_busy_input.dat` |

Name | `Inner City Total Time` |
---|---|

Type | `Output` |

Expression | TAVG(Inner City Delivery.TotalTime) |

Output File | `inner_city_time_input.dat` |

**Table 3** Statistic Inputs for Empirical Distribution Model

Name | `Inner City Busy` |
---|---|

Type | `Output` |

Expression | DAVG(Inner City Courier.NumberBusy) |

Output File | `inner_city_busy_empirical.dat` |

Name | `Inner City Total Time` |
---|---|

Type | `Output` |

Expression | TAVG(Inner City Delivery.TotalTime) |

Output File | `inner_city_time_empirical.dat` |

Next, we can use the *Output Analyzer* to compare the different models. **IMPORTANT** Before using the *Output Analyzer* you need to generate the data files set up in Table 2 and Table 3 by running both your simulation models. The following flash tutorials show how to start the *Output Analyzer* and then use it to compare the means of two models (make sure to use `Lumped`

for replications):

Figure 7 shows the confidence intervals generated by Output Analyzer. They measure the difference of the mean values, i.e., average number of busy couriers, for the inner city couriers and the metropolitan couriers. The difference is the mean from the fitted distribution model (input) minus the mean from the empirical distribution model (empirical). Notice that both confidence intervals span 0, so there is no evidence against no difference between the means. We can reduce the size of the confidence intervals by reducing the variance, i.e., running more replications.

**Figure 7** Results after output analysis

The simulation model of the courier company provides different measurements of several aspects of the courier service. In this case study we looked at the average number of couriers needed for inner city deliveries and the total time for an inner city delivery request to be made.

We considered these statistics using a couple of different models, one that estimated distributions for the data and one that uses the empirical distribution of the data, i.e., it modelled the data explicitly.

The simulation results showed that there was no evidence to reject the hypothesis that both distributions gave the same mean, i.e., average number of couriers busy and average total time in the system for requests. We need to investigate further to see if we can find a model that is more appropriate. This extension is known as model calibration and is demonstrated in Calibrating the Courier Service Model.

I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|

flv | CourierServiceInputOutput_Compare.flv | r2 r1 | manage | 2244.0 K | 2012-07-27 - 03:04 | TWikiAdminUser | |

flv | CourierServiceInputOutput_Empirical.flv | r2 r1 | manage | 4340.7 K | 2012-07-27 - 02:23 | TWikiAdminUser | |

flv | CourierServiceInputOutput_Input.flv | r4 r3 r2 r1 | manage | 3834.3 K | 2012-07-27 - 01:06 | MichaelOSullivan | |

flv | CourierServiceInputOutput_Output.flv | r1 | manage | 479.3 K | 2012-07-27 - 03:03 | TWikiAdminUser | |

flv | CourierServiceInputOutput_Seeds.flv | r2 r1 | manage | 3121.3 K | 2012-07-27 - 03:34 | TWikiAdminUser | |

flv | CourierServiceInputOutput_Statistic.flv | r2 r1 | manage | 4147.3 K | 2012-07-27 - 02:35 | TWikiAdminUser | |

xls | courier.xls | r2 r1 | manage | 229.5 K | 2012-07-27 - 00:20 | MichaelOSullivan | Data from the Courier company |

Topic revision: r20 - 2012-07-30 - MichaelOSullivan

Copyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Ideas, requests, problems regarding TWiki? Send feedback

Ideas, requests, problems regarding TWiki? Send feedback