-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstatistic.py
103 lines (86 loc) · 2.75 KB
/
statistic.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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import numpy as np
from matplotlib import pyplot as plt
# import matplotlib.pyplot as plt
import pandas as pd
BFS = pd.read_csv("BFS.csv",na_values=["???","??? "])
Astar =pd.read_csv("A_star.csv",na_values=["???","??? "])
def drawChart(factor,map):
stepBFS = []
stepAstar = []
if (map == "MINI COSMOS"):
stepBFS = BFS[factor][1:41]
stepAstar = BFS[factor][1:41]
else:
stepBFS = BFS[factor][40:len(BFS)]
stepAstar = BFS[factor][40:len(BFS)]
#stepBFS_Mini = BFS[factor][1:40]
#stepAStar_Mini = Astar[factor][1:40]
#stepBFS_Micro = BFS[factor][40:len(BFS)]
#stepAstar_Micro = Astar[factor][40:len(BFS)]
barWidth = 0.25
fig = plt.subplots(figsize =(12, 8))
index = []
for i in range(0,len(stepBFS)):
index.append(i+1)
# set height of bar
#IT = [12, 30, 1, 8, 22]
#ECE = [28, 6, 16, 5, 10]
#CSE = [29, 3, 24, 25, 17]
# Set position of bar on X axis
br1 = np.arange(len(stepBFS))
br2 = [x + barWidth for x in br1]
#br3 = [x + barWidth for x in br2]
# Make the plot
plt.bar(br1, stepBFS, color ='r', width = barWidth,
edgecolor ='grey', label ='BFS')
plt.bar(br2, stepAstar, color ='g', width = barWidth,
edgecolor ='grey', label ='A_star')
#plt.bar(br3, CSE, color ='b', width = barWidth,
# edgecolor ='grey', label ='CSE')
# Adding Xticks
ylab = ""
if (factor == "Step"):
ylab = "Step"
elif (factor == "Time (s)"):
ylab = "sec"
elif (factor == "Node generated"):
ylab = "Node"
else:
ylab = "MB"
plt.xlabel('TC', fontweight ='bold', fontsize = 15)
plt.ylabel(ylab, fontweight ='bold', fontsize = 15)
#plt.xticks([(r + barWidth) for r in range(len(IT))],
# ['2015', '2016', '2017', '2018', '2019'])
plt.xticks([barWidth/2 + r for r in range(len(stepBFS))],index)
if (factor == "Memory (MB)"):
plt.title("The amount of memory used in " + map + " Testcases")
elif (factor == "Time (s)"):
plt.title("The amount of time elapsed in " + map + " Testcases")
elif (factor == "Node generated"):
plt.title("The amount of node generated in " + map + " Testcases")
else:
plt.title("The number of " + factor + " taken in " + map + " Testcases")
plt.legend()
save = ""
if (factor == "Memory (MB)"):
save = "memory"
elif (factor == "Step"):
save = "step"
elif (factor == "Node generated"):
save = "nodeGenerated"
else:
save = "time"
plt.savefig("./Charts/" + save + "_" + map + ".png")
drawChart("Step","MINI COSMOS")
drawChart("Step","MICRO COSMOS")
drawChart("Time (s)", "MINI COSMOS")
drawChart("Time (s)", "MICRO COSMOS")
drawChart("Memory (MB)","MINI COSMOS")
drawChart("Memory (MB)","MICRO COSMOS")
drawChart("Node generated","MINI COSMOS")
drawChart("Node generated","MICRO COSMOS")
print(len(BFS))
print(BFS["Map"][len(BFS)-1])
#print(BFS)
#print(BFS["Step"].count())
#print(BFS["Status"].count("Completed"))