Open jlee1007 opened 2 years ago
HI, u shd only call .get once, which shd be when u r serving them
Hi! You should stick to principles in level 5 which is only to call .get() once for every customer in their ServeEvent. An approach would be to only return actual ServeEvent for a waiting customer if it is at the top of their queue, and some PendingEvent class if not. Then you should need to get the service time only once, as now the customer only has one actual ServeEvent.
for me, i invoked the .get() in my simulate, which ensures that I only get the timing when i rly need to serve
@YangHaoying thanks! how did u update the timing for the pending event tho
@YangHaoying thanks! how did u update the timing for the pending event tho
yeah i was thinking the same thing too! i wonder if it's possible to track the customer that the server is currently serving and then add this servicetime to the current time to update the timing for the pending event, maybe through an attribute in the Server class, otherwise my pending event keeps calling itself recursively
Edit : in the serve class, after i got the servicetime, i passed it into server's constructor so that i could access the servicetime of the customer that is currently being served
@loqir hello, how did you update the servers for the pending events such that the service times are updated? since pending events are created before the first person in queue gets served
@abigailxj hello! in my pending event, i did not update the server. i first checked if the customer was the first in the waiting list. if so, i will return a serve event. else, i will return another pending event which event time included the service time of the server.
Hi all for project level 6 we are suppose to allow for >1 customers to queue. all the methods I've tried seem to require me to invoke .get() even way before the earlier customers have been served which spoils the timing for them too.
does anyone know how to circumvent this problem? or what should be the correct way to update the nextAvailTime of the server?
thank you!