Question: I need the complete Python code for the question. Thank you. arrive at the YouBike station in a discrete-time sequence, say, t={1,2,3,}. There are two

I need the complete Python code for the question. Thank you. I need the complete Python code for the question. Thank you. arrive

arrive at the YouBike station in a discrete-time sequence, say, t={1,2,3,}. There are two types of arriving customers: Type I: Customer who wants to rent a bike; Type II: Customer who wants to return a bike. Suppose the "type" of every customer arriving at the YouBike station is "random", say, P(customerisType1)=p1andP(customerisTypeII)=p2,p1+p2=1. If an arriving customer is Type I and at least one bike is available on the dock, then a bike is successfully rented; otherwise, the customer will leave the station right away (thus being lost). If an arriving customer is Type II and at least one dock is empty, then a bike is successfully returned; otherwise, the customer will leave the station right away. Let Xt be the number of bikes available on docks at time t, and assume Xt can be modeled as a (discrete-time) Markov chain with one-step transition probabilities pij=P(Xt=jXt1=i),wherei,j=0,1,,4 Let p1=0.6,p2=0.4, and X0=2 ( 2 bikes on docks at time 0). Answer the following questions in order: (a) (5pts) Write down an algorithm with detailed steps to simulate this YouBike system. The algorithm should at least record all the event times, the evolution of Xt and the number of events transiting from state i to j. (b) (5pts) Suppose we want to estimate all non-zero transition probabilities pij(i,j= 0,1,,4 ) based on the simulation. Then, what is the required simulation length (or when to stop the simulation) so that with a 95% confidence we can say that all estimates p^ij have the margin of error less than 2% ? Clearly address all necessary steps to obtain the answer. [Hint: With a 95% confidence level, the margin of error for estimating each pij has an upper bound 1.96nij0.25. Use this upper bound to determine the required

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!