Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Assignment 2: Non-Homogeneous Poisson Process

Simulation

FEB22013(X)

Deadline: 17:00 January 31, 2023

This assignment is made in the same groups as Assignment 1.  To upload the submission all group members should have opened the assignment in Codegrade, otherwise you are not able to submit!  Note:  If you are not signed-up to a group of 2-3 students on Codegrade, you are not able to submit your assignment!

You are expectd to use the Java template provided on Canvas an adjust te files in the “Assignment 1”package.  Do not change the package structure or remove

the contents of the Main files in the template, as this output is evaluated in Code-

grade. In Codegrade, submit both a PDF containing your solutions with the name Assignment2.pdf and the following .java files:

 MainStudentRoom.java

MainElevators.java

• ElevatorPolicy1State.java

• ElevatorPolicy2State.java

• ElevatorPolicy3State.java

Utils.java

An AutoTest will compile and run your code.  You can check in CodeGrade whether these tests passed. This does not mean that your solutions are correct, it solely means that your code could be compiled. If the AutoTest failed, you can see the error message on Codegrade to resolve it.

We do not accept hand written solutions.  Any hand written part of your as- signment (this includes parts that are written on a tablet) are not graded.

Each group is expected to work individually, and to hand in their own work. Violations will be reported to the Exam Administration.

Question 1        Student Room Search

You are looking for a room via Stadswonen. You replied to many advertisements and now received invitations to visit m of these rooms. When you visit the room, you immediately have to decide whether you want that room or not, before viewing the other rooms. A well known strategy for this problem is to visit the first r rooms without taking any of them, and to then take the first room that exceeds the best rooms out of the first r rooms. Since you really want to have a room in Rotterdam, you do always take the last room you visit, regardless of its quality.

Assume there exists a preference ranking of all m rooms that you are allowed to visit, i.e., there are no two rooms that you like equally well.  Let the nicest room have rank 1 and the worst room have rank m.

a.  Give the pseudocode of a Monte Carlo Algorithm to determine the probability that you end-up with the nicest room if you use the above described strategy.

b.  Give the pseudocode of a Monte Carlo Algorithm to determine the expected rank of the room that you end-up with if you use the above described strategy.

c.  Implement the above described Monte Carlo Algorithms.   If you can visit m =  12 rooms, what level of r would you use if you want to maximise the probability of obtaining the nicest room, and what level of r would you use if you want to minimise the expected rank of the room? Provide the output in a table.

Question 2        Oice Elevators

An investor of a tall office building with 2 elevators wants to analyse the effect of different elevator policies on the average time waiting for an elevator, the average number of employees waiting for an elevator, and the average time spend in an elevator. He is specifically interested in this during the morning peak, which lastst for one hour, when employees arrive at the office.  He is considering the following three policies:

1.  Both elevators visit all floors

2.  One elevator visits the odd numbered floors and the other elevator visits the even numbered floors.

3.  One elevator visit the bottom half of the building (floors 1-6) and the other elevator visit the remaining, top part, of the building (floors 7-12).

To compare the two policies, you are asked to implement a simulation and provide the company with an advice for their elevator policy.   You can make use of the following assumptions:

•  During the morning peak, employees arrive at the ground floor and take the elevator to the floor that contains their office.  There are no employees that take the elevator from another floor than the ground floor.

•  Employees arrive according to a non-homogeneous Poisson process with rate

100 + 50 cos{2πt − π}

for 0 1.

•  The offices of the employees are evenly spread over all floors and all employees take the elevator.

•  For policy 1, when both elevators are at the ground floor and have capacity, employees choose an elevator at random.

•  For policy 1 and 2, when an elevator departs from the ground floor and needs to stop at n floors, it takes the elevator 30 + 20n seconds to stop at those floors and be back at the ground floor.  For policy 3, it takes an elevator for the bottom part of the building 20 + 20n seconds to stop at n floors be back at the ground floor and 40 + 20n seconds to stop at n floors from the top part

of the building and be back at the ground floor.

•  Each elevator has a capacity of 10 people.

• An elevator departs 10 seconds after the first employee enters the elevator, re- gardless of the number of employees in the elevator and time the last employee entered the elevator.

a.  Define the relevant state variables, counter variables and events when using policy 1.  Explain how all variables are updated (i.e., when and how do the values change). Moreover, show how the simulation is initialised, and for each event when it is generated.  Explain how the required performance measures can be calculated.

b.  Program the DES using the variables and events defined.

c.  Program the DES for policy 2. Explain briefly what changes compared to the scenario with policy 1 (i.e., explain what parts are different compared to a., you do not have to repeat the elements that remain the same).

d.  Program the DES for policy 3. Explain briefly what changes compared to the scenario with policy 1 (i.e., explain what parts are different compared to a., you do not have to repeat the elements that remain the same).

e.  Give a recommendation to the investor regarding the elevator policy in his building.  Explain differences you find in the performance measures for the different policies.