···
def compute_area(file, time):
···
# objectives.append(int(match[1]))
-
match = re.match(r'objective\s=\s(\d+)', line)
objectives.append(int(match[1]))
-
match = re.match(r'%\stime elapsed:\s(\d+)\sms', line)
times.append(int(match[1]))
-
assert(len(objectives) > 0)
-
assert(len(objectives)+1 == len(times))
for i in range(len(objectives)):
-
area += ((times[i+1] - times[i])/1000)*objectives[i]
for root, dirs, files in os.walk(folder):
-
if name.endswith('.sol'):
match = re.search(r"\.(\d+)\.sol", name)
···
match = re.search(r"nodes:\s+(\d+)", line)
-
statistics['nodes'] = int(match.group(1))
match = re.search(r"search time:\s+(\d+\.\d+)\s*seconds", line)
-
statistics['search_time'] = int(float(match.group(1))*1000)
match = re.search(r"restart count:\s+(\d+)", line)
-
statistics['restarts'] = int(match.group(1))
for line in contents[::-1]:
-
match = re.match(r'objective\s=\s(\d+)', line)
-
statistics['objective'] = int(match[1])
-
area = compute_area(contents, statistics['search_time'])
-
stats[name[:-(4)].replace(".", ",")] = (area, statistics['objective'], statistics['search_time'], statistics['restarts'], statistics['nodes'])
sorted_stats = sorted(stats.items())
-
a = sorted_stats[0][0][:sorted_stats[0][0].find(",")]
for key, val in sorted_stats:
-
if key[:key.find(",")] != a:
-
a = key[:key.find(",")]
print("%s,%s" % (key, ",".join([v.__str__() for v in val])))
···
def compute_area(file, time):
···
# objectives.append(int(match[1]))
+
match = re.match(r"objective\s=\s(\d+)", line)
objectives.append(int(match[1]))
+
match = re.match(r"%\stime elapsed:\s(\d+)\sms", line)
times.append(int(match[1]))
+
assert len(objectives) > 0
+
assert len(objectives) + 1 == len(times)
for i in range(len(objectives)):
+
area += ((times[i + 1] - times[i]) / 1000) * objectives[i]
for root, dirs, files in os.walk(folder):
+
if name.endswith(".sol"):
match = re.search(r"\.(\d+)\.sol", name)
···
match = re.search(r"nodes:\s+(\d+)", line)
+
statistics["nodes"] = int(match.group(1))
match = re.search(r"search time:\s+(\d+\.\d+)\s*seconds", line)
+
statistics["search_time"] = int(float(match.group(1)) * 1000)
match = re.search(r"restart count:\s+(\d+)", line)
+
statistics["restarts"] = int(match.group(1))
for line in contents[::-1]:
+
match = re.match(r"objective\s=\s(\d+)", line)
+
statistics["objective"] = int(match[1])
+
area = compute_area(contents, statistics["search_time"])
+
stats[name[:-(4)].replace(".", ",")] = (
+
statistics["objective"],
+
statistics["search_time"],
+
statistics["restarts"],
sorted_stats = sorted(stats.items())
+
a = sorted_stats[0][0][: sorted_stats[0][0].find(",")]
for key, val in sorted_stats:
+
if key[: key.find(",")] != a:
+
a = key[: key.find(",")]
print("%s,%s" % (key, ",".join([v.__str__() for v in val])))