Anda di halaman 1dari 15

Modeling and Simulation Exam

Faculty of Computers & Information

Course code: CSC 430 Total Mark: 75
Date: 20/1/2010 Time: 3 hours

1- a) Define the following terms, in the context of modeling and simulation:
- Verification
- Validation
- Credibility
b) Can a simulation model be verified but not valid and vice-versa? Investigate
c) Discuss 5 techniques for verification of simulation computer programs.
d) Discuss 5 techniques for increasing model validity and credibility.
e) List 5 major Pitfalls in simulation modeling.

2- a) Define the following terms:

- Experiment
- Sample space
- Probability mass function of discrete random variable X
- Joint probability mass function of two discrete random variables X and Y
b) Suppose that X is a discrete random variable with the probability mass function
i
given by: p(i) = , i = 1, 2, 3, 4, 5
15

- Plot p(x)
- Compute and plot F(x)
- Compute P(1.9999 X 4.0001)
- Compute E(X)
- Compute Var(X)
(See the next page)
3- a) Briefly describe the following concepts:
- Trace-driven simulation
- Empirical distributions
- Fitting (theoretical) distributions
b) Mention the advantages and disadvantages of each of the methods in (3-a).

4- Suppose that X and Y are jointly continuous random variables with

y x for 0 x 1 and 1 y 2
f ( x, y )
0 otherwise

- Compute and plot fX(x) and fY(y)

- Are X and Y independent?
- Compute and plot Fx(x) and FY(y)
- Compute E(X), Var(X), E(Y), Var(Y), Cov(X,Y), and Cor(X,Y)

5) For the following sequence of RNs, showing the steps, determine whether or not it
passes the Runs Test of Independence. Read rows first.
0.51241930545 0.73274767607 0.69352298968 0.05625394357
0.87392980821 0.41511904218 0.00827973058 0.85934662808
0.43506513399 0.23565273400 0.46119246644 0.19769494628
0.83463619173 0.62852266468 0.74303463833 0.36879405984
0.12350150713 0.18494672983 0.40616476953 0.28358993554
Modeling and Simulation Exam

Faculty of Computers & Information

Department: Computer Science
Course code: CSC 341 Total Mark: 80
Date: 23/1/2010 Time: 3 hours

1- a)
Solution:
Verification is to determine whether the conceptual simulation model has been correctly translated
into a computer program
Validation is the process of determining whether a simulation model is an accurate representation of
the real system
Credibility: A simulation model and its results have credibility if the manager and other key
project personnel accept them as correct

b)

Solution:
Yes, a model can be verified but not validated and vice-versa. For example, a model that
simulates the operations of an airport may be valid such that it really represents the airport system;
however, it contains an internal defect which means it is not verified (for example, it fails after
running 50 times, or uses a wrong random number generator function). On the other hand, another
model may be verified such that it doesnt contain any defects; however, it doesnt represent the
airport system very accurately (doesnt consider the flights schedule for example)

c)
Solution:
Any 5 techniques of the techniques below shall be correct and complete answer:
Technique 1: Divide the program into subprograms and then debug these subprograms individually.
Sometimes computer simulation programs may go to 10,000 statements
Start by a moderate simulation model then gradually increase complexity as needed.
Technique 2: Make a structured walk-through of the program by other persons as one may not able
to criticize himself.
Technique 3: Run the simulation model under several settings of the input parameters. Try it first
for known system performance.
Technique 4: One of the powerful techniques is to trace the state of the simulated system and
compare with a hand simulation.
Technique 5: Run the model under simplified assumptions for which its true characteristics are
known.
Example: replace the M/E2/1 queuing model by M/M/1 etc.

Technique 6: If it is possible, use animation to trace entities in the model.

Technique 7: Compute a sample mean and sample variance for each simulation input probability
and compare with the desired known mean and variance.
Technique 8: Use commercial simulation packages carefully to reduce the amount of programming
time.

d)
Technique 1: Collect high quality information and data on the system. To develop such a model, it
should make use of the existing information including:
A. Conversation with Subject Mater Experts (SMEs)
Analyst not working in isolation.
The modeler should work with some people
Analyst will have to be resourceful
B. Observations of the system:
Data which used in building the model must be correct (contain no recording error)
Existing Theory:
The interval times of costumers are quite likely to be IID exponential random variable
Relevant Results from similar simulation model:
Use previous data that have been introduced from similar simulation studies.
Experience/Intuition:
Use the experience and intuition of the modelers to hypothesize how certain components of
a complex system operation.

Technique 2: Interact with the manager on a regular basis

Technique 3: Maintain assumptions of document and perform a structural walk-through:
Record all assumptions that have been taken in the simulation model including
Project goals
Detailed description of each subsystem
What simplifying assumptions were made and why
Summary of data such as mean, histogram, etc.
Sources of important and controversial information.

Technique 4: Validate components of the model by using quantitative techniques.

Use sensitivity analysis to determine model factors that have a significant impact on
the desired measures of performance.
Examples include
The value of a parameter
The choice of a distribution that the entity moving in the system
The level of detail of subsystems
What data are the most crucial to collect

Technique 5: Validate output from the overall simulation model.

Compare the output with a similar existing system to check whether the output of the
simulation model reflects the real life performance or not.
Model may suggest improvements
Increasing the credibility.
Compared with existing system

e) Any 5 points of the following will be sufficient:

- Failure to have a well-defined set of objectives at the beginning of the study.
- Misunderstanding of simulation by management
- Failure to communicate with management on a regular basis
- Treating a simulation study as if it were primarily an exercise in computer programming
- Lack of knowledge of simulation methodology, operations research, probability, and statistics
- Failure to collect good system data
- Inappropriate level of model detail
- Misuse of animation
- Failure to model system randomness appropriately
- Failure to perform a proper output-data analysis
2- a)
Solution:
- Experiment is a process whose outcome is not known with certainty
- Sample space (S) is the set of all possible outcome of an experiment
- Probability mass function of discrete random variable X
The probability that random variable X takes on value xi is given by
p(xi) = P(X=xi) for i=1,2,
p(x) is the probability mass function of discrete random variable X
- Joint probability mass function of two discrete random variables X and Y:
p( x, y) P( X x,Y y) for all x, y

b)
- Plot p(x)

p(x)
15/15

6/15
5/15
4/15
3/15

2/15
1/15

0 1 2 3 4 5 x

- Compute and plot F(x)

F ( x) p( x )
xi x
i for 1 x 5

F(1) = 1/15
F(2) = 1/15 + 2/15 = 3/15
F(3) = 1/15 + 2/15 + 3/15 = 6/15
F(4) = 1/15 + 2/15 + 3/15 + 4/15 = 10/15
F(5) = 1/15 + 2/15 + 3/15 + 4/15 + 5/15 = 15/15

F(x)
15/15

10/15

6/15
5/15
4/15
3/15

2/15
1/15

0 1 2 3 4 5 x

- Compute P(1.9999 X 4.0001)

P(1.9999 X 4.0001) = p(2) + p(3) + p(4) = 2/15 + 3/15 + 4/15 = 9/15

- Compute E(X)
5

x
i 1
i p( xi ) for discrete X i

E(X) = 1(1/15) + 2(2/15) + 3(3/15) + 4(4/15) + 5(5/15) = 55/15 3.667

- Compute Var(X)
Var( X i ) i2 = E ( X i2 ) i2
E(X) = 1(1/15) + 4(2/15) + 9(3/15) + 16(4/15) + 25(5/15) = 225/15
E(X) = (55/15)
Hence, Var(X) = 225/15 (55/15) = 14/9 1.556
3- a)
Trace-driven simulation: The data on the input random variables of interest are
used directly in the simulation without making any change. In other words, we use
historical data as is without making any modifications or additions to it.

Empirical Distributions: The data values could be used to define an empirical

distribution function in some way. The historical data and cumulative frequency are
used as input to the model so that any value between minimum and maximum can be
generated. For instance, assume a picked a random number as F(x) doesnt
correspond to an existing x; however, its located between two other x values,
then interpolation is used to calculate its x.

Fitting (theoretical) distributions: Standard techniques of statistical inferences

are used to fit a theoretical distribution form to the data. In this technique, data
inputs are observed and a curve is plotted to determine to which distribution family
these inputs belong.
b)
Trace Driven Empirical distrib. Fitting ditrsib.
Advantages Simple Allows the smooth out the
Reproduces generation of data irregularities
observed behavior inputs within the Allow generation of
exactly range that have not values that have not
been originally been observed and
observed outside their range
Not very complex (generates a wider
range of values)
Easy to change
Disadvantages Traces dont allow may be based on a Usually more
us to generate small sample size complex than Trace
values outside of may have and Empirical
our sample (i.e., we irregularities distributions
may not have cant work outside
observed the system the observed data
in all states) range
cant test the cant test the
performance of the performance of the
simulated system simulated system
under extreme under extreme
conditions conditions
4-a)
2
f x ( x) y x dy
1
2 2
x dy y dy
1 1

xy y / 2 1
2
1
2

2

x 2 1/ 2
3/ 2 x

1.6

1.4

1.2

0.8

0.6

0.4

0.2

0
0 0.2 0.4 0.6 0.8 1

1
f y ( y ) y x dx
0
1 1
y dx x dx
0 0

yx 0 x 2 / 2 0
1

1

1
(y )
2

1.6

1.4

1.2

0.8

0.6

0.4

0.2

0
1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2
f x ( x) . f y ( y ) (3 / 2 x) . ( y 1 / 2) 3 / 2 y 3 / 4 xy 1 / 2 x ( y x)
-
X and Y are dependent

-
1
F ( X ) 3 / 2 x dx
0
1
x2
3 / 2 x
1
0
2 0
3 / 2 1 / 2 1
2
F (Y ) y 1 / 2 dy
1
2 2
y2 y

2 1 2 1
(2 1) (1 / 2 1 / 2) 1

1
E ( X ) x f x ( x) dx
0
1
x (3 / 2 x) dx
0
1
(3 / 2 x x 2 ) dx
0
1
3 / 2 x 2 x3

2 3 0
3/ 2 1
5 / 12
2 3
2
E (Y ) y f y ( y ) dy
1
2
y ( y 1 / 2) dy
1
2
y 2 y / 2 dy
1

y 3 / 3 1/ 4 y 2 1
2

(8 / 3 1) (1 / 3 1 / 4)
4 / 3 1 / 4 19 / 12
1
E ( X 2 ) x 2 f x ( x) dx
0
1
x 2 (3 / 2 x) dx
0
1
(3 / 2 x 2 x3 ) dx
0
1
3 / 2 x3
x 4 / 4
3 0
3 / 6 1/ 4 1/ 4

2
E (Y 2 ) y 2 f y ( y ) dy
1
2
y 2 ( y 1 / 2) dy
1
2
( y 3 y 2 / 2) dy
1

y 4 / 4 y3 / 6 1
2

(4 4 / 3) (1 / 4 1 / 6)
31 / 12

Var( X ) E ( X 2 ) ( E ( X ))2
1/ 4 (5 / 12)2 11/ 144

Var(Y ) E (Y 2 ) ( E (Y ))2
31 / 12 (19 / 12) 2
11 / 144
1 2
E ( XY ) xy f ( x, y ) dy dx
0 1
1 2
xy ( y x) dy dx
0 1
1 2
( xy 2 x 2 y ) dy dx
0 1

1
xy 3 / 3 x 2 y 2 / 2 1 dx
2

0
1
7 x / 3 3x 2 / 2 dx
0

1
7 x 2 / 6 x3 / 2 0
7 / 6 1/ 2 2 / 3

Cov ( X , Y ) E ( XY ) E ( X ) . E (Y )
2 / 3 5 / 12 * 19 / 12
1 / 144

Cov ( X , Y )
Cor ( X , Y )
Var( X ) .Var(Y )
1 / 144

11 / 144 * 11 / 144
1 / 11
5)
1. N = number of RNs = 20
2. let a to be the number of runs. Runs are:
+--+--+--+-+-+--++-
and hence, a = 14

2N 1
a
3. Calculate 3
16 N 29
a2
90

39
a 13
3
291
a2 3.233
90

a a
Z0 ~ N 0,1
4. Calculate a

14 13 1
Z0 0.5562
3.233 1.798

5. If -z0.05/2 <= Z0 <= z0.05/2; where is the significance level, we will accept H0 and
our sequence passes the independence test. Otherwise, we reject it

Z0.025 = 1.96 , - Z0.025 = - 1.96 , and Z0 = 0.556 . Z0 lies between Z0.025 and - Z0.025 and

hence, H0 is accepted and the sequence of RNs passes the test of independence