Repository navigation
Expand file tree
/
Copy pathcompare_124_processing.py
More file actions
84 lines (67 loc) · 2.77 KB
/
Copy pathcompare_124_processing.py
File metadata and controls
84 lines (67 loc) · 2.77 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
""" with this file the mean waiting times of MM1/ MMc are plotted """
import matplotlib.pyplot as plt
import pandas as pd
import math
import numpy as np
from scipy import stats
# df_mut[df_mut['nameDest'] == 'C1848904242']
# example1 = data[data["SIM_TIME"] == 500]
simulations = 500
simtime = 500
s1 = []
s2 = []
s4 = []
s1_dev = []
s2_dev = []
s4_dev = []
rhos= [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.975]
for i in [1, 2, 4]:
data = pd.read_csv(f"data/tail_{i}.txt", sep="\t")
example = data[data["SIM_TIME"] == simtime]
for r in rhos:
if i == 1:
s1.append(example[example['RHO'] == r]['AVG_WAIT'].mean())
s1_dev.append(1.96 * example[example['RHO'] == r]['AVG_WAIT'].std() /
math.sqrt(simulations))
elif i == 2:
s2.append(example[example['RHO'] == r]['AVG_WAIT'].mean())
s2_dev.append(1.96 * example[example['RHO'] == r]['AVG_WAIT'].std() /
math.sqrt(simulations))
else:
s4.append(example[example['RHO'] == r]['AVG_WAIT'].mean())
s4_dev.append(1.96 * example[example['RHO'] == r]['AVG_WAIT'].std() /
math.sqrt(simulations))
fig, ax = plt.subplots()
ax.plot(rhos, s1, color="lightskyblue", label="1 Server")
ax.plot(rhos, s2, color="deeppink", label="2 Servers")
ax.plot(rhos, s4, color="darkgrey", label="4 Servers")
ax.fill_between(rhos, [a - b for a, b in zip(s1, s1_dev)], [a + b for a, b in zip(s1, s1_dev)], color='lightskyblue', alpha=.1)
ax.fill_between(rhos, [a - b for a, b in zip(s2, s2_dev)], [a + b for a, b in zip(s2, s2_dev)], color='deeppink', alpha=.1)
ax.fill_between(rhos, [a - b for a, b in zip(s4, s4_dev)], [a + b for a, b in zip(s4, s4_dev)], color='darkgrey', alpha=.1)
# plt.title(f"Mean waiting time (Simtime={simtime})", fontsize=16)
plt.legend()
plt.ylabel('Mean waiting time (time units)')
plt.xlabel('ρ')
plt.show()
plt.savefig("MDC_124.png", dpi=300)
print("DONE")
# print("\n START MEAN, STDEV, CONF INT")
# for i in [1,2,4]:
# print(f'Server(s): {i}')
# data = pd.read_csv(f"data/sim_tim_500_n{i}.txt", sep="\t")
# example = data[data["SIM_TIME"] == 150]
# example1 = data[data["SIM_TIME"] == 500]
# ex = example[example['RHO'] == 0.1]['AVG_WAIT']
# ex2 = example1[example1['RHO'] == 0.1]['AVG_WAIT']
# ex_9 = example[example['RHO'] == 0.9]['AVG_WAIT']
# ex2_9 = example1[example1['RHO'] == 0.9]['AVG_WAIT']
# print("\nMEAN 150, 500, rho 0.1, rho 0.9")
# print(ex.mean(), ex2.mean())
# print(ex_9.mean(), ex2_9.mean())
# print("\nSTDEV 150, 500, rho 0.1, rho 0.9")
# print(ex.std(), ex2.std())
# print(ex_9.std(), ex2_9.std())
# # print(stats.chisquare(f_obs=ex, f_exp=ex2))
# # print(ex)
# # plt.hist(ex2, bins = 50)
# # plt.show()