18
Input Modeling for Simulation Chapter 3 As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they do not refer to reality.Albert Einstein Last revision July 14, 2013 For more information on this book and materials, visit the official website, http://www.vms-technology.com/book/

Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Embed Size (px)

Citation preview

Page 1: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Input Modeling for Simulation

Chapter 3

“As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they do not refer to real-ity.”

− Albert Einstein

Last revision July 14, 2013

For more information on this book and materials, visit the official website, http://www.vms-technology.com/book/

Page 2: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

1. Introduction (1/1)• If actual data collected are available, there are three ways of input modeling:

1. Trace-driven simulation: the collected data values are directly used2. Empirical input modeling: random variables for simulation are generated directly from the

collected data;3. Theoretical input modeling: the parameters of a theoretical distribution function are esti-

mated from the actual data and random variables are generated from the fitted distribution function.

Table of Contents1. Introduction

2. Empirical Input Modeling

3. Overview of Theoretical Distribution Fitting

4. Theoretical Modeling of Arrival Processes

5. Theoretical Modeling of Service Times

6. Input Modeling for Special Applications

No.2

Page 3: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

2. Empirical Input Modeling (0/3)

Table of Contents

2-1. Non-parametric Modeling

2-2. Empirical Modeling of Individual Data

2-3. Empirical Modeling of Grouped Data

No.3

Page 4: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

2. Empirical Input Modeling (1/3)

2-1. Non-parametric Modeling• The value of the random variable x is repeatedly sampled from collected data {Xk: k= 1~n}

with probability 1/n.(1) Generate a uniform random number U ~ U(0,1);(2) Set P = n*U and k = [P] + 1; // [P] is the integer part of P.(3) Return x = Xk;

Example 3.1: Generate a service time using the non-parametric method from the service time data {Xk} given in Table 3.1.

Let the value of the generated uniform random number U ~ Uni (0, 1) be 0.369881, then the index ‘k’ in the non-parametric modeling method is computed as k = |10 * 0.369881| + 1 = 3 + 1 = 4. Thus, is ‘sampled’ as an empirical service-time to be used in a simulation.

No.4

Page 5: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

2. Empirical Input Modeling (2/3)

2-2. Empirical Modeling of Individual Data• Sort the individual data in an increasing order {X(k): k=1~n}, and the random variable x is

sampled from a piecewise linear function with F(X(k))= (k–1)/ (n–1). .

(1) Generate a uniform random number U ~ U(0,1);(2) Set P = (n – 1)*U and J = [P] + 1; // [P] is the integer part of P.(3) Return x = X(J) + (P – J + 1)*(X(J+1) – X(J));

Example 3.2: Table 3.2 shows the ordered service-time data {X(k)} that were obtained by rearranging the collected data in Table 3.1 in an ascending order.

If the value of U is 0.369881 as before, we have P = 9 * 0.369881 = 3.328929 and J = |P| + 1 = 4. Then, an empirical service time is generated as:

316.59316.158)5862()328929.0(58)()14( )4()14()4( XXPXx

No.5

Page 6: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

2. Empirical Input Modeling (3/3)

(1) Generate U ~ U(0,1).(2) Find integer J such that G(aJ)≤U < G(aJ+1).(3) Return x = aJ + (U – G(aJ))*(aJ+1 – aJ) / (G(aJ+1) – G(aJ))

2-3. Empirical Modeling of Grouped Data• When the data are grouped into m adjacent intervals {[a0, a1), [a1, a2)… [am–1, am]} and the jth

interval contains nj observations, the grouped data distribution function G(x) is a piecewise linear function with: G(aj)= for j=1~m (with n = ) & G(a0)= 0.

• Then, the random variable x can be sampled from the empirical distribution G(x).

No.6

Page 7: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

3. Overview of Theoretical Distribution Fitting (1/1)

3-1. Data Independence CheckingA simple method of assessing data independence is a scatter diagram plotting. For the data X1, X2 … Xn listed in time-order of collection, pairs (Xi, Xi+1) for i=1 ~ n–1 are plotted on an x, y-coordinate system (Xi as x-value and Xi+1 as y-value). If the plotted points are randomly scattered, one may conclude that the data are independent.

3-2. Distribution Function SelectionFor example, Erlang distribution is commonly selected for inter-arrival times, while Weibull distribution is the choice for an inter-failure time distribution. Service time distributions that are widely used are Beta distribution and lognormal distribution.

3-3. Parameter EstimationMLE is used for exponential, normal, and lognormal distributions; the method of moment for Erlang and Beta distributions; the rank regression method for Weibull distribution.

No.7

Page 8: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

4. Theoretical Modeling of Arrival Processes (0/3)

Table of Contents

4-1. Generation of Inter-arrival Times for Constant Arrival Rate (λ)

4-2. Generation of Inter-arrival Times for Varying Arrival Rates λ(t)

4-3. Generation of Inter-arrival Times from Historical Data {xi}

No.8

Page 9: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

4. Theoretical Modeling of Arrival Processes (1/3)

(1) Generate independent u ~ U(0,1).(2) Return x = –(θ)*ln(u)

4-1. Generation of Inter-arrival Times for Constant Arrival Rate (λ)• When the arrival process is stationary with a constant arrival rate λ, the inter-arrival time X

follows Exp(θ) with mean θ=1/λ.- X ~ Exp(θ) F(x) = 1 – e–x/θ.

• Exponential variate x with mean θ is generated by the inverse-transform method. - U = F(x) = 1 – e–x/θ e–x/θ = (1– U) x = –θ*ln(1– U) ≡ –θ*ln(U)

No.9

Page 10: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

4. Theoretical Modeling of Arrival Processes (2/3)

(1) Set: t = ti–1; // the previous arrive-time(2) Generate: U1 ~ U(0.1) and U2 ~ U(0.1);(3) D = –(1/λ*) ln(U1); //exponential random variable with θ= 1/λ*

(4) t = t + D(5) If U2 ≤ λ(t)/λ*, then return ti = t, else go back to Step (2)

4-2. Generation of Inter-arrival Times for Varying Arrival Rates (λ t)• A widely used method, called thinning, for generating non-stationary inter-arrival times is as

shown below.

No.10

Page 11: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

4. Theoretical Modeling of Arrival Processes (3/3)

4-3. Generation of Inter-arrival Times from Historical Data {xi}

1) Erlang(k,θ): mean = k*θ; variance = k*θ2

2) Compute sample moments m1 and m2:

3) Estimate parameters of Erlang(k,θ):

4) Generate Erlang(k,θ) variate via convolution of Exponential variates (k=integer).

𝑚1=1𝑛∑𝑖=1

𝑛

𝑥𝑖=𝑥 ;𝑚2=1𝑛∑

𝑖=1

𝑛

𝑥𝑖❑2

�̂�≅ (𝑚1 )2/ [𝑚2 − (𝑚1)2 ] ;̂𝜃= [𝑚2 − (𝑚1)2 ]/𝑚1 ;

(1) Generate independent ui ~ U(0.1) for i=1~k.

(2) Return x=

k

iiu

1

)ln(̂

No.11

Page 12: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

5. Theoretical Modeling of Service Times (0/3)

Table of Contents

5-1. Uniform random variate

5-2. Triangular random variate

5-3. House distribution random variate

5-4. Beta distribution random variate

No.12

Page 13: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

5. Theoretical Modeling of Service Times (1/3)

1) Uniform random variate: X~ Uniform (a, b)When only the range data [a, b] is given, a simple but useful method is to generate the service time X from the uniform distribution U(a, b). Namely, let U~ U(0,1) then the uniform random variate X~ U(a, b) is generated by: X = a + (b– a)*U

2) Triangular random variate: X~ Triangular (a, b, c)If the mode c is also given in addition to the range data [a, b], service times may be sampled from a triangular distribution. Service-time random variate X following the triangular distribu-tion Triangular (a, b, c) may be generated by using a composition method given below:

No.13

Page 14: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

5. Theoretical Modeling of Service Times (2/3)

3) House distribution random variate: X~ House (a, b, c, h)When the height (h) the house is also specified (in addition to a, b, and c), service time may be sampled from the house distribution. A composition method is employed to generate house-distribution random variates X.

a

2/(c–a)

c b

a c b

a c b

2/(b–c)

1/(b–a)

Y = a + (c – a) * (U)1/2

Y = c + (b – c) * [1 – (1 – U2)1/2]

Y = a + (b – a) * U2

No.14

Page 15: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

5. Theoretical Modeling of Service Times (3/3)

As the direct methods (i.e., inverse-transform and convolution methods) are not applicable to Beta distribution, the acceptance-rejection method is used in generating a Beta random variate.

4) Beta distribution random variate: Beta(α, β) The beta distribution is defined by the shape parameter α and scale parameter β and is widely used in modeling service times, especially, in the field of project management mainly due to its flexibility.

No.15

Page 16: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

6. Inter-failure Time Modeling with Weibull Distribution (0/2)

Table of Contents

6-1. Generation of Weibull Random Variate

6-2. Estimation of Weibull Distribution Parameters

No.16

Page 17: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

6. Inter-failure Time Modeling with Weibull Distribution (1/2)

Weibull(α,β) random variate X is obtained from a uniform random variate U as follows: X = β*(– ln U)1/α

1) Generation of Weibull Random Variate: Weibull(α, β) Inter-failure time is modeled by the Weibull distribution mainly due to its flexibility. If the failure rate decreases over time, then use α<1; If the failure rate is constant over time, then use α = 1 (i.e., exponential distribution); If the failure rate increases over time, then use α>1.

U = F(t) = )/(1 te (Inverse transform) x = F–1(U) = β*(– ln (1– U))1/α = β*(– ln U)1/α

No.17

Page 18: Input Modeling for Simulation Chapter 3 “As far as the laws of mathematics refer to reality, they are not certain, and as far as they are certain, they

Modeling and Simulation of Discrete-Event Systems

Chapter 3- Input Modeling for Simulation

6. Inter-failure Time Modeling with Weibull Distribution (2/2)

2) Estimation of Weibull Distribution Parameters: Weibull(α, β)Weibull parameters α, β can be estimated from the collected inter-failure time data {X i} by using a rank regression method. In order to estimate the parameters, 1) the collected data {Xi} are rearranged in an increasing order to obtain a set of ordered sample data {X(i): i = 1 ~ n} and the median rank Ri of the i-th sample data X(i) is computed us-ing the following equation: Ri = (i – 0.3) / (N + 0.4) .

Then, the sequence of ordered rank data pairs {X(i), Ri} are fitted to the Weibull distribution as follows

X(1) X(2) X(3) X(4) X(5)

1.00

x0

R1

R2

R3

R4

R5

F(x)= )/(1 te

No.18