Stochastic Operations Research
Programming Assignment 1
Due date: Friday, October 25, 1pm
In this assignment I would like you to implement a certain computational task using a programming language
of your choice. For everyone in INSY 3010 I would strongly suggest that you use Python. The following
instructions are written with Python in mind. If you are not taking, or have never taken INSY 3010, you
are free to use any programming language you choose and feel free to talk to me about your situation and
options. I strongly suggest that you do not try to do this assignment on the day before it is due, unless you
are very comfortable with computer programming!
Note: all submissions will be processed through an automatic plagiarism detection tool. It will compare the
Python codes submitted and find pairs that are similar. All submissions that exceed critical similarity score
will be reported to Academic Honesty Committee.
Assignment overview. Our goal is to perform an analysis of a stochastic system using Monte-Carlo simulation,
i.e., by observing its behavior repeatedly and then determining expected outcomes. As the basis for
代做INSY 3400作业this assignment we will use a problem similar to III.11 from the practice set (discussed in class). Your task
is to estimate a few characteristics for the processing time. Let’s denote as X the random variable for the
total time (in minutes) required to complete all jobs (see problem description below). You are interested in
characteristics (average, variance, quantiles, etc) of X. To do that you can create a sample: N independent
realizations (x1, x2, . . . , xN ) and then calculate sample average and sample variance as
Directions:
• Consider the following system.
n jobs need to be completed in a day. Usually, p% of all jobs are easy, so that the time it takes
to complete them is well-described by normal distribution with average µ1 minutes and standard
deviation σ1 minutes. The rest are challenging jobs, so that completion time is well-modeled with
exponential distribution with average µ2 minutes.
• Pick values for parameters n, p, µ1, µ2, σ1 by following links below.
N is a special parameter that determines the accuracy of the result (you will learn more about it in the
Simulation class next semester). For this assignment, you will need to try different values.
1
• Your code should consist of two parts: create the sample and calculate sample average and variance.
• To create the sample, your code should repeat the following N times
– first determine how many easy and how many challenging jobs there are. Observe that the number
of easy jobs has binomial distribution with parameters n and p. Hence, to get your values,
draw one sample (call it m) from binomial random variable with your parameters. Then m is the
realized number of simple jobs and n − m is the number of challenging jobs.
– draw m samples from normal (with parameters µ1, σ1) distribution and n − m samples from
exponential (with average µ2)
– add all samples together to calculate the total processing time
– write down the total processing time value
• With the calculated sample of N realizations of the total processing time, apply formulas above to
calculate sample average and sample variance
• Your code can look something like this
r e p e a t N ti m e s
m : = b i n o mi al ( n , p )
e a s y J o b s : = m s am pl e s f rom n o rmal ( mu1 , si gma 1 )
c h a l l n g i n g J o b s : = n−m s am pl e s f rom e x p o n e n t i a l ( mu2 )
t o t a l T i m e : = sum ( e a s y J o b s ) + sum ( c h a l l e n g i n g J o b s )
x [ j ] : = t o t a l T i m e
j : = j +1
a p pl y sam ple a v e r a g e and v a r i a n c e f o r m u l a s t o t h e sam ple l i s t
• You will need to learn how to draw random samples from standard distributions. In Python, you
can use package numpy.random. Reference manual is here:
and carefully read the function description.
• To complete assignment, run your code with your parameter values and different values for N. Determine
the value for N that is sufficient for you to be confident in reporting sample average and sample
variance with two digit accuracy.
Submission instructions. Submit your code and a brief (not more than one page) report on Canvas. In
the report clearly identify the values of parameters that you used, the values for sample average and sample
standard deviation, and the value of N that you determined to be appropriate. Also describe the procedure
you used to select N. The report should be in .pdf, .doc or .docx format. If you are using Python submit
your .py file, otherwise, submit all of the files required to recreate your experiments.
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
微信:codehelp