Closed ziyi105 closed 1 year ago
Hi Ziyi, from the error output it seems that your "assignment to specific self-check counter" logic for self-checkout counters is as per intended. Customer 12 was served by self-check 2 although he's supposed to be served by self-check 3. Do you mind explaining your code logic for this part of the question? Perhaps it would reveal what needs to be fixed.
If I am not wrong, your method of assigning a person to a self check out after waiting at the queue for self check out is not correct. If there are say >1 self check out counters, you should not assign a person entering the self check out queue the current best self check out counter (ie. the one that currently has the lowest free time) because maybe a person in the middle might take a really short serve time. In your test case, you can see that 12 was assigned to self check 2 prematurely even though it should be assigned to self check 3 when self check 3 becomes free since 12 is at the front of the queue.
What I did if im not wrong was to have a list of people at the self check out queue, and check that whenever we serve a customer from the self check out queue, it is the person at the very front of the queue.
Hope this was hlepful
Im not sure how ur implementation is like but one thing to note that is very similar to the code base on how u use to check for the human servers. Just that keep in mind that once u get any free counters , immediately retrieve the first person in queue K+1 then generate the serve event
omg thank you guys for helping me, i managed to solved it!
I am stuck at this test case for quite a while already Basically I stored human servers as well as self-checks counter in the same list in my shop class. The self-checks queue is also in my shop class.