PatuakhaliScience andTechnology University
Department of Computer Science Information Technology(CSIT)
Mid-Term Examination, July-December-2023
Program: B. Se. Engg.(CSE)
Session : 2020-21
Modeling
Course Code : CIT-323 Course Title : Simulation and
Full Time: I Hour FullMarks: 15
Answer all the questions
02
1. Distinguish betwcen analyticalsolution and simulation. 05
2. Explain the problem statement of simulation of a single server qucuing system. dircctions, 04
3. and takes step in four
A drunkard moved from a point to a destinationassociatcd
backward, forward, right, and left. The probabilities with these are 15%, 40%,
20% and 25% respcctively. The distances covered to backward, forward, right, and left
steps and
are 50cmn, 90 cm, 60 cm and 40 cm respecctively. Simulate the walk for 20 scales. [USE find
the location at end of 20 steps while starting point is (0, 0) on 21, the X-Y
Random Number 67, 23, 01, 95, 84,56, 77, 76, 18, 82, 45, 29, 68, 15, 86, 00, 89, 45]c7
04
4.
Define Monte-Carlo method. Solve the integrals/ = 3 dx by monte-carlo method.
|USE Random Number 48, 36, 44, 41, 46, 18, 32, 41, 23, 23 coordinate, for X coordinate and
Random Number .52, .18, .30, .88, .21,.25, 57, .82, .9, .63 for Y you have a
right to do scaling, if required]
PatuakhaliScience and Technology University
Department of Computer Seience Information Technology(CSsIT)
Midterm Examination, July-December-2023
Program: B. Se. Engg(CSE)
Session: 2020-21
Course Code : CII-324 Course Title : Simulation and Modeling Sessional
Full Timc: I llours Full Marks: 15
Answer the marked question
SET-A
08
V I. A six-sided dic rolled and produces random numbers I to 6. Simulate the Gambling Game
differences
with six-sidcd dic rolled in odd trail is trcated as Hand cven trail as T. When the
Monte Carlo Method
between H and T will 20game over. It costs 1 dollar in cach trail. Use
and analyze profit-loss.
08
25%, 35%, 30% and 10%
2. A lying object moves randomly. It moves L, R, F and B in
probability. It also has 80% upward and 20% downward tendency.
Identify the location of
flying object afer 50 epochs by Monte Carlo Method.
SET-B
program requires 07
3. Write a program that performs a simple M/M/I qucue simulation. This
Service time as well as the
parameters for the Mcan Inter Arrival time of customers, Mcan
with a
maximum number of customers. The simulation is startcd with a single-scrver queuc
and the service
FIFO qucuing discipline. For M/M/I qucue, the customcr inter-arrival time
timc are both exponcntially distributed. This simulation shows the Average delay in queue,
cndcd.
Average number in qucuc, Scrver utilization, and Timc simulation
Patuakhali Seience and Technology University
Department of Computer Science and Information Technology
6 Semester ([Link]-3, Semester-). FinalSession:
Fxamination of [Link], Engy.(CSE), July-December/2023,
2020-21
Course Code: CIT-323 Course Title: Simulation and Modeling
Full Marks: 70 Credit hour: 3,00 Duration: 3 hours
[Figures in the right margin indicate full marks. Split answering of any question is not
recommended]
Answer any 5 of the following questions.
1. a. Define simulation with example. Demonstrate diflerent ways in which a system might 05
be studicd. Explain the next-event time-advance approach illustrated for the single
server qucucing system.
b. Consider a singlc-server qucuing system, there are several IID random variables 05
interarrival times, service times, and customer delays. Deseribe the problem statement
ofthesingle-server queuing system.
C. What is an inventory system? F'ormulatea simulation of an inventory system in which 04
many of the elements are representative of those found inthe actual inventory system.
2. a. Define random variable. low to compute variance, covariance, and correlation for 05
simulation study? Why stochastic process is uscd to simulate the output data. Ilustrate
corelation function of the process of delays in qucue D1, D2, ...for the M/M/l queue.
b. Define verification, validation, und eredibility in simulation model. llustrate the timing 0S
relationship of validation, verification, and establishing credibility.
c. Deseribe the cight methods lor debugging a simulation model's computer program. 04
3. a. Write down the propertics of the loeation, scale, and shape parameters of continuous 05
distributions. State the relevant inlornnation (application, density function, parameters,
and density curve) for the simulation modeling application of the normal continuous
distribution.
b. Many random number generators in use today are lincar congrucntial generators, [Link]. 06
Discuss how to obtain the desired random numbers from LCGs?
What is the inverse trunsfom function? Let Xhave an cxponential distribution with a
mean [Link] the desired rundom variate using the inverse transform function.
C. What is the necessity of statistical analysis with simulation output data? Describe and 03
illustrate the transicnt and steudy-state behaviors of astochastic process.
4. Definc comnputer simulation models. Describe the steps in simulation study. 02
b. Amuchine center has three identical bcarings, which fail according to the following
probability distribution in lable A. The present maintenance policy is to change a
bcaring as and when it fails. When bearing fails machine center stops, a technician is
callcd to replace the failed bcaring with anew onc. The time between the failure of the
bearing and reporting of the technician (delay time) is random and is distributed as table
B
Table: A Table: B
Bearing Delay Probability
Probabiliy Time(Minutes)
Life(llours)
1200 0.10 2 0.3
5 0.5 10
1400 0.25
1600 0.30 8 0.2
1800 0.25
2000 0.10
It takes 15 minutcs to chunge one bearing. 25 minutes to change two bearing and 35
minutes to change all three bearings. Downtime of the system costs $5 per minutes,
direct on job costs of the technieian is S30 per hour and the cost of bearing is $30.
The maintenance depart1ment is interested in evaluating an altermative policy of
replacing all the thrcc bearings, whenever a bearing fails. Simulate the present and
proposed policy for 10000 hours and choose the better policy.
Page 1 of2
C. What is normally distributed random numbers? Deseribe the properties and applications 02
of normally distributed random numbers.
5. a. Write down the qualities of an efficient random number generator. Use mixed 03
congruential method to generate the following sequcnce of random numbers, A
scquence of 10 two digit random numbers such that n = (19r, + 1) modulo23
Take r, = 1. (Take secd values yourscltn
b.
Define Monte-Carlo method. Solve the integrals/= Sdx by monte-carlo method.
[USE Random Number 48. 36, 44, 41, 46, 18, 32, 41, 23, 23 for X coordinate and
Random Number 52, .18, 30, .88. 21. .25..57, .82, .9. 63 for Ycoordinate. you have a
right to do scaling, if requircd]
C. There are a number of moving objects, which chase each other in aserial order like A 07
chases B, Bchases C, and Cchases Detc. Fach objcct moves towards its target
unmindful of the fact that it itself is bcing targeted by some other object. Depending
upon the original location, and spccd of motion of the objcct, cach object will take its
own time to hit its target. As soon as hit occurs, the chase cnds. The initial location of
the objects A, B, C, and Dare (0.0). (0.10). (0.20). (0.30) respcctively and their
velocities are 30kmhr, 2Skm/hr, 20 km/hr and 1Skm/hr respcctively. Objcct Dmoves
towards afixed at (30,50), while Cmoves always in adircction pointing towards D, the
object Bmoves always pointing towards Cand object Aalways pointing towards B. It
can be assumed that when the distancc betwcen two objects less than 0.005 hit is taken
to occur. ldentify, which objcct will hit the target at first and in what time?
6 a. What are the diferences betwecn truc and pscudo random numbers? Describe the
procedure to physically generate random number at the interval (0, 1] with two-digit 02
accuracy.
b. Ascquence of 10,000 five digit random numbers has becn generated, and an analysis of 06
numbers indicate that there 3075 numbers having five different digits,4935 having a
pair,I135 having two pairs, 695 having three of akind, 10s having ful house, S4 having
four of a kind and one having all five of a kind. Usc Poker test to determine if these
random numbers are independent at a 0.01. Note that for a= 0.01l and N=06 the
critical value is 16.8.
C. An ammunition depot, of rectangular shape measuring 500m of length and 350m of 06
width is under attack by a squadron of bombers. In cach sortie 10 bombers drop bombs,
one cach, on the ammunition depot. If the bomb lands anywhere in the marked area, it is
a hit, otherwise it is a miss. Allthe bombers aim at the center of the area. The point of
strike is assumed to be normally distributed around the aiming point with a standard
deviation of 500 m in x-direction and 350m in the y-dircction. Simulate operation of
bombing operation for 20strikes and determine the percentage number of strikes, which
are on the target.
Use Normal Random Number:
For Xdirection -[23, -1.16, 0.39, -1.90. -0.78, -0.02, -0,40, 0.66, 1.14, 0.07, 0.53,
0.03, 1.19,0.11,0.16, -0.82, 0.42, -0.89, 0.49, -0.21|
For Ydirection- [0.24, -0,02, 0.64,-1.04, 0.68, -0.47, -0.75, -0.44, 1.21, -0.08, -l.56.
149,-1.19,-1.86, 1.21, 0.75, -[Link], -1.44, 0.65|
Page 2 of2
Patuakhali Science & Technology University (PSTU)
Department of Computer Science and Information Technology(CSIT)
Final Examination: July-Decenmber 2023
Course Code: CIT 324 Course Title: Simulation and Modeling Sessional
Session: 2020-2 1,Program: [Link]. Engg.(CSE), Semester: 6h
Marks - 70
(Answer the marked questions)
Section A
You are tasked with generating pseudo-random numbers using the Mid-Square Method and using 10
those numbers to perform the Kolmogorov-Smirnov (K-S) test for uniformity.
Start with a4-digit secd (e.g.. 573I). 10
2. You are tasked with evaluating the quality of arandom number generator using the Multiplicative
Congerential Method (MCM) and verifying its uniformity using the Chi-Square goodness-of-tit
Jest. 10
Youare tasked with analyzing the randomness of a sequence of numbers generated using the
Additive Congruential Method (ACM). To evaluate the independence of these random numbers.
you will implement a Chi-Square test for autocorrelation.
4 Implement the Poker Test to assess the randomness of numbers generated by a 10
Muliplicative Congruential Generator (MCG).
Section B
You are tasked with simulating a mobile robot that follows a predefined path using the Pure 20
Pursuit algorithm. The robot should start at an initial position and navigate towards a sequence of
waypoints using the pure pursuit strategy. Your solution must include a real-time animation
of the
robot moving along the path.
You aretasked with simulating the chemical reaction between hydrogen (H:) and oxygen
(0:) to form water (H:O). The balanced chemical reaction is: 2H2 + O; ’ 2H:0 20
Given an initial amount of hydrogen (h2_molecules) and oxygen (o2_molecules). simulate the
reaction until no more water can be formed (i.e., one or both reactants are exhausted).
Then. determine the equilibrium state -the remaining molecules of hydrogen,oxygen.
and water. Your task is to:
1. Simulate the reaction in Python.
2. Output the number of remaining hydrogen, oxygen, and the amount of water
formed when the reaction stops (reaches equilibrium).
7
In the Serial Chase Problem, multiple entities (such as agents, cars, or robots) are positioned on a 20
circular path. Each entity is programmed tochase the next one in the sequence, forming a closed
loop. Each chaser always moves directly toward its target al a constant speed.
Task:
Write a simulation program to model the Serial Chase Problem for n entities placed evenly on a
2D circular path. Your simulation should:
I. Initialize n entities equally spaced on a unit circle.
2. Each entity should continuously move toward the next one (e.g.. entity Ichases entity 2.
entity 2chases entity 3, .. and entity nchases entity I).
3. Update positions using a small time step At and simulate until all entities converge to a
single point or untila maximum number of iterations is reached.
4. Display or output the trajectories of eachentity.
s. (Optional) Visualize the simulation using a plotting library.
Page | 1
S. Amachine center has three identical bearings. which fail according to the following 20
probabilitydistribution in table A. The present maintenance policy is to change a bearing
as and when it fails. When bearing fails machine center stops, a technician is called to
replace the failed bearing withanew one. The time between the failure of the bearing and
reporting of the technician (delay time) is randomand is distributed as table B.
Table: A Table: B
Bearing Delay Probability
Life(Hours)
Probahility Time(Minntes)
1200 0.10 2 0.3
1400 0.25 0.5
1600 0.30 0.2
1800 0.25
2000 0.10
I takes I5 minutes to change one bearing, 25 minutes to change two bearing and 35
minutes to change all three bearings. Downtime of the system costs $5 per minutes, direct
on job costs of the technician is $ 30 per hour and the cost of bearing is $30. The
maintenance department is interested in evaluating an alternative policy of replacing all
the three bearings,whenever a bearing fails. Simulate the present and proposed policy for
10000 hours and choose the better policy.
Section C
10
09Nrite a program that perfons a simple M/M/lqueue simulation. This program requires
parameters for the Mean Inter Arrival time of customers, the Mean Service time as well as
the maximum number of customers. The simulation starts with a single-server queue with
a FIFO queuing discipline. For M/M/l queue, the customer inter-arrival time and the
service time are both exponentially distributed. This simulation shows Average delay in
ended.
queue, Average numnber in queue, Server utilization, and Time simulation
10. LCG is considered one of the basic yet best methods to generate Pseudo-Random
Numbers. Write a program thal generatesa random number using the LCG. 10
Section D
ILAhere were a few waves in the COVID-19 pandemic. Let a wave occur every 100 days in
Bangladesh, on average. After awave occurs,find the probability using the Exponential
distribution that it will take more than 120 days for the next wave to occur. Simulate
4.0.
several Exponential distributions using rate parameters 0.5. 1.0, 2.0, and
12. There are several general approaches togenerating a univariate Random Variable from the
distribution function. Write a program that generates the desired number of random
variates using the inverse transform function. 20
13. Viva-Voce
Page | 2
3
CamScanner
CamScanner