-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanalysisOnLine.py
executable file
·102 lines (58 loc) · 2.83 KB
/
analysisOnLine.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
def parser(myString):
myString= myString.split(".")
myString = myString[0].split("_")
d ={}
d["Provider"] = myString[0]
d["Policy"] = myString[1]
d["Algorithm"] = myString[2]
d["Zones"] = myString[3]
d["Acs"] = myString[4]
d["TankThreshold"] = myString[5]
return d
path = "/Users/mc/"
fileName = "test.txt"
fileName2 = "test2.txt"
file = open(path+fileName,'r')
file2 = open(path+fileName2, 'w')
for line in file:
if "1;2;3;4;5;6;7;8" in line:
continue
else :
lineout = line.split()[8]
file2.write(lineout+"\n")
file2.close()
dfInput = pd.read_csv(path+fileName2, header=None)
test = "car2go_FreeFloating_max-parking_10_2_-1_1000000.txt"
df=pd.DataFrame(columns = ['Provider', 'Policy', 'Algorithm', 'Zones', 'Acs', 'TankThreshold'])
for i in range(len(dfInput)):
d = parser(dfInput.iloc[i][0])
tmp = pd.Series(d)
df = df.append(tmp, ignore_index=True)
BestEffort_list = ['FreeFloating', 'HybridForced', 'HybridNeeded', 'StationBased']
AvaiableChargingStations_list = ['2', '3', '4', '5', '6', '7', '8']
algorithm_list = ["rnd", "max-parking", "max-time"]
numberOfStations_list = [i for i in range(2,42,2)]
tankThresholds_list = [-1,5,10,25,50,100]
#missing = open(path+"missing.txt", "w")
#missing.write('Policy,Algorithm,Zones,Acs,TankThreshold\n')
#for BestEffort in BestEffort_list:
# for AvaiableChargingStations in AvaiableChargingStations_list:
# for algorithm in algorithm_list:
# for numberOfStations in numberOfStations_list:
# for tankThreshold in tankThresholds_list:
# tmp = df[df["Policy"] == BestEffort]
# tmp = tmp[tmp["Acs"] == AvaiableChargingStations]
# tmp = tmp[tmp["Algorithm"] == algorithm]
# tmp = tmp[tmp["TankThreshold"] == tankThreshold]
#
# if len(tmp) == 0:
# s = "%s,%s,%s,%s,%s\n" % (BestEffort, algorithm,numberOfStations,AvaiableChargingStations,tankThreshold)
# missing.write(s)
#
#missing.close()
"StationBased,max-time,34,8,10"
tmp = df[df["Policy"] == "StationBased"]
tmp = tmp[tmp["Algorithm"] == "max-time"]