Running the simulation

To run the simulation, from the Gnumeric toolbar, select Tools → Simulation.  In the Risk Simulation dialog box that appears, the first tab is the Variables tab.  There are two entries in the Variables tab:  Input variables and Output variables (Figure 6-5).

Figure 6-5Variables tab in simulation dialog box

Input variables are the cells which hold the functions based on random numbers of the type described in Section A.14.  In this case, they are the cells B17 and B18 in the Profit worksheet, which hold the rand() function.  Later, when the quantity purchased is a parameter set by the SIMTABLE function, cell B16 which holds the purchase quantity will be added to the range of input variables.

Output variables are the results of interest, or the dependent variable.  In this case, the dependent variables are the demand and the profit, which are in cells B20 and B21.

The next tab is the Options tab .  There are four settings in the options as shown in Figure 6-6.

Figure 6-6Options tab in Simulation dialog box for newsvendor simulation example

The second pair of options are the number of iterations and the Max time.  In a simulation, each iteration is the equivalent of a sample.  A sample from a random distribution is taken for each of the input values (as specified in the Variables tab) and the resulting output value(s).  The more iterations, the better the estimate of the output value.  However, this also takes more time to run.  A Max time value is specified in seconds where the simulation will end without output if an individual simulation takes longer then the Max time allotted.  If this occurs (see Figure 6-7), the options are to either increase the Max time value, or decrease the number of iterations.  A more drastic option is to change the model so that fewer calculations or samples of random numbers need to be made.

Figure 6-7Maximum time for simulation exceeded message box

The next tab is the Summary.  There are two boxes in this tab, the Simulation Summary and the Summary of results (see Figure 6-8).  In simulation summary, there is a description of the simulation parameters.

Due to the random nature of the simulation, the output may vary between simulation runs).

Figure 6-8Summary tab for simulation tool
  • Simulations:  Number of rounds as determined in the Simulation Options box.
  • Iterations:  Number of iterations in a single simulation round.
  • # input variables:  Number of random numbers sampled for each iteration.
  • # output variables: Number of outputs recorded for simulation
  • Runtime: Runtime of simulations in seconds.
  • Run on: Date and time simulation was run.

In the summary of results window, there are summary statistics for each round of the simulation.  If multiple rounds were done, the results of each round can be browsed by using the 'Prev. Sim.' and 'Next Sim.' buttons below the Summary of results box.  For each output and input variable, the summary shows the Min,  Average and the Max value across the iterations for that round of the simulation.  Note that for the input variables, this shows the random number that is the average, max and min.  If the statistics on intermediate values, such as a cost distribution, was desired, these intermediate values should be added to the list of output variables.

The last tab is labeled 'Output'.  This tab identifies the location where the output table will be generated.  There are two sets of options, first the Output Placement then Output Formatting as shown in Figure 6-9.

Figure 6-9Output options tab for simulation

The default output placement is 'New sheet'.  This will create a new sheet in the Gnumeric workbook labeled 'Simulation Report (1)', where '1' can be replaced with another number if a tab labeled 'Simulation Report (1)' already exists.  The option 'New workbook' creates a Gnumeric workbook named 'Book2.gnumeric' with a tab labeled 'Simulation Report.'

The third option is to embed the output table into an existing worksheet.  This is done by specifying the 'Output range'.  Note that the output range must be large enough to include the entire table, including heading information.  For a single round this requires 11 rows and 16 columns.  For example, the range Profit!A24:P35 would contain the statistics for one round with the three input variables and two output variables.  As input and output variables change, or the number of rounds of the simulation change, the number of rows required will change.

For output formatting, their are four options.

  • 'Autofit columns' automatically makes each column long enough to include the largest entry in that column. Note that column 'A' in the resulting spreadsheet used to save run information such as date and time and is kept narrow.
  • 'Clear output range' is in effect if the Output Placement option chosen is Output range. It clears the selected cells in the spreadsheet before putting the output table in its place.
  • 'Retain output range formatting' retains formatting for cells such as number formatting.
  • 'Retain output range comments' retains comments that have been placed in output cells. This is most useful when the input and output variables remained the same.