Académique Documents
Professionnel Documents
Culture Documents
Assignment 1
Gourav Saha (RIN: 661539866)
PLEASE NOTE: I was attending a conference from 29th September to 2nd October. Hence I could
not submit the assignment on 2nd October. I was given time till 5th October (Midnight) to submit
the assignment. Please accept the submission.
1
(a) We would like to rst discuss two subtle but important observations:
1.
2.
(k + 2)
th
Aimee Mann is still not nished working on the camera she is now reparing. The time required by Aimee
Mann to complete a job can be modelled as an IID exponential distribution. We know that exponential distribution
is
memoryless.
Hence we can equivalently assume that she just started reparing the camera.
The time t between two successive completion of job (reparing of camera) is an exponential distribution with mean
Mathematically,
time
t exp ( ).
t,
N (t)
t n
p.
to
such that
exp t
P [N (t) = n] =
n!
the probability of completing (k + 2)
(1)
jobs or more is greater than or equal
Mathematically,
P [N (to ) = n]
P [N (to ) = n]
n=k+2
k+1
X
n=0
f (to ) = 1
k+1
X
to n
n=0
exp to
n!
(2)
to which satises Inequality 2 is the optimal waiting time. As f (to ) is a strictly monotonically
increasing function of to , the optimal waiting time to is the solution to the following equation
k+1
X
to n
n=0
exp to
n!
f (to )
to = 0
to ,
to
=p
(3)
1 of t
o
= 10 (k + 2) .
1 We
to = 10 (k + 2)
where
(k + 2)
As
k+2
jobs.
11
10.5
10
9.5
9
8.5
t (in hours)
8
7.5
7
6.5
6
5.5
5
4.5
4
3.5
3
0
Figure 1: Plot of
vs
to
(b) For = 1 hour, p = 0.9, k = 0, 1, 2, 3, 4, 5 we have evaluated the value of to using our solver.
Plot of
vs
to
is
shown below:
The plot shows that
to
P [N (to ) = n] = 1
n=0
n=k+2
where
k+1
X
to n
exp to
n!
What is the probability that Aimee hasn't even started working on your camera when you return?
When
k=0
2nd
job of Amiee Mann. Probability that she has not started working of our camera
is equal to the probability that she has not even nished the
1st
How long would you have waited before returning according to your optimal strategy worked out above?
This is the value of
to
which we calculated in
= 0.
3.89 hours.
How much better is your strategy than your companion's simply reasoned strategy?
While my companion's strategy yields a probability if
0.44,
0.9.
So as far as
probability of camera getting repaired is concerned, my strategy is twice as good as my companion's. Ocourse for
my strategy there is a higher waiting time.
1.55
1.5
1.45
The Ratio
1.4
1.35
1.3
1.25
1.2
1.15
1.1
0
10
20
30
40
50
60
70
80
90
100
k
Figure 2: Plot of
to
(k+2) .
vs the ratio
value, describe the behavior of the ratio of your planned time to return to the expected (av-
k+2
jobs is
to
(k+2) by plotting the graphs
designed.
ratio
vs
Describe more generally how this ratio behaves for a general xed value of
We are interested in solving equation 3 for large values of
k.
as
to n
ln (n!) n ln (n) n
becomes large.
We have
to n
X
exp to
exp to
=
1
n!
n!
n=0
n=k+2
to k+2
to k+3
to k+4
exp to
exp to
exp to
+
+
+
(k + 2)!
(k + 3)!
(k + 4)!
"
#
k+2 k+2
k+3 k+3
k+4 k+4
(k + 2)
x
(k + 2)
x
(k + 2)
x
exp ( (k + 2) x)
+
+
+
(k + 2)!
(k + 3)!
(k + 4)!
k+1
X
p
p
where x =
to
(4)
(k + 2)
we have
n! nn en
"
exp ( (k + 2) x)
xk+2
e(k+2)
k+2
xk+2
(k + 2)
k+3
xk+3
(k + 2)
k+4
xk+4
+
+
+
(k+2) (k+2)
(k+3) (k+3)
(k+4) (k+4)
(k + 2)
e
(k + 3)
e
(k + 4)
e
#
k+2
k+3
k+4
0
xk+3
1
xk+4
2
1
+ (k+3) 1
+ (k+4) 1
+
k+2
k+3
k+4
e
e
exp ( (k + 2) x)
"
(k + 2)
lim 1
a n
n
= ea
(5)
p
xk+2
exp ( (k + 2) x)
k,
1
k+2
xk+3
e1 +
(k+3)
0 < x < 1,
and hence
p k+2 1.
=1
p k+2
1
k+2
=1
(6)
xe
xe1x
1x
e2 +
(k+4)
e(k+2)
e
e
exp ( (k + 2) x) k+2
x
1 + x + x2 +
exp ( (k + 2))
1
xe1x 1 + x + x2 + k+2
xe1x 1 + x + x2 +
If
xk+4
is
x = 1.
we have
1
1x
1
k+2
1
1x
1
k+2
=1
(7)
xe1x = 1.
2
is the only solution . Now observe that the LHS of
0 < x < 1, x = 1
x. Hence for x > 1, LHS will always be greater than 1. Hence
conclude that as k becomes large, x tends to 1. In other words, the optimal time
So we
Interpret your ndings, connecting them to any mathematical principles of which you may be aware.
This is basically the Law of Large Number, i.e. the average time to complete a job obtained over a sample space
will tends towards the expected time as the sample space becomes large.
Case 1 (Model based on epochs which are regularly spaced intervals of time):
We assume that the queue has a nite length of
space is
S = {0, 1, 2, . . . , M }.
M.
Let the current length ln of the queue be the state. The states
We will use Probability Transition Matrix to model this Markov Chain. The key
1.
Denitely
j=0
queue size.
2.
pA
j = 1.
A
pj j=0
where
pA
j
Please Note: Some of these arrived jobs may decide to leave the queue depending on the
L
pr (l) r=0
pL
r (l) is the probability that r arrived request will decide
P
L
pL
r (l) = 1 ; l. Also pr (l) is a monotonically increasing
where
r=0
function of l.
3.
pD
i (l)
D
where pi (l) is the probability that i request will depart from
i=0
the queue (after job completion). Please Note: If the current queue length is l then the number of jobs which can
D
depart can not be greater than l. This also suggest that the probability distribution pi is indeed a function of l.
l
P
D
Denitely
pD
i (l) = 1 ; l. It is easy to verify that p0 (0) = 1.
i=0
Given the Probability Distribution of Arrival and Leaving we can create the Probability Distribution of jobs joining
the queue. We have
pJk
X
k L
jk
A j
L
(l) =
pj
1 pjk (l)
pjk (l)
k
j=k
2 Though x = 1
0 < x < 1,
is almost equal to
1.
(8)
pJk (l) is the probability that k jobs will join the queue. To derive equation 8 what we are basically considering
A
is that j job arrives (which has a probability of pj ), out of which j k jobs decide the leave the queue and k jobs
k
jk
j
1 pL
pL
decide to wait (which has a probability of
). We then sum this probability over all
jk (l)
jk (l)
k
possible values of j .
where
In the following discussion we will nd the transition probability from queue length
M 1, i.e.
that k jobs
ln
to
ln+1
where
0 ln+1
we will consider all possible columns of the probability transition matrix except the last one. Lets say
decides to join the queue and
and
which will
support transition from queue length ln to ln+1 is governed by the following equation,
k i = ln+1 ln ; i {0, 1, . . . , ln } ; k 0
Therefore for
0 ln+1 M 1,
(9)
p (ln , ln+1 ) =
J
pD
i (ln ) pk (ln )
(10)
ki=ln+1 ln ; i{0,1,...,ln } ; k0
For ln+1
ln ,
equation 10 simplies to
ln+1
J
pD
k+ln ln+1 (ln ) pk (ln )
(11)
ln
X
J
p (ln , ln+1 ) =
pD
i (ln ) pi+ln+1 ln (ln )
(12)
p (ln , ln+1 ) =
k=0
For ln+1
> ln ,
equation 10 simplies to
i=0
Now we consider transition from
ln
to
ln+1
where
1.
ln+1 = M ,
i.e.
Using this property we can get the last column of the probability
transition matrix as
p (ln , M ) = 1
M
1
X
p (ln , i)
(13)
i=0
Please Note: We will not draw the probability transition matrix as it will look very complicated. The entire probability transition matrix is completely characterised by equation 11, 12 and 13.
Case 2 (Model based on epochs dened as the moments when a service request is completed):
Here the state space is
S = {0, 1, 2, . . . , M 1}.
ln
M . This is because
= M then ln+1 = M + 1
here the epochs are based on the moments when service request is completed. Hence if ln
M.
The required statistical parameters are the Probability Distribution of Arrival and Probability Distribution of Leaving. We do not need the Probability Distribution of Departure because in this case, in every epoch, only one service
request is completed and hence departs. Probability Distribution of Arrival and Leaving is given in
Case - 1.
Using
the probability distribution of arrival and leaving, we can get the probability distribution of jobs joining the queue
using equation 8.
As before we will rst nd the transition probability from queue length ln to ln+1 where
that there is atleast one job in the queue, i.e.
in the next epoch. Then
ln 1.
0 ln+1 M 1. Consider
k job join the queue
should satisfy
k 1 = ln+1 ln ; k 0
In equation 14, there exist a solution for
k,
ln 1.
(14)
Hence for
0 ln+1 M 1
and ln
1,
(
0
; ln+1 < ln 1
p (ln , ln+1 ) =
J
pln+1 ln +1 (ln ) ; ln+1 ln 1
5
(15)
When ln
= 0,
should satisfy
Hence for
0 ln+1 M 1
and ln
=0
k = ln+1 ; k 0
(16)
(17)
we have
ln+1 = M ,
2
3
pJ3 (0)
pJ2 (1)
pJ0 (2)
pJ2 (0)
pJ3 (1)
pJ1 (2)
.
.
.
.
.
.
.
.
.
.
.
.
M 1
M 1
M
2
P
i=0
M
2
P
i=0
M
3
P
i=0
M
4
P
i=0
.
.
.
pJ0 (M
pJ2 (2)
pJ0 (3)
pJ1 (3)
.
.
.
..
pJ0 (M 1)
pJi (0)
pJi (1)
pJi (2)
pJi (3)
1)
In this question we will be dealing a lot with binary variables and binary operations.
the binary variable
x.
We will use
and
th
day,
k th
day,
day.
th
k th
day.
Please Note: In this entire question we will consider the Optimistic Recovery Model.
(a) For this part of the questions we would like to consider the Dynamic Meeting Model, i.e.
r
3.
1.
th
day and
X = x1n
4.
x2n
2.
x3n
where
xin
if the
ith
if he/she is not. The noise acting of the system consist of three random
variables:
1.
Rni
2.
Mnij
which is
which is
if the
if the
ith
ith
j th
Inij
with
1 if
probability p.
which is
the
ith
day and
3.
nth
nth
otherwise.
day and
Rni = 1
otherwise. .
Mnji .
j th
with probability
individual in the
nth
Mnij = 1
day and
q.
with probability
otherwise. .
Inij = 1
Under this formulation we can have the following Stochastic Update Rule :
x1n+1
(
J
J L
J
J
Mn12 In12 x2n Mn13 In13 x3n
=
Rn1
; x1n = 0
; x1n = 1
(18)
x1n+1
Mn12
In12
x2n
Mn13
In13
x3n
K
x1n
Rn1
x1n
(19)
Mn21
In21
x1n
Mn23
In23
x3n
K
x2n
Rn2
x2n
(20)
Mn31
In31
x1n
Mn32
In32
x2n
K
x3n
Rn3
x3n
(21)
x2n+1
x3n+1
N individuals
X
=
xin+1
Mnij
Inij
xjn
xin
Rni
xin
(22)
j{1,2,...,N } ; j6=i
Ai = A1
A2
AN .
Stochastic Update Rule given by equation 22 will be used to simulate a large scale epidemic model in
Part (f) of
this question.
(b)
We are considering
question is as follows:
1.
2.
4.
th
day and
n = 1 P n1 where n
st
the 1
day respectively.
Given
1st
xn
day. Hence,
1 = 0
En
and
the nal formula to calculate the average number of infected people in the
En = 0
ith
P.
S = {0, 1, 2, 3}.
xn to xn+1 infected people.
By Chapman-Kolmogorov equation,
3.
nth
nth
day as,
0
1
En = n
2.
3
day is
0
n1 1
0 P
2
3
In this regard consider the following. Let the total number of individuals be
(N y)
(N y)
(23)
N.
Consider that
non-infected individuals.
individuals is given by
Hence
infected
pI (y, k) =
N y
y k
y N yk
(1 (1 rp) ) ((1 rp) )
k
(24)
In equation 25,
m individuals will
y m
m
pR (y, m) =
q (1 q)
m
infected individuals,
recover is given by
(25)
k {0, 1, 2, . . . , y}.
xn
infected individual to
xn
to
xn+1
xn+1
of
and
xn
p (xn , xn+1 ) =
to
xn+1 is
X
(26)
given by
pI (y, k) pR (y, m)
(27)
http://www.math.umd.edu/~mariakc/teaching/hw4.pdf
However our calculation is more involved given that we also have to handle the meeting dynamics. Let
s = rp.
Then using equation 27 we can get the following probability transition matrix.
(1 s)2 q
P =
2
(1 s) q 2
0
2
(1 s) (1 q)
+2s (1 s) q
2
2 (1
s) q (1 q)
2
+ 1 (1 s)
q2
0
2s (1 s) (1 q)
+s2 q
2
2
(1 s) (1
q)
2
+2 1 (1 s)
q (1 q)
3q (1 q)
s2 (1 q)
2
2
1 (1 s) (1 q)
(28)
3q (1 q)
(1 q)
nth day,
s = rp which
En (r, p, q).
ie.
r and p
En (r, p, q) is
that
Please note
En (s, q). Rather than calculating En (s, q) for individual values of s and q we rather
En (s, q) for dierent n. We wrote a MATLAB code for the same which is included
Figure 3: Plot of
q.
En (s, q)
n, En (s, q)
n.
and monotonically
(c) For this part of the questions we would like to consider the Static Meeting Model, i.e.
For each pair of the three people in question, that pair has a probability
n=1
experiment. Other pairs do not meet. Hence this model is almost same as the model proposed in
for the fact that the random variable
at
n = 1.
Mnij
M ij = M ji .
n.
We have
Mnij = M ij
where
M ij
gets decided
x1n+1
M 12
In12
x2n
M 13
In13
x3n
K
x1n + Rn1
x1n
x2n+1
M 21
In21
x1n
M 23
In23
x3n
K
x2n + Rn2
x2n
x3n+1
M 31
In31
x1n
M 32
In32
x2n
K
x3n + Rn3
x3n
A more generalized version of the above Stochastic Update Rule can be written as
xin+1 =
M ij
Inij
xjn
xin
Rni
xin
(29)
j{1,2,...,N } ; j6=i
We will use this model for our simulation however, strictly speaking, this is not exactly a Markov Model. This point
will be discussed in
(d)
Part (d).
Part (c)
Part (c)
For a Markov
x2n+1
Mn21
In21
x1n
Mn23
In23
x3n+1
Mn31
In31
x1n
Mn32
In32
x1n+1
Mn12
In12
x2n
Mn13
In13
x3n
K
x1n + Rn1
x1n
x3n
K
x2n + Rn2
x2n
x2n
K
x3n + Rn3
x3n
where,
Mnij
Part (c) to be
Xn+1 = f (Xn , Zn , Y )
ij
make the variables M
a
a Markov Model, the denition of Stochastic Update Rule has to be made a little broad, i.e. is
where
state of the system. In that case the Stochastic Update Rule will look like
x1n+1
Mn12
In12
x2n
Mn13
In13
x3n
K
x1n + Rn1
x1n
x2n+1
Mn12
In21
x1n
Mn23
In23
x3n
K
x2n + Rn2
x2n
x3n+1
Mn13
In31
x1n
Mn23
In32
x2n
K
x3n + Rn3
x3n
12
Mn+1
= Mn12
13
Mn+1
= Mn13
23
Mn+1
= Mn23
and
r = 0.6.
Individual 1
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 2
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 3
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Figure 4: Disease propogation among individuals following Scenario 2 meeting model with parameters
q = 0.5
and
r = 0.6.
p = 0.5, q = 0.5
and
10
r = 0.5.
p = 0.8,
Individual 1
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 2
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 3
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Figure 5: Disease propogation among individuals following Scenario 2 meeting model with parameters
q = 0.5
and
p = 0.5,
r = 0.5.
To compare both the simulation observe that the recovery probability remains the same while the probability of
getting infected
infected decreases it is obvious that the number of infected people will reduce. This is exactly what we observe in
the above two graphs.
This study was performed for the bonus points. We simulated Scenario 2 meeting model for
and
p = 0.8, q = 0.5
and
r = 0.6.
Individual 1
Individual 2
10
15
20
25
30
35
0
0
40
Day
Individual 4
10
15
20
25
30
35
40
Day
Individual 5
10
15
20
25
Day
Individual 7
30
35
40
10
15
20
25
Day
Individual 10
30
35
40
10
15
20
10
15
20
25
30
35
40
Day
Individual 13
10
15
20
25
30
35
40
Day
30
35
p = 0.8, q = 0.5
10
15
10
15
10
15
25
30
35
40
20
25
30
35
40
20
25
30
35
40
Day
Individual 9
0
0
10
15
20
25
30
35
40
Day
Individual 11
Day
Individual 12
0
0
10
15
20
25
30
35
40
10
15
10
15
Day
Individual 14
1
20
25
30
35
40
20
25
30
35
40
Day
Individual 15
0
0
10
15
20
25
30
35
40
Day
Day
and
20
Day
Individual 6
40
25
Day
Individual 8
0
0
0
1
0
0
Individual 3
0
0
individuals
= 15)
r = 0.6.
Study 3: Comparative Study to see the eect of parameters on Scenario 1 meeting model
We rst got the simulation result for
p = 0.8, q = 0.5
and
r = 0.6.
11
Individual 1
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 2
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 3
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Figure 7: Disease propogation among individuals following Scenario 1 meeting model with parameters
q = 0.5
and
p = 0.8,
r = 0.6.
p = 0.5, q = 0.5
and
r = 0.5.
Individual 1
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 2
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Individual 3
0
1
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Day
Figure 8: Disease propogation among individuals following Scenario 1 meeting model with parameters
q = 0.5
and
p = 0.5,
r = 0.5.
To compare both the simulation observe that the recovery probability remains the same while the probability of
getting infected
of getting infected decreases. Therefore it is obvious that the number of infected people will reduce. This is exactly
what we observe in the above two graphs.
p = 0.8, q = 0.5
and
r = 0.6.
12
N = 15
individuals
Individual 1
Individual 2
0
0
10
15
20
25
30
35
40
Day
Individual 4
10
15
20
10
15
20
Day
Individual 7
25
30
35
25
30
35
40
10
15
20
Day
25
30
35
40
25
30
35
40
30
35
40
30
35
40
30
35
40
Individual 6
40
Day
Individual 5
Individual 3
10
15
20
25
30
35
40
Day
Individual 8
10
15
20
Day
Individual 9
0
0
10
15
20
25
30
35
40
Day
10
15
20
25
30
35
40
Day
Individual 11
Individual 10
1
10
15
20
Day
25
30
35
40
10
15
20
25
30
35
10
15
20
25
30
35
40
10
15
20
25
Day
30
35
10
15
20
25
Individual 15
0
0
p = 0.8, q = 0.5
Day
with parameters
25
Day
0
5
20
Day
Individual 12
40
Day
Individual 14
15
Individual 13
10
0
0
40
10
15
20
25
Day
= 15)
r = 0.6.
(g) Let En (r, p, q) be the expected mean of the non-immunity based model and EnI (r, p, q) represent the expected
mean of the immunity based model. Then we make the follwoing remarks:
1.
n,
immunity model lesser than expected mean of the non-immunity model. This is obvious because in the immunity
based model more and more people will get immuned to the disease and hence will not get infected thereby reducing
the average mean.
2.
The dierence
n.
immuned.
3.
with increase in
q,
4.
This is because
the individuals will have higher chance to get immuned. In other words the rate of immunity
En (r, p, q) EnI (r, p, q) with respect to n will increase with increase in p and r. This is
because with increase in p and r , more people will get infected. However this larger volume of infected people will
I
get immuned an hence reduce the average mean En (r, p, q) faster.
The rate of increase of
We also designed the Stochastic Update Rule when immunity is taken into account. Without immunity the stochastic
update rule is
x1n+1
Mn12
In12
x2n
Mn13
In13
x3n
K
x1n + Rn1
x1n
x2n+1
Mn21
In21
x1n
Mn23
In23
x3n
K
x2n + Rn2
x2n
x2n
K
x3n + Rn3
x3n
x3n+1
Mn31
In31
x1n
Mn32
In32
To consider immunity we have to introduce one more state per individual which tells if that individual has immunity
or not at a given epoch.
generalize. Let
th
In1
We will consider formulating the immunity based model for one individual and then
1
day. Otherwise In
1st
individual.
In1 = 1
if the
1st
M
13
x1n
Rn1
(30)
which basically states that the individual will have immunity in the next day if it already has immunity today OR
it infected today AND recovers today. The update rule for
x1n+1
x1n
will modify as
K
K M
K
K K
K K
= Mn12
In12
x2n
Mn13
In13
x3n
x1n + Rn1
x1n
In1
which states that the individual can get infected only of it does not have immunity. Therefore a more generalized
model is
xin+1
Mnij
Inij
j{1,2,...,N } ; j6=i
i
In+1
Ini
M
xin
Rni
; i
14
xjn
xin
Rni
xin
Ini
; i