nus-cs2030 / 2021-s2

2 stars 2 forks source link

Project Level 4 average waiting time for customers #370

Open ErMingYong opened 3 years ago

ErMingYong commented 3 years ago

I am currently having issues in the implementation and calculation of the average waiting time for customers for level 4 of the project. Specifically, I am stuck at test 4_2.

Can anyone provide insight or solution as to how the total waiting time is accumulated before averaging it out?

Screenshot 2021-04-26 221724
clementyee303 commented 3 years ago

The sum of (current time of serve event - customer arrival time) / the total customers served

raihanyusri commented 3 years ago

It looks like you are not factoring in the rest time of the server into the waiting time of customers, just add them to the total waiting time and divide by the total number of customers served

wglee99 commented 3 years ago

Adding on to what was mentioned, it's likely that you're not adding the resting time of the servers to the customer's waiting time. What you can do for the total wait time is to add the times at which the waiting customers in the queue are served, then subtract away the event time of the wait event for these customers.

e0560113 commented 3 years ago

you can add the resting times of the servers to the waiting times

downmeanhigh commented 3 years ago

don't forget to update the waittime so that it updates the rest time of server

elizabethh07 commented 3 years ago

in my Simulator class, i did totalWaitingTime / numOfCustomersServed. to add on to totalWaitingTime, I did getCurrentEventTime - currentEvent.getCustomer().getArrivalTime()

timcheng112 commented 3 years ago

For me, I calculated the waitingTime (serveTime - arrTime of customer) in the EventRest class and summed it up until my PQ was empty before diving by the total num of customers served.

kexinnnwang commented 3 years ago

Each time the server rests, the customers waiting at the server will incur additional waiting time so you will need to update the total wait time and the time of the customers accordingly

zhuoyunhui commented 3 years ago

i think you need to account for the additional waiting time incurred when a customer waits at a server that rests