-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
55 lines (40 loc) · 1.3 KB
/
main.py
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
import simpy
from policies import *
from Customer import *
from Queue import *
from System import *
from SystemStats import *
from tqdm import tqdm
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--numServers', type=int , default=5)
parser.add_argument('--arrivalTime',type = int , choices = range(2,15) , default = 5)
parser.add_argument('--iteration',type = int , choices = range(100,10000) , default = 200)
parser.add_argument('--policy',type = str , choices = ["FIFO","Priority"] , default = "FIFO")
args = parser.parse_args()
iteration = args.iteration
numServers = args.numServers
arrivalTime = args.arrivalTime
policy = args.policy
print("num of Servers in the system =",numServers)
print("customer mean arrival =",arrivalTime)
dic = {"numSatisfied" : [],
"totalTimeInSys" : [],
"numCustomer" : [],
"maxTimeInSys" : [],
"avgQueueLen": [],
"maxQueueLen" :[],
"meanBusyTime" :[],
"maxBusyServer" : []}
# number of repetition the more the better
n=iteration
for i in tqdm(range(n)):
env = simpy.Environment()
system = System(env,numServers,arrivalTime,policy)
env.process(system.Simulation())
env.run(until=4800)
saveSystemStat(dic,system)
showSystemStats(dic)
if __name__=="__main__":
main()