Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab 8 Test case 11 #333

Open
keefetok opened this issue Nov 29, 2022 · 9 comments
Open

Lab 8 Test case 11 #333

keefetok opened this issue Nov 29, 2022 · 9 comments

Comments

@keefetok
Copy link

Summary

My customers are stuck to a particular self check server, where if:

12 waits at self check 2
13 arrives
13 waits at self check 2
9 done serving by self check 3
--> by right 12 should be served by self check 3, however, my code compiles to give:
14 arrives
14 served by self check 3
...
(wait for next free time for self check 2)
12 served by self check 2
...
12 done serving by self check 2
13 served by self check 2
...

How do I go about fixing this?

Currently, in my events, I return a pair<event, pair, selfcheckoutmanager>
where my selfcheckoutmanager controls the shared queue and the list of self check out servers

Screenshot 2022-11-29 at 9 20 25 AM

@glendon29
Copy link

i dk but somehow u have pre-assigned 12 to 2 already. and also rmb to update the queue properly when u serve the previous customer. PS maybe u can show a code snippet of how u generate the self checkout serve in the simulator

@izascia256
Copy link

Are you doing something like putting the entire queue on self check counter 2 while self check counter 3 has a max queue length of 0?

I noticed that your self checkout counter 3 does not pull from the queue of self checkout counter 2 at all, and only accept recently arriving customers.

Remember that although self checkout counter 2 should hold the queue, the Wait Event should also check for the availability of self checkout counter 3.

@shecheeyee
Copy link

From my understanding, you preassigned each customer to a queue based on which self-checkout has the earliest available time, this caused some counters to be assigned the same queue.

To account for the changes in "earliest available time", you could have a mechanism to check which counter has the earliest available time at each iteration. You can then update the queue number and timing for the events in the queue using a similar mechanism.

@cyiting
Copy link

cyiting commented Nov 29, 2022

It seems as though you have your customer wait behind self-check 2 but you don't check to see if self-check 3 is free to check whether it can serve the customer after it is done. What you can do is check to see which self-check counter is free each time in the same way that you checked which of the counters 1-n and self-check n+1 is free initially when the customer first arrives.

@valerietanhx
Copy link

I had the same issue too! Even though your customer queues at the first self-checkout counter, it shouldn't actually stay there, and should go to the next self-checkout counter that's free. What I did was to check in my Wait class the next self-checkout counter that would be free by looping through the list of counters, then sending my customer to that counter accordingly when they finally get served.

@keefetok
Copy link
Author

i dk but somehow u have pre-assigned 12 to 2 already. and also rmb to update the queue properly when u serve the previous customer. PS maybe u can show a code snippet of how u generate the self checkout serve in the simulator

hi! my self check out servers are generated using a separate SelfCheckOutServer class that inherits from Server class

@keefetok
Copy link
Author

I had the same issue too! Even though your customer queues at the first self-checkout counter, it shouldn't actually stay there, and should go to the next self-checkout counter that's free. What I did was to check in my Wait class the next self-checkout counter that would be free by looping through the list of counters, then sending my customer to that counter accordingly when they finally get served.

hi, do you update your sselfcheckoutlist for every event? coz right now in my events i have a check to see if its selfcheckout server, and if it is i use a similar way of returning to the next event but use different inputs (instead of using individual waiting Q for each server, I use a shared Q)

@valerietanhx
Copy link

valerietanhx commented Nov 29, 2022

Hello!! If I'm understanding you correctly (updating as in modify the list) then hmm most of my events (except Arrive, StillWaiting, Leave) do!

Think you're on the right track with using different inputs if it's a self-checkout counter though! Maybe you're not changing the inputs at the correct stage? My implementation relies on the first self-checkout counter having a queue (the common queue) and the others all not having a queue at all. From Arrive to Wait, I'll send customers to this first self-checkout counter, and I only switch to the appropriate self-checkout counter when moving from Wait or StillWaiting to a Serve event.

Edited to add more info because reviewing your screenshot jogged my memory: I'm not 100% sure but when I got this exact error I think the issue might have been that I was passing the wrong input into my canServe, leading to customer 12 sticking to self-check 2 instead of self-check 3 instead.

What I did to debug was add a lot of print statements with the times that my servers would be free at to check they were updating correctly, so maybe you can try that too! Jiayous :)

@ZYN2122
Copy link

ZYN2122 commented Nov 29, 2022

It could be that you preassigned the counter at the point of forming wait, perhaps you can try to delay this assignment! To a later stage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants