-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcsvOutputUtils.py
More file actions
72 lines (60 loc) · 2.51 KB
/
csvOutputUtils.py
File metadata and controls
72 lines (60 loc) · 2.51 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
import os
import csv
class CSVDomainOutput():
def __init__(self, outputDir) -> None:
self.outputDir = outputDir
self.rows = []
self.header = ["Domain Name", "Potential Goal", "Initial", "isRealGoal", "Time to Extract Landmarks", "Extracted Landmarks"]
def addNewRow(self):
row = CSVDomainRow()
self.rows.append(row)
return row
def writeToCSV(self, filename):
f = open(os.path.join(os.path.dirname(__file__),
self.outputDir) + f"/{filename}.csv", "a")
writer = csv.writer(f)
writer.writerow(self.header)
for row in self.rows:
writer.writerow(row.dataToWrite())
f.close()
class CSVDomainRow():
def __init__(self) -> None:
self.domainName = "not provided"
self.goalState = "not provided"
self.initialState = "not provided"
self.isRealGoal = False
self.extractionTime = -1
self.landmarks = "not provided"
def dataToWrite(self):
return [self.domainName, self.goalState, self.initialState, self.isRealGoal, self.extractionTime, self.landmarks]
class CSVApproachOutput():
def __init__(self, outputDir) -> None:
self.outputDir = outputDir
self.rows = []
self.header = ["Approach", "Initial", "Goal", "Time to Order Landmarks", "Time to Generate Plan", "Path Length", "Path", "Deceptive Cost", "Deceptive Quality", "Deception Score"]
def addNewRow(self):
row = CSVApproachRow()
self.rows.append(row)
return row
def writeToCSV(self, filename):
f = open(os.path.join(os.path.dirname(__file__),
self.outputDir) + f"/{filename}.csv", "a")
writer = csv.writer(f)
writer.writerow(self.header)
for row in self.rows:
writer.writerow(row.dataToWrite())
f.close()
class CSVApproachRow():
def __init__(self) -> None:
self.approachName = "not provided"
self.initialState = "not provided"
self.goalState = "not provided"
self.orderingTime = -1
self.planTime = -1
self.pathLength = -1
self.path = "not provided"
self.deceptiveCost = 0
self.deceptiveQuality = 0
self.deception = 0
def dataToWrite(self):
return [self.approachName, self.initialState, self.goalState, self.orderingTime, self.planTime, self.pathLength, self.path, self.deceptiveCost, self.deceptiveQuality, self.deception]