[SOLVED] CS2030 Project: Discrete Event Simulator

$25

File Name: CS2030_Project__Discrete_Event_Simulator.zip
File Size: 376.8 KB

SKU: [Solved] CS2030 Project: Discrete Event Simulator Category: Tag:
5/5 - (1 vote)
CS2030 Project Discrete Event SimulatorA discrete event simulator is a software that simulates the changes in the state of a system across time, with each transition from one state of the system to another triggered via an event. Such a system can be used to study many complex real-world systems such as queuing to order food at a fast-food restaurant.An event occurs at a particular time, and each event alters the state of the system and may generate more events. States remain unchanged between two events (hence the term discrete), and this allows the simulator to jump from the time of one event to another. Some simulation statistics are also typically tracked to measure the performance of the system.The following illustrates a queuing system comprising a single service point S with one customer queue.In this exercise, we consider a multi-server system comprising the following:There are a number of servers; each server can serve one customer at a time.Each customer has a service time (time taken to serve the customer).When a customer arrives (ARRIVE event): if the server is idle (not serving any customer), then the server starts serving the customer immediately (SERVE event). if the server is serving another customer, then the customer that just arrived waits in the queue (WAIT event).if the server is serving one customer with a second customer waiting in the queue, and a third customer arrives, then this latter customer leaves (LEAVE event). In other words, there is at most one customer waiting in the queue.When the server is done serving a customer (DONE event), the server can start serving the customer waiting at the front of the queue (if any). If there is no waiting customer, then the server becomes idle again.Notice from the above description that there are five events in the system, namely: ARRIVE, SERVE, WAIT, LEAVE and DONE. For each customer, these are the only possible event transitions:ARRIVE SERVE DONEARRIVE WAIT SERVE DONEARRIVE LEAVEIn essence, an event is tied to one customer. Depending on the current state of the system, triggering an event will result in the next state of the system, and possibly the next event. Events are also processed via a queue. At the start of the simulation, the queue only contains the customer arrival events. With every simulation time step, an event is retrieved from the queue to be processed, and any resulting event added to the queue. This process is repeated until there are no events left in the queue.As an example, given the arrival times (represented as a floating point value for simplicity) of three customers and one server, and assuming a constant service time of 1.0,

0.500 0.6000.700

The simulation starts with three arrival events

<0.500 1 arrives><0.600 2 arrives><0.700 3 arrives>

The next event to pick is <0.500 1 arrives>. This schedules a SERVE event.

<0.500 1 serves by 1><0.600 2 arrives><0.700 3 arrives>

The next event to pick is <0.500 1 served>. This schedules a DONE event.

<0.600 2 arrives> <0.700 3 arrives><1.500 1 done serving by 1>
The next event to pick is <0.600 2 arrives>This process is repeated until there are no more events.Using our example, the entire simulation run results in the following output, each of the form <time_event_occurred, customer_id, event_details>

0.500 1 arrives0.500 1 serves by 10.600 2 arrives0.600 2 waits at 10.700 3 arrives0.700 3 leaves1.500 1 done serving by 11.500 2 serves by 12.500 2 done serving by 1

Finally, statistics of the system that we need to keep track of are:1. the average waiting time for customers who have been served;2. the number of customers served;3. the number of customers who left without being served.In our example, the end-of-simulation statistics are respectively, [0.450 2 1].Priority QueuingThe main structure that is used to manage the events in any discrete event simulation is the Priority Queue. Java provides the PriorityQueue (a mutable class) that can be used to keep a collection of elements, where each element is given a certain priority.Elements may be added to the queue with the add(E e) method. Note that the queue is modified;The poll() method may be used to retrieve and remove the element with the highest priority from the queue. It returns an object of type E, or null if the queue is empty. Note that the queue is modified.Take NoteThe requirements of this project will be released in stages. For each level N, you will be given a driver class MainN in the file MainN.java, and you will be required to create the SimulateN class to go along with it.All utility classes are to be packaged in cs2030.util, while the rest of the classes related to the simulation are to be packaged in cs2030.simulator, with SimulateN as the only public facing classes.The Pair and ImList classes are provided. Compile your code using

javac -d . *.java

and run your program to ensure that everything is still in good working order before proceeding to the next level.Level 0Before delving into the implementation of the simulator, you will need to come up with your own generic immutable priority queue, PQ<T>. Specifically, you will need to construct the following:A constructor that takes in a Comparator and creates an empty PQ<T>A method add that takes in an element of type T and returns the resulting PQA method poll that takes no arguments and removes the highest priority element in the queue (as determined by the Comparator). Note that both the element and the resulting queue should be removed, i.e. the return type should be Pair<T, PQ<T>>A method isEmpty() that returns true if the PQ is empty, or false otherwise A toString method that returns a string representation of the PQAs much as possible, you should adopt the immutable delegation pattern for your implementation. Also note that the Pair class has been provided for you.

jshell> import cs2030.util.* jshell> Comparator<String> cmp = (x, y) -> x.compareTo(y)cmp ==> $Lambda$15/[email protected] jshell> PQ<String> pq = new PQ<String>(cmp)pq ==> [] jshell> pq.add(one).add(two).add(three)$.. ==> [one, two, three]jshell> pq pq ==> [] jshell> pq.isEmpty()$.. ==> true jshell> pq = pq.add(one).add(two).add(three) pq ==> [one, two, three] jshell> pq.poll()$.. ==> (one, [three, two])jshell> pqpq ==> [one, two, three] jshell> pq.isEmpty()$.. ==> false jshell> pq.poll().first()$.. ==> one
NLYthW dA p cIntiYLWw jshell> pq.poll().second().poll().first()$.. ==> three jshell> pq = pq.poll().second().poll().second().poll().second() pq ==> [] jshell> pq.isEmpty()$.. ==> true jshell> Comparator<Object> c = (x, y) -> x.hashCode() y.hashCode()c ==> $Lambda$22/[email protected] jshell> pq = new PQ<String>(c)pq ==> [] jshell> pq.add(one).poll()$.. ==> (one, []) tobet
ote that the PQ class should be packaged in cs2030.util, together with the Pair class.evel 1ou will start by building a walking skeleton of the discrete event simulator. With this framework in place, you would be able to flesh out the details accordinge requirement in subsequent levels. All the classes should reside in the package cs2030.simulator.rite an immutable Customer class to represent each arriving customer that is tagged with a customer ID (of type int), as well as an arrival time (of typeouble).

jshell> import cs2030.util.* jshell> import cs2030.simulator.* jshell> new Customer(1, 0.5)$.. ==> 1 jshell> new Customer(2, 0.6)$.. ==> 2 jshell> new Customer(3, 0.7)$.. ==> 3

n event (i.e. ARRIVE, SERVE, DONE, WAIT, or LEAVE) is associated with a customer and an event time. Events are placed in a priority queue so that they canolled one after another according to the time of occurrence of the event. Let us first create a dummy event EventStub to test that events are processedorrectly using the priority queue, PQ<Event>.the EventStub class, include the constructor that takes in a customer and the event time. Also include an appropriate toString method to return the evenme as a string. ou will also need to define an appropriate EventComparator when creating the priority queue.

jshell> Event event = new EventStub(new Customer(1, 0.5), 3.7) // event time of 3.7 event ==> 3.700 jshell> Comparator<Event> cmp = new EventComparator()cmp ==> [email protected] jshell> PQ<Event> pq = new PQ<Event>(cmp) pq ==> [] jshell> pq = pq.add(new EventStub(new Customer(1, 0.5), 3.5)) pq ==> [3.500] jshell> pq = pq.add(new EventStub(new Customer(2, 0.6), 2.6))pq ==> [2.600, 3.500] jshell> pq = pq.add(new EventStub(new Customer(3, 0.7), 1.7))pq ==> [1.700, 3.500, 2.600] jshell> pq.poll().first()$.. ==> 1.700 jshell> pq.poll().second().poll().first()$.. ==> 2.600 jshell> pq.poll().second().poll().second().poll().first()$.. ==> 3.500 jshell> pq.poll().second().poll().second().poll().second().isEmpty()$.. ==> true

evel 2rite an immutable Server class to represent a server that is tagged with a server ID (of type int). The servers provide their services within a shop. As such, rite a Shop class that takes in a list of servers.

jshell> import cs2030.util.* jshell> import cs2030.simulator.* jshell> new Server(1)$.. ==> 1 jshell> new Server(2)$.. ==> 2
AnThepair.1^D jshell> new Shop(List.<Server>of(new Server(1), new Server(2))) $.. ==> [1, 2] i,
Now how do we link the customer(s) to the shop (or list of servers)? By using events! Every time an event is polled from the priority queue, the event (e.g. SERVE event) looks at the current state of the shop, and updates the state (e.g. an available server becomes busy) as well as to generate the next event (e.g. generating a DONE event to be added to the priority queue).Event interface is given below; you may modify it to suit your needs later.

package cs2030.simulator; import java.util.Optional; import cs2030.util.Pair; interface Event {Pair<Optional<Event>, Shop> execute(Shop shop); }

execute method takes the current status of the shop, makes changes to the state of the shop based on the event, and returns the next event (if any) andupdated shop status as a pair of values.Now, include the execute method in the EventStub that takes in a Shop, and returns no event (represented by an empty optional) and the same shop as a

jshell> Shop shop = new Shop(List.<Server>of(new Server(1), new Server(2))) shop ==> [1, 2] jshell> new EventStub(new Customer(1, 0.5), 3.5) $.. ==> 3.500 jshell> new EventStub(new Customer(1, 0.5), 3.5).execute(shop) $.. ==> (Optional.empty, [1, 2])

Since events are associated with customers and the shop associated with the servers, a particular instance of the simulation can be completely defined by the priority queue of events, as well as the status of the shop. Write the class Simulate2 with a constructor that takes in the number of servers, together with a List<Double> of customer arrival times, and constructs a priority queue of EventStub events using the arrival time as the event time, and the status of the shop.Include a run method within the Simulator2 class that takes no arguments, such that invoking the method will cause the simulation to start by having the events in the priority queue polled one after another until the queue is empty. The run method should return a string.

jshell> new Simulate2(1, List.<Double>of(0.5, 0.6, 0.7))$.. ==> Queue: [0.500, 0.600, 0.700]; Shop: [1] jshell> System.out.println(new Simulate2(1, List.<Double>of(0.5, 0.6, 0.7)).run())0.500 0.6000.700 End of Simulation jshell> new Simulate2(2, List.<Double>of(3.5, 2.6, 1.7))$.. ==> Queue: [1.700, 3.500, 2.600]; Shop: [1, 2] jshell> System.out.println(new Simulate2(1, List.<Double>of(3.5, 2.6, 1.7)).run())1.700 2.6003.500 End of Simulation

Use the program Main2.java provided to test your program as shown below. The first input value is the number of servers. This is followed by a sequence of input arrival times associated with each Customer having an identifier 1, 2, 3, respectively. User input is underlined. Input is terminated with a ^D (CTRL-d).Take note of the following assumptions:The format of the input is always correct;Output of a double value, say d, is to be formatted with String.format(%.3f, d);Level 3If you have designed the simulator correctly, this level would only require you to construct the rest of the ARRIVE, SERVE, DONE, WAIT and LEAVE events in order to perform a proper simulation. For each event, you will need to define an appropriate execute method that takes in the current state of the shop, and return the appropriate next event, as well as the updated shop as a pair of values.Using an ARRIVE event at time t as an example, if the execute method takes in a shop with all servers free, then the shop will return a serve event (to be served by 1 at time t), and the shop (no updates are necessary since service has not started). On the other hand, if the event was a SERVE event at time t at then the execute method takes in the shop, and returns a DONE event at time t + 1.0 (assuming service time of 1.0) together with the updated shop with server i tagged as busy.From this point on, you will not be guided with jshell tests. Instead we will only provide sample runs using the provided Main programs.Heres a tip: rather than creating all five events at the same time, you can still develop and test one event at a time. For example, start with the arrival event, and within its execute method, return the EventStub with a later event time. At the same time, you can check the status of the shop to see if the updates are intended. Eventually, all arrival events will be processed and only EventStub events are left in the queue, which are then processed as per the earlier level.Once tested, you can then proceed to let arrive events execute return serve event, and have serve events execute method return EventStub.

ClTWyUcUarM re jshell> list.get(0)$.. ==> (0.5, $Lambda$35/[email protected]) jshell> list.get(1)$.. ==> (0.6, $Lambda$35/[email protected]) jshell> list.get(2)$.. ==> (0.7, $Lambda$35/[email protected])
early, the three input are associated with the first value of each pair in the list.

jshell> list.get(0).first()$.. ==> 0.5 jshell> list.get(1).first()$.. ==> 0.6 jshell> list.get(2).first()$.. ==> 0.7

he second value of each pair will not read input until the Suppliers get method is invoked. For example,

jshell> list.get(1).second()$.. ==> $Lambda$35/[email protected] jshell> list.get(1).second().get()1.0$.. ==> 1.0

hat is interesting in the above is that the second customer with the arrival time of 0.6, is the first one to be served with a new input of 1.0. Also note that ifou invoke the same jshell test again, another input is read and returned, rather than returning the value that was last read.

jshell> list.get(1).second().get() // same test2.0$.. ==> 2.0

se the program Main5.java provided to test your program. The Lazy class in Lazy.java is also provided; use it if you need to cache the service time of theustomer.ser input starts with an integer value representing the number of servers, and an integer value representing the number of customers. This is followed by the rival times of the customers. Lastly, a number of service times (could be more than necessary) are provided.oreover, rather than typing out the user input, it would be more convenient if you save the input in a file, say test5_1.in and pipe the contents of the file ordirect the file as part of user input.To pipe the contents of the file, use: cat test5_1.in | java Main5To redirect the file, use: java Main5 < test5_1.in

$ cat test5_1.in1 30.500 0.6000.7001.0 1.01.0$ cat test5_1.in | java Main50.500 1 arrives0.500 1 serves by 10.600 2 arrives0.600 2 waits at 10.700 3 arrives0.700 3 leaves1.500 1 done serving by 11.500 2 serves by 12.500 2 done serving by 1[0.450 2 1]
$ cat test5_2.in1 60.500 0.600 0.700 1.500 1.6001.7001.01.01.0$ cat test5_2.in | java Main50.500 1 arrives0.500 1 serves by 10.600 2 arrives0.600 2 waits at 10.700 3 arrives0.700 3 leaves1.500 1 done serving by 11.500 2 serves by 11.500 4 arrives1.500 4 waits at 11.600 5 arrives1.600 5 leaves1.700 6 arrives1.700 6 leaves2.500 2 done serving by 1
2.500 4 serves by 13.500 4 done serving by 1[0.633 3 3]
$ cat test5_3.in2 100.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.159630 0.313141 0.103753 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.2968470.051732$ cat test5_3.in | java Main50.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by 11.904 3 done serving by 12.776 4 arrives2.776 4 serves by 12.791 4 done serving by 13.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by 23.922 6 done serving by 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by 29.105 9 arrives9.105 9 waits at 19.160 10 arrives9.160 10 waits at 210.484 7 done serving by 110.484 9 serves by 110.781 9 done serving by 111.636 8 done serving by 211.636 10 serves by 211.688 10 done serving by 2[0.386 10 0]
$ cat test5_4.in2 100.000000 0.313141 0.416894 1.116416 1.130640 1.284813 1.297472 2.775189 5.368209 5.665056 0.313263 2.645188 2.701273 0.263761 1.481332 0.4150310.214836$ cat test5_4.in | java Main50.000 1 arrives0.000 1 serves by 10.313 2 arrives0.313 2 serves by 20.313 1 done serving by 10.417 3 arrives0.417 3 serves by 11.116 4 arrives1.116 4 waits at 11.131 5 arrives1.131 5 waits at 21.285 6 arrives1.285 6 leaves1.297 7 arrives
LEWstUU fo 1.297 7 leaves2.775 8 arrives2.775 8 leaves2.958 2 done serving by 22.958 5 serves by 23.118 3 done serving by 13.118 4 serves by 13.222 5 done serving by 24.599 4 done serving by 15.368 9 arrives5.368 9 serves by 15.665 10 arrives5.665 10 serves by 25.783 9 done serving by 15.880 10 done serving by 2[0.547 7 3]
evel 6ach server now has a queue of customers to allow multiple customers to queue up. A customer that chooses the first queue available and joins at the tail. hen a server is done serving a customer, it serves the next waiting customer at the head of the queue. Hence, the queue should be a first-in-first-out (FIFO)ructure.se the program Main6.java provided to test your program.ser input starts with three integer values representing the number of servers, followed by the maximum queue length, and the number of customers. This is llowed by the arrival times of the customers. Lastly, a number of service times (could be more than necessary) are provided.

$ cat test6_1.in2 1 100.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.159630 0.313141 0.103753 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.2968470.051732$ cat test6_1.in | java Main60.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by 11.904 3 done serving by 12.776 4 arrives2.776 4 serves by 12.791 4 done serving by 13.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by 23.922 6 done serving by 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by 29.105 9 arrives9.105 9 waits at 19.160 10 arrives9.160 10 waits at 210.484 7 done serving by 110.484 9 serves by 110.781 9 done serving by 111.636 8 done serving by 211.636 10 serves by 211.688 10 done serving by 2[0.386 10 0]
$ cat test6_2.in2 2 100.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.0063919.043361
9.105379 9.159630 0.313141 0.103753 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.2968470.051732$ cat test6_2.in | java Main60.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by 11.904 3 done serving by 12.776 4 arrives2.776 4 serves by 12.791 4 done serving by 13.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by 23.922 6 done serving by 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by 29.105 9 arrives9.105 9 waits at 19.160 10 arrives9.160 10 waits at 110.484 7 done serving by 110.484 9 serves by 110.781 9 done serving by 110.781 10 serves by 110.833 10 done serving by 111.636 8 done serving by 2[0.300 10 0]
$ cat test6_3.in2 2 100.000000 0.313141 0.416894 1.116416 1.130640 1.284813 1.297472 2.775189 5.368209 5.665056 0.313263 2.645188 2.701273 0.263761 1.481332 0.415031 0.214836 3.5126540.209277$ cat test6_3.in | java Main60.000 1 arrives0.000 1 serves by 10.313 2 arrives0.313 2 serves by 20.313 1 done serving by 10.417 3 arrives0.417 3 serves by 11.116 4 arrives1.116 4 waits at 11.131 5 arrives1.131 5 waits at 11.285 6 arrives1.285 6 waits at 21.297 7 arrives1.297 7 waits at 22.775 8 arrives2.775 8 leaves2.958 2 done serving by 22.958 6 serves by 23.118 3 done serving by 13.118 4 serves by 13.222 6 done serving by 23.222 7 serves by 23.637 7 done serving by 24.599 4 done serving by 14.599 5 serves by 14.814 5 done serving by 1
LT athJsiaUsT c 5.368 9 arrives5.368 9 serves by 15.665 10 arrives5.665 10 serves by 25.874 10 done serving by 28.881 9 done serving by 1[1.008 9 1]
evel 7he servers are now allowed to take occasional breaks. When a server finishes serving a customer, there is a chance that the server takes a rest for a certainmount of time. During the break, the server does not serve the next waiting customer. Upon returning from the break, the server serves the next customer ine queue (if any) immediately.ust like customer service time, we cannot pre-determine what rest time is accorded to which server at the beginning; it can only be decided during the mulation. That is to say, whenever a server rests, it will then know how much time it has to rest. The service time is supplied by a random number generators shown in the program Main7.java provided.ser input starts with values representing the number of servers, followed by the maximum queue length, the number of customers and the probability of aerver resting. This is followed by the arrival times of the customers. Lastly, a number of service times (could be more than necessary) are provided.wo sample runs are shown below: the first with no rest, and the second with probability of rest set to 0.5. In this latter case, after server 1 is done serving ustomer 2 at 0.417, he/she takes a rest. In the meantime, customers 3 and 4 are served by server 2. Server 1 resumes serving customer 5 after resting.

$ cat 7_1.in2 2 10 00.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.159630 0.313141 0.103753 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.2968470.051732$ cat 7_1.in | java Main70.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by 11.904 3 done serving by 12.776 4 arrives2.776 4 serves by 12.791 4 done serving by 13.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by 23.922 6 done serving by 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by 29.105 9 arrives9.105 9 waits at 19.160 10 arrives9.160 10 waits at 110.484 7 done serving by 110.484 9 serves by 110.781 9 done serving by 110.781 10 serves by 110.833 10 done serving by 111.636 8 done serving by 2[0.300 10 0]
$ cat 7_2.in2 2 10 0.50.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.159630 0.3131410.103753
LT oTUU th pr 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.2968470.051732$ cat 7_2.in | java Main70.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by 21.904 3 done serving by 22.776 4 arrives2.776 4 serves by 22.791 4 done serving by 23.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by 23.922 6 done serving by 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by 29.105 9 arrives9.105 9 waits at 19.160 10 arrives9.160 10 waits at 110.484 7 done serving by 110.484 9 serves by 110.781 9 done serving by 111.636 8 done serving by 214.644 10 serves by 114.696 10 done serving by 1[0.686 10 0] nd
evel 8here are now Nself self-checkout counters set up. In particular, if there are k human servers, then the self-checkout counters are identified from k + 1nwards.ake note of the following:All self-checkout counters share the same queue.Unlike human servers, self-checkout counters do not rest.When we print out the wait event, we always say that the customer is waiting for the self-checkout counter k + 1, even though this customer may eventually be served by another self-checkout counter.se the program Main8.java provided to test your program.ser input starts with values representing the number of servers, the number of self-check counters, the maximum queue length, the number of customers a e probability of a server resting. This is followed by the arrival times of the customers. Lastly, a number of service times (could be more than necessary) are ovided.
$ cat 8_1.in2 0 2 20 0.50.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.1596309.22461410.147994 11.204933 12.428914 13.109178 15.263626 15.524296 15.939974 17.79309618.7654230.313141 0.103753 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.296847 0.051732 3.4895950.368667
0.160532 2.869150 0.895790 1.043020 0.006333 0.5763510.742370$ cat 8_1.in | java Main80.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by 21.904 3 done serving by 22.776 4 arrives2.776 4 serves by 22.791 4 done serving by 23.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by 23.922 6 done serving by 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by 29.105 9 arrives9.105 9 waits at 19.160 10 arrives9.160 10 waits at 19.225 11 arrives9.225 11 waits at 210.148 12 arrives10.148 12 waits at 210.484 7 done serving by 110.484 9 serves by 110.781 9 done serving by 111.205 13 arrives11.205 13 waits at 111.636 8 done serving by 211.636 11 serves by 211.688 11 done serving by 211.688 12 serves by 212.429 14 arrives12.429 14 waits at 213.109 15 arrives13.109 15 waits at 214.644 10 serves by 115.013 10 done serving by 115.178 12 done serving by 215.178 14 serves by 215.264 16 arrives15.264 16 waits at 115.338 14 done serving by 215.338 15 serves by 215.524 17 arrives15.524 17 waits at 215.940 18 arrives15.940 18 waits at 217.793 19 arrives17.793 19 leaves18.207 15 done serving by 218.207 17 serves by 218.765 20 arrives18.765 20 waits at 219.103 17 done serving by 219.103 18 serves by 220.146 18 done serving by 240.474 13 serves by 140.480 13 done serving by 140.480 16 serves by 141.056 16 done serving by 157.110 20 serves by 257.852 20 done serving by 2[6.025 19 1]
$ cat 8_2.in2 1 2 20 0.50.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.1596309.22461410.14799411.204933
12.428914 13.109178 15.263626 15.524296 15.939974 17.79309618.7654230.313141 0.103753 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.296847 0.051732 3.489595 0.368667 0.160532 2.869150 0.895790 1.043020 0.006333 0.576351 0.7423703.007573$ cat 8_2.in | java Main80.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by 21.904 3 done serving by 22.776 4 arrives2.776 4 serves by 22.791 4 done serving by 23.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by 23.922 6 done serving by 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by 29.105 9 arrives9.105 9 serves by self-check 39.160 10 arrives9.160 10 waits at 19.225 11 arrives9.225 11 waits at 19.402 9 done serving by self-check 310.148 12 arrives10.148 12 serves by self-check 310.200 12 done serving by self-check 310.484 7 done serving by 110.484 10 serves by 111.205 13 arrives11.205 13 serves by self-check 311.574 13 done serving by self-check 311.636 8 done serving by 212.429 14 arrives12.429 14 serves by self-check 312.589 14 done serving by self-check 313.109 15 arrives13.109 15 serves by self-check 313.974 10 done serving by 113.974 11 serves by 114.869 11 done serving by 115.264 16 arrives15.264 16 serves by 115.524 17 arrives15.524 17 serves by 215.531 17 done serving by 215.940 18 arrives15.940 18 waits at 115.978 15 done serving by self-check 316.307 16 done serving by 116.307 18 serves by 116.883 18 done serving by 117.793 19 arrives17.793 19 serves by 118.535 19 done serving by 118.765 20 arrives18.765 20 serves by 121.773 20 done serving by 1[0.322 20 0]
$ cat 8_3.in1 2 2 20 0.5
0.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.1596309.22461410.147994 11.204933 12.428914 13.109178 15.263626 15.524296 15.939974 17.79309618.7654230.313141 0.103753 0.699522 0.014224 0.154173 0.012659 1.477717 2.593020 0.296847 0.051732 3.489595 0.368667 0.160532 2.869150 0.895790 1.043020 0.006333 0.576351 0.7423703.007573$ cat 8_3.in | java Main80.000 1 arrives0.000 1 serves by 10.313 1 done serving by 10.314 2 arrives0.314 2 serves by 10.417 2 done serving by 11.205 3 arrives1.205 3 serves by self-check 21.904 3 done serving by self-check 22.776 4 arrives2.776 4 serves by self-check 22.791 4 done serving by self-check 23.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by self-check 23.922 6 done serving by self-check 24.031 5 done serving by 19.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by self-check 29.105 9 arrives9.105 9 serves by self-check 39.160 10 arrives9.160 10 waits at 19.225 11 arrives9.225 11 waits at 19.402 9 done serving by self-check 310.148 12 arrives10.148 12 serves by self-check 310.200 12 done serving by self-check 310.484 7 done serving by 110.484 10 serves by 111.205 13 arrives11.205 13 serves by self-check 311.574 13 done serving by self-check 311.636 8 done serving by self-check 212.429 14 arrives12.429 14 serves by self-check 212.589 14 done serving by self-check 213.109 15 arrives13.109 15 serves by self-check 213.974 10 done serving by 114.823 11 serves by 115.264 16 arrives15.264 16 serves by self-check 315.524 17 arrives15.524 17 waits at 115.718 11 done serving by 115.718 17 serves by 115.725 17 done serving by 115.940 18 arrives15.940 18 serves by 115.978 15 done serving by self-check 2
16.307 16 done serving by self-check 316.516 18 done serving by 117.793 19 arrives17.793 19 serves by self-check 218.535 19 done serving by self-check 218.765 20 arrives18.765 20 serves by self-check 221.773 20 done serving by self-check 2 [0.356 20 0]
$ cat 8_4.in1 2 2 20 0.50.000000 0.313508 1.204910 2.776499 3.876961 3.909737 9.006391 9.043361 9.105379 9.1596309.22461410.147994 11.204933 12.428914 13.109178 15.263626 15.524296 15.939974 17.79309618.7654233.131408 1.037533 6.995223 0.142237 1.5417260.12659014.77717225.9301992.9684700.51732134.8959503.6866751.60531628.6915008.957896 1.043020 0.006333 0.576351 0.7423703.007573$ cat 8_4.in | java Main80.000 1 arrives0.000 1 serves by 10.314 2 arrives0.314 2 serves by self-check 21.205 3 arrives1.205 3 serves by self-check 31.351 2 done serving by self-check 22.776 4 arrives2.776 4 serves by self-check 22.919 4 done serving by self-check 23.131 1 done serving by 13.877 5 arrives3.877 5 serves by 13.910 6 arrives3.910 6 serves by self-check 24.036 6 done serving by self-check 25.419 5 done serving by 18.200 3 done serving by self-check 39.006 7 arrives9.006 7 serves by 19.043 8 arrives9.043 8 serves by self-check 29.105 9 arrives9.105 9 serves by self-check 39.160 10 arrives9.160 10 waits at 19.225 11 arrives9.225 11 waits at 110.148 12 arrives10.148 12 waits at self-check 211.205 13 arrives11.205 13 waits at self-check 212.074 9 done serving by self-check 312.074 12 serves by self-check 312.429 14 arrives12.429 14 waits at self-check 212.591 12 done serving by self-check 312.591 13 serves by self-check 313.109 15 arrives13.109 15 waits at self-check 215.264 16 arrives15.264 16 leaves
15.524 17 arrives15.524 17 leaves15.940 18 arrives15.940 18 leaves17.793 19 arrives17.793 19 leaves18.765 20 arrives18.765 20 leaves23.784 7 done serving by 124.631 10 serves by 128.318 10 done serving by 128.318 11 serves by 129.923 11 done serving by 134.974 8 done serving by self-check 234.974 14 serves by self-check 247.487 13 done serving by self-check 347.487 15 serves by self-check 356.445 15 done serving by self-check 363.665 14 done serving by self-check 2 [6.320 15 5]
Remaining level(s) for correctness/style checking

Submission (Course)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS2030 Project: Discrete Event Simulator[SOLVED] CS2030 Project: Discrete Event Simulator
$25