Question: DONT USE AI AND provide R script wherever required. Just answer questions 3 and 4 , for R code use only ( just ) runif
DONT USE AI AND provide R script wherever required. Just answer questions and for R code use only just runifn Start every R script with the command set.seed
In Foodys, a food delivery company for safety, each scooter has to go through a checkup after it has worked for c consecutive days. Further, scooters are subject to breakdowns: the time a scooter is in service before breaking down follows an exponential distribution with rate per day. The company hires two mechanics. However, mechanic is specifically assigned for checkups and mechanic for repairs. Scooters that need a checkup go to mechanic and queue waiting for a checkup. Scooters that break down go to mechanic and queue waiting for repair. Suppose Foodys owns N scooters out of which n are working during Foodys working hours and the rest N n are either at mechanic for a checkup, mechanic for repair, or in Foodys parking lot waiting to be used. When a scooter goes for a checkup or breaks down, it is replaced with one of the scooters in the parking lot. The first n working scooters are not subject to a checkup until they have had their first breakdown, but scooters in the parking lot are assigned a checkup time the minute they start working.
The first time Foodys is underresourced:
Foodys is concerned about having more than N n scooters at the mechanics and thus having to work with less than n scooters. Suppose they start with n scooters working and N n at the parking lot ready to be used when needed. Assume that the time mechanic takes to do a checkup follows an exponential distribution with rate per day, and mechanic repair times also follow an exponential distribution with rate per day. Let T be the first time that Foodys works with less than n scooters. We want to estimate ET
i Using N n c and build a simulation model to estimate ET When you build your simulation model define your variables, events, event lists, output variables. Write down the pseudocode of each event case as we did in lecture. Implement your model by writing an R script to estimate ET using K iterations.
Question Correct the distribution of the mechanics:
Foodys informs you that the distributions for the mechanics are not as given in part For mechanic the density function is fx xex x infty For mechanic the distribution functionCDF is Fx ealpha xbeta x infty where alpha and beta
i For each mechanic, use a different method to simulate the service times. Justify why you used that method. Write two R functions, one for each mechanic, that simulate the service times.
ii Generate iid values from each function and plot their histogram with the densities of the distributions to show that they have indeed been simulated correctly multiply the densities with a constant so that they align with the histogram and explain how you got that constant
Qeustion CEOs visit to r cities: Foodys CEO needs to visit cities r with city being the city she is currently located at Suppose a nonnegative reward vi j is associated with the CEO going from city i to city j So if the CEO visits the cities in permutation x to xr then the reward of this choice x x xr is:
V xsum i to r vxi xi where x Note that there is no reward for coming back to city To generate vi j set seed to and generate vi j using Uniform random variables starting from i and j to
then v j for j to v j for j and so on
i Use MCMC and r to simulate high reward itineraries for the CEO. Define the stationary distribution that we want our Markov Chain to converge in such a way that high valued solutions are given extremely high probability and include a tunable parameter. Find values of this parameter where the generated Markov Chain behaves differently in the long run for each of
these values and demonstrate this using plots and averages.
ii If you could change this parameter during one simulation of the stationary distribution, how would you change it in order to improve the solutions. Demonstrate that you can get better solutions than the fixed values that you used in i by running it in R Present all your results.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
