Using the model

The code for the simulation model is contained in the ciw_model.py module. The module contains wrapper functions to allow easy creation of new experiments and execution of multiple replications.

A user only needs to import the Experiment class and the multiple_replications function.

Imports

from ciw_model import (Experiment, 
                       multiple_replications)

Default run of the model

To perform a default of the model, create an instance of Experiment and pass it to the multiple_replications function. By default the model is run for 5 replications. The function results a pandas.DataFrame containing replications and performance measures.

default_experiment = Experiment()
results = multiple_replications(default_experiment)
results
01_mean_waiting_time 02_operator_util 03_mean_nurse_waiting_time 04_nurse_util
rep
1 2.784746 91.374255 47.927266 96.753369
2 1.367329 91.853442 31.935974 97.776217
3 4.009524 95.925268 79.743715 98.214845
4 1.519486 89.297980 46.554721 96.708677
5 3.183769 95.467289 55.718766 97.688507

To summarise results call the .describe() method of the results dataframe.

The code below also rounds to 1 decimal place and transposes the dataframe

results.describe().round(1).T
count mean std min 25% 50% 75% max
01_mean_waiting_time 5.0 2.6 1.1 1.4 1.5 2.8 3.2 4.0
02_operator_util 5.0 92.8 2.8 89.3 91.4 91.9 95.5 95.9
03_mean_nurse_waiting_time 5.0 52.4 17.5 31.9 46.6 47.9 55.7 79.7
04_nurse_util 5.0 97.4 0.7 96.7 96.8 97.7 97.8 98.2

Creating new scenarios

The code below changes the number call operators, advanced nurse practitioners and chance of a call back from a nurse.

what_if_experiment = Experiment(n_operators=14, n_nurses=10, chance_callback=0.45)
what_if_results = multiple_replications(what_if_experiment)
what_if_results.describe().round(1).T
count mean std min 25% 50% 75% max
01_mean_waiting_time 5.0 1.2 0.4 0.5 1.1 1.2 1.5 1.7
02_operator_util 5.0 86.5 2.6 82.4 85.8 86.8 88.3 89.2
03_mean_nurse_waiting_time 5.0 55.1 19.0 22.4 58.1 58.7 66.5 70.0
04_nurse_util 5.0 97.3 0.5 96.8 96.9 97.6 97.7 97.7

Running more replications

By default the multiple_replications function runs 5 replications. To change the default se the n_reps parameter. The example below runs 50 replications of the model.

default_experiment = Experiment()
results = multiple_replications(default_experiment, n_reps=50)
results.describe().round(1).T
count mean std min 25% 50% 75% max
01_mean_waiting_time 50.0 3.5 1.9 1.5 2.3 2.9 4.0 11.0
02_operator_util 50.0 92.9 2.3 86.8 91.9 92.8 94.7 97.0
03_mean_nurse_waiting_time 50.0 48.5 19.4 14.5 36.3 44.7 61.9 95.0
04_nurse_util 50.0 97.1 1.0 94.1 96.8 97.2 97.7 98.3