Starting from:

$24.99

CSE474 - Lab Task 3 Solution

1. Go through this documentation of Simpy:
https://simpy.readthedocs.io/4.0.1/simpy_intro/index.html
SimPy is a framework speci cally geared towards discrete-event simulation. You can go through the following code to get a glimpse of how SimPy works:
https://colab.research.google.com/drive/1Q6qjYYkYpaKoMbNnguvAlrB8CI_7EjNR?authuse r=3#scrollTo=iZ_FFn8egK03
2. Now, go through this speci c example on their website:
https://simpy.readthedocs.io/en/4.0.1/examples/bank_renege.html
They have other examples too. Going through more of them will make you more well-versed in SymPy, but one example should su ce.
3. I want you to change this code in the example in a way so that while there will be one counter initially, whenever there are more than ve customers waiting in line, a new counter will be created (or you could increase the capacity, perhaps). You will see in the example that a customer gives up after a speci c threshold waiting time. Instead of letting them give up (called “renege” in the example), you will open up a new counter again. Also, each act of opening up counters (or increasing capacity) (including the rst) needs to be printed in real-time. The maximum number of counters (or the maximum capacity) will be 20. After that, the customers give up.
4. Your sample output should look something like this:
Bank renege modified 0.0000 Counter00: Opened 0.0000 Customer00: Here I am 0.0000 Customer00: Waited 0.000 3.8595 Customer00: Served by Counter 01 10.2006 Customer01: Here I am 10.2006 Customer01: Waited 0.000 12.7265 Customer02: Here I am 13.9003 Customer02: About to give up after 1.174 13.9004 Counter02: Opened 22.8994 Customer02: Served by Counter 02 23.7507 Customer01: Served by Counter 01 34.9993 Customer03: Here I am 34.9993 Customer03: Waited 0.000 35.9599 Customer04: Here I am 37.4798 Customer03: Served by Counter 02 40.4798 Customer04: Waited 0.000 43.1401 Customer04: Served by Counter 01
Your code should be well-commented.
The programming language should be Python 3.

More products