GENERATION OF TES SEQUENCES

10.5 GENERATION OF TES SEQUENCES

This section describes in detail the generation procedure for TES sequences in algorithmic form. It further illustrates the computer implementation of such algorithms in an Arena model.

For convenience, we separate the generation of TES þ processes from that of TES processes, even though the corresponding algorithms have large overlaps. We shall assume that the function mod1 implements modulo-1 reduction of any real number, and returns the corresponding fraction. Such a function is not always available in software platforms, and in Arena it is implemented by code in an Assign module. The following Algorithms 10.1 and 10.2 assume that TES modeling has already been carried out, and that the requisite parameters are available as inputs (explanatory comments are preceded by double slashes).

G ENERATION OF TES þ S EQUENCES

Inputs

1. An innovation density f V // modeler choice

2. A stitching parameter x // modeler choice

3. An inverse (marginal) distribution F 1 // often ^ H 1 of Eq. 10.15

Outputs

1. A background TES þ sequence fU þ g n 1 n ¼0

2. A foreground TES þ sequence

1. Sample a value 0

0 < 1, uniform on [0, 1), // initial background variate and set U 0 þ U 0 and n 0 // more initializations

2. Go to Step 6. // go to generate the initial foreground variate

3. Set n nþ1 // bump up running index for next iteration

4. Sample a value V from f V // sample an innovation variate, typically using // the inverse transform method

5. Set U n þ mod1(U n1 þ þV) // compute a TES þ background variate // using Eq. 10.3

216 Correlation Analysis

6. Set S S x (U n þ ) // apply a stitching transformation, using Eq. 10.9

7. Set X þ

F (S) // compute a TES þ foreground variate, by applying // an inverse distribution function

8. Go to Step 3. // loop for the next TES þ variate generation

G ENERATION OF TES S EQUENCES

Inputs

1. An innovation density f V // modeler choice

2. A stitching parameter x // modeler choice

3. An inverse (marginal) distribution F 1 // often ^ H 1 of Eq. 10.15

Outputs

1. A background TES sequence

fU 1

n g n ¼0

2. A foreground TES sequence

1. Sample a value 0

0 < 1, uniform on [0, 1)

// initial background variate and set U 0 U 0 þ U 0 and n 0 // more initializations

2. Go to Step 7. // go to generate the initial foreground variate

3. Set n nþ1 // bump up running index for next iteration

4. Sample a value V from f V // sample the current innovation, typically // using the inverse transform method

5. Set U n þ mod1(U þ n1 þV) // compute a TES þ background variate, // using Eq. 10.3

// compute a TES background variate If n is odd, set U n

6. If n is even, set U n

// using Eq. 10.4

7. Set S S x (U n ) // apply a stitching transformation // using Eq. 10.9

8. Set X

F (S) // compute a TES foreground variate, by // applying an inverse distribution function

9. Go to Step 3. // loop for the next TES variate generation

C OMBINING TES G ENERATION A LGORITHMS

We next exhibit an Arena program that combines the implementation of Algorithms

10.1 and 10.2 for any basic TES process (both TES þ and TES ) with an exponential distribution. This implementation generates a TES process arrival stream (a stream of entities with a TES interarrival process); however, TES processes with other function- alities (service times, demand sizes, time-to-failure and repair times, etc.) can also be constructed analogously. Accordingly, the following TES parameters are assumed to

be inputs.

Correlation Analysis 217

1. A pair of parameters L and R, such that 0 basic innovation density

2. A stitching parameter 0

3. An inverse of an exponential distribution function, F 1 (u) ¼ 1 l ln (1 u), for a given rate parameter, l >0

Figure 10.13 depicts the corresponding annotated Arena model (top) and all user- defined variables (bottom). The bottom portion of Figure 10.13 displays the spread- sheet view of the associated Variable module, which lists model parameters and variables and their initial values, if any (those requiring initialization are identified by

a 1 rows button label under the Initial Values column). The variable sign designates the generated process to be either TES þ (sign and xi are self-explanatory. The variable lambda is the rate parameter of the requisite exponential distribution, and N is the serial number of the current TES variate (initially 0). The remaining variables are related to TES theory: UP N corresponds to U n þ (initialized to a value between 0 and 1 in the Variable module), V N corresponds to

V n , U N corresponds to an unstitched TES background variate (U n þ or U n as the case may be), US N corresponds to a stitched TES variate (S x (U n þ ) or S x (U n ) as the case may be), and X N corresponds to a TES foreground variate (X n þ or X n as the case may be).

The top portion of Figure 10.13 depicts the Arena model, annotated by key associated field names and values as well as associated SIMAN code fragments with comments preceded by double slashes. The model acts as a generator of a TES model (either TES þ or TES ) for an interarrival process in the following manner:

1. The Create module, called Create TES Stream, creates a single entity at time 0. That entity will later generate TES interarrival-time variates.

2. The entity proceeds to the Assign module, called Generate First Unstitched Variate, to set the initial value of U N .

3. All other TES variates will be generated in the module, called Generate the Rest of Unstitched Variates, in subsequent iterations. Note carefully that the Arena function AMOD returns the signed fraction of a real number, and that the requisite modulo-1 reduction is carried out by adding 1 to negative fractions returned by it. The sign variable determines the type of TES process to be generated (TES þ or TES ).

4. The entity proceeds next to perform a stitching operation via the Decide module, called Branch for Stitching. From there it branches to one of the Assign modules, called Stitching for Fractional xi or Stitching for Integral xi, depending on the value of x (a single assignment would produce a compilation error, because the Arena implementation of assignments triggers a division by 0). The appropriate stitching transformation is carried out in these Assign modules.

5. Whichever branch was taken, the entity then proceeds to the Assign module, called Perform Inverse Transform, to compute the requisite exponential variate in

X N . The entity also assigns X N to its attribute, called delay time.

218 Correlation Analysis

Figure 10.13 Arena model implementing Algorithms 10.1 and 10.2 for basic TES processes with expon- ential marginal distributions (top), and its Variable module spreadsheet (bottom).

6. At this point the generation of the next TES foreground variate is complete (note that no simulation time has elapsed in the course of any variate generation). The entity immediately proceeds to the Delay module, called Interarrival Time Delay, where it is delayed for a time interval equal in length to the value of the generated TES foreground variate stored in its delay time attribute.

7. Finally, the entity proceeds to the Separate module, called Duplicate Transaction, where it spawns precisely one duplicate of itself. The entity itself proceeds to enter the system and to transact its business there. The duplicate entity loops back to the Assign module, called Generate the Rest of Unstitched Variates, to generate the next TES variate and the corresponding arrival.

Correlation Analysis 219 Note that the modeler needs to guard against a numerical problem resulting from

evaluating the logarithmic value ln (0) ¼ 1 in module Perform Inverse Transform. This can happen (though quite rarely), because the stitched variable US N in the argument can assume the value 1. One way of handling this problem is to insert a Decide module before module Perform Inverse Transform and check there the value of US N . When the condition US N ¼¼ 1 is found to hold, the entity is sent back to module Generate the Rest of Unstitched Variates to re-sample another TES variate (hopefully one resulting in US N < 1). However, this solution might result in an infinite loop, say, in a deterministic TES process (this happens, for example when L ¼ R ¼ 0, and the interval [L, R) degenerates to the single point 0). A more robust solution is to use the inserted Decide module to branch to the current Perform Inverse Transform module (if US N < 1), or to an additional Assign module (if US N ¼¼ 1), in which case a large value is assigned there to X N (in lieu of infinity).

The above discussion illustrates the kind of numerical problems that might be encountered by the modeler, when programming a random number generation scheme. Such numerical problems depend on the underlying distribution, and consequently, their handling must be left to the modeler's discretion.