nus-cs2030 / 2021-s2

2 stars 2 forks source link

Project lvl4 Hidden Test Case Issue #259

Open 132468756 opened 3 years ago

132468756 commented 3 years ago

Hi guys I have been trying the lvl4 for the project but there is one small issue with regards to that. It is about the hidden test case, whereby in the sample output Customer 14 waits at Server 2. But my output shows that Customer 14 actually waits at Server 1. I have been trying to debug for this thing and I couldn't do so. Anyone faced same problem before? Help plssss

hypernuggets commented 3 years ago

Can you screenshot the specific output from Codecrunch?

somenobody98 commented 3 years ago

Ya I am facing that problem too. But I managed to narrow the issue down to how I implemented my Events and my Servers. The issue surfaced due to the Server taking in the wrong rest time because the event was processed one event early. It is quite complicated but I hope this helps

jordanwwb commented 3 years ago

It is mainly because the server 1 is suppose to be full and thus cannot take in anymore customers. I found out that at my done event i would subtract the queue by 1 as the server would be serving the next waiting customer, but for the case where the server is resting you do not need to subtract by 1 as the sever is resting and unable to serve the next customer. Hope this helps with the issue.

XiHuijia commented 3 years ago

When the server is resting and the queue is full, the queue cannot take new customer and the new coming customer has to leave/choose another server

gableejh commented 3 years ago

sounds like the queue for server 1 is full, perhaps check ur queueing logic and make sure you add back to the queue one a waiting customer is served

brianlyc commented 3 years ago

I faced the same issue, but this was because there was a logical error in how i dequeue my customers in my server. I changed the dequeueing of customer to after the serverRest event instead of dequeueing the customer straight after the Done event.

Ryanng-zr commented 3 years ago

i had the same issue as well! Here, Server 1 is meant to be fully booked. My error was in my rest event: I updated my Server too early before the rest ended and took in the first waiting customer in the queue, thus making the Server free. Maybe you could check if you made the same mistake

JWulaXia commented 3 years ago

i encounter the same issue, you need to check all servers if anyone can immediately serve the customer, then put the customer into the server,else, check if any server's queue is not full and put the customer in that server

Brandon-Chiu commented 3 years ago

I faced the same issue too. You might have pushed the queue forward earlier than it should, resulting in the server being able to serve the customer when it should not be able to.