Open iztanpy opened 3 years ago
if there is no input and it stops due to an infinite loop, it is probably due to the additional event that you added to check for serving time (i called mine Waiting event but idk what your naming is). Since your additional even does not have an output, it is probably stuck in a loop somewhere
i experienced the same issue as well, but managed to solve it by adjusting my event comparator to prevent recursive calls.
hi what do you mean changing the comparator to prevent recursive calls?
if (e1.getTiming() - e2.getTiming() > 0) { 8 return 1; 9 } else if (e1.getTiming() - e2.getTiming() < 0) { 10 return -1; 11 } else if (e1.getTiming() - e2.getTiming() == 0){ 12 return e2.order() - e1.order();
mine is something like this right now? I don't think it should be creating a loop though
arrive -> wait -> waiting -> serve -> done is my order of events, if lets say the customer cannot be served on arrival. all my events have a customer. my waiting event will check if the customer can be served by the server. if it can be served, a serve event will be returned. else, a waiting event is returned.
so my waiting event can return another waiting event, that was the source of my recursive call. thus i had to change my event comparator to check the customer ID as well, so that the correct order of events is polled from the priority queue. but i think this solution is quite tailored to my implementation haha not sure if it will work for urs too
Try to simulate a 0 server rest time i.e Pr=1 and ρ=0 to try to replicate the issue on your terminal and debug from there.
if you had implemented the checking sequence with service end time lists, then maybe you could check if your code deals with repeated service end times?
ahhh ok I think I got it thank you everyone!
Summary
Unsure why my code exceeds the time limit for hidden test case
Tried running it with 200 customers and it seems to work in my terminal
Description
[
](url)
Screenshots (if any):
Insert Images here if necessary