-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDescription
62 lines (48 loc) · 2.98 KB
/
Description
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Discrete Event Simulation
Assume that we want to simulate a hypothetical factory that processes some jobs. The factory is
composed of units, where each unit has a job queue and a worker. The worker is the main part which
processes a job, and the job queue is the place where the next jobs are waiting to be processed. Once
a unit processes a job, it pushes the job to one of the next possible units according to the factory
layout. Each job may follow a different path in the factory and once a job is processed in an output
unit, it’s gone out of the system.
Factory Layout
In each factory, Unit 0 is the single unit that act as the input unit. It accepts jobs and starts
their processing. The units with incoming and outgoing connections are the intermediate units. There
may be many output units, which does not have an outgoing connection to another unit.The layout of each
factory is going to be represented with graph structure.
1)How factory works?
The factory start working by waiting for the jobs which arrive sequentially but not at the same time.
The units may be either idle, waiting for jobs, or busy processing them. We assume that each unit
has a constant processing time for each job. After the processing is complete, the job is passed to
one of the next units in the factory by two different ways.
1. Randomly: Next unit is selected uniformly randomly. That’s if a unit has n outgoing connections,
the job will be assigned each of the next units with probability 1/n.
2. Unit with shortest queue first: The unit with the shortest queue length will be get the job. If
the queue lengths are equal, assign the job to the unit that’s first mentioned in the adjacency
list.
What to report?
1. Total running time of the factory.
2. Utilization of each unit
3. Turnaround time of each order
4. Maximum length of each queue
Unit Utilization = Busy time of the unit
Total running time of the factory
Turnaround Time = Finish time of the job − Arrival time of the job
2)Input and Output Details
The program will be executed exactly with the following command:
./dse [input_file] [output_file_1] [output_file_2]
where input file contains the factory layout and job arrival times, and output file 1 contains the
output of the factory with random unit choice, and output file 2 contains the output of the factory
with shortest queue unit choice.
The input file format:
1. First line is the number of units in the system, let’s say N.
2. The next N lines are the factory layout represented as an adjacency list. Each line has the
following format:
UnitNumber ProcessingTime [List of preceeding units] ...
3. The next line is the number of jobs, let’s say J.
4. The next J lines are the arrival times of jobs. They are positive values in double precision.
The output file format:
1. First line is the total running time of the factory.
2. The next N lines are the utilization of units and max queue lengths.
3. The next J lines are the turnaround time of jobs.
You can see sample input/output files among the test cases.