-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoader.py
More file actions
18 lines (15 loc) · 719 Bytes
/
Loader.py
File metadata and controls
18 lines (15 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Loader:
def loadFile(file):
dataFile = open('TSP/' + file + '.tsp', 'r')
name = dataFile.readline().strip().split()[1] # NAME
fileType = dataFile.readline().strip().split()[1] # TYPE
comment = dataFile.readline().strip().split()[1] # COMMENT
dimension = dataFile.readline().strip().split()[1] # DIMENSION
edgeWeightType = dataFile.readline().strip().split()[1] # EDGE_WEIGHT_TYPE
dataFile.readline()
citiesList = []
for i in range(0, int(dimension)):
x, y = dataFile.readline().strip().split()[1:]
citiesList.append([float(x), float(y)])
dataFile.close()
return citiesList, edgeWeightType