this repo has no description

Format python files

+24 -16
analyse_chuffed.py
···
import re
import sys
def compute_area(file, time):
area = -1
···
# if match:
# objectives.append(int(match[1]))
# continue
-
match = re.match(r'objective\s=\s(\d+)', line)
if match:
objectives.append(int(match[1]))
continue
-
match = re.match(r'%\stime elapsed:\s(\d+)\sms', line)
if match:
times.append(int(match[1]))
continue
times.append(time)
-
assert(len(objectives) > 0)
-
assert(len(objectives)+1 == len(times))
area = 0
for i in range(len(objectives)):
-
area += ((times[i+1] - times[i])/1000)*objectives[i]
return int(area)
folder = sys.argv[1]
stats = {}
for root, dirs, files in os.walk(folder):
for name in files:
-
if name.endswith('.sol'):
seed = 1
match = re.search(r"\.(\d+)\.sol", name)
if match:
···
# Nodes
match = re.search(r"nodes:\s+(\d+)", line)
if match:
-
statistics['nodes'] = int(match.group(1))
continue
# Solve time
match = re.search(r"search time:\s+(\d+\.\d+)\s*seconds", line)
if match:
-
statistics['search_time'] = int(float(match.group(1))*1000)
continue
# Restarts
match = re.search(r"restart count:\s+(\d+)", line)
if match:
-
statistics['restarts'] = int(match.group(1))
continue
for line in contents[::-1]:
# Best objective
-
match = re.match(r'objective\s=\s(\d+)', line)
if match:
-
statistics['objective'] = int(match[1])
break
# Area
-
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:
print("\n\n")
-
a = key[:key.find(",")]
print("%s,%s" % (key, ",".join([v.__str__() for v in val])))
exit(1)
···
import re
import sys
+
def compute_area(file, time):
area = -1
···
# if match:
# objectives.append(int(match[1]))
# continue
+
match = re.match(r"objective\s=\s(\d+)", line)
if match:
objectives.append(int(match[1]))
continue
+
match = re.match(r"%\stime elapsed:\s(\d+)\sms", line)
if match:
times.append(int(match[1]))
continue
times.append(time)
+
assert len(objectives) > 0
+
assert len(objectives) + 1 == len(times)
area = 0
for i in range(len(objectives)):
+
area += ((times[i + 1] - times[i]) / 1000) * objectives[i]
return int(area)
+
folder = sys.argv[1]
stats = {}
for root, dirs, files in os.walk(folder):
for name in files:
+
if name.endswith(".sol"):
seed = 1
match = re.search(r"\.(\d+)\.sol", name)
if match:
···
# Nodes
match = re.search(r"nodes:\s+(\d+)", line)
if match:
+
statistics["nodes"] = int(match.group(1))
continue
# Solve time
match = re.search(r"search time:\s+(\d+\.\d+)\s*seconds", line)
if match:
+
statistics["search_time"] = int(float(match.group(1)) * 1000)
continue
# Restarts
match = re.search(r"restart count:\s+(\d+)", line)
if match:
+
statistics["restarts"] = int(match.group(1))
continue
for line in contents[::-1]:
# Best objective
+
match = re.match(r"objective\s=\s(\d+)", line)
if match:
+
statistics["objective"] = int(match[1])
break
# Area
+
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:
print("\n\n")
+
a = key[: key.find(",")]
print("%s,%s" % (key, ",".join([v.__str__() for v in val])))
exit(1)
+21 -13
analyse_gecode.py
···
import re
import sys
def compute_area(file):
area = -1
···
# if match:
# objectives.append(int(match[1]))
# continue
-
match = re.match(r'objective\s=\s(\d+)', line)
if match:
objectives.append(int(match[1]))
continue
-
match = re.match(r'%\stime elapsed:\s(\d+)\sms', line)
if match:
times.append(int(match[1]))
continue
···
times.append(int(match.group(1)))
continue
-
assert(len(objectives) > 0)
-
assert(len(objectives)+1 == len(times))
area = 0
for i in range(len(objectives)):
-
area += ((times[i+1] - times[i])/1000)*objectives[i]
return int(area)
-
folder = sys.argv[1]
statistics = {}
for root, dirs, files in os.walk(folder):
for name in files:
-
if name.endswith('.sol'):
seed = 1
match = re.search(r"\.(\d+)\.sol", name)
if match:
···
# Area
area = compute_area(contents)
-
objective = 'UNSAT'
for line in contents[::-1]:
# Best objective
-
match = re.match(r'objective\s=\s(\d+)', line)
if match:
objective = int(match[1])
break
···
if match:
restarts = int(match.group(1))
continue
-
statistics[name[:-(4)].replace(".", ",")] = (area, objective, solvetime, restarts, nodes)
sorted_stats = sorted(statistics.items())
-
a = sorted_stats[0][0][:sorted_stats[0][0].find(",")]
for key, val in sorted_stats:
-
if key[:key.find(",")] != a:
print("\n\n")
-
a = key[:key.find(",")]
print("%s,%s" % (key, ",".join([v.__str__() for v in val])))
exit(1)
···
import re
import sys
+
def compute_area(file):
area = -1
···
# if match:
# objectives.append(int(match[1]))
# continue
+
match = re.match(r"objective\s=\s(\d+)", line)
if match:
objectives.append(int(match[1]))
continue
+
match = re.match(r"%\stime elapsed:\s(\d+)\sms", line)
if match:
times.append(int(match[1]))
continue
···
times.append(int(match.group(1)))
continue
+
assert len(objectives) > 0
+
assert len(objectives) + 1 == len(times)
area = 0
for i in range(len(objectives)):
+
area += ((times[i + 1] - times[i]) / 1000) * objectives[i]
return int(area)
+
+
foler = sys.argv[1]
statistics = {}
for root, dirs, files in os.walk(folder):
for name in files:
+
if name.endswith(".sol"):
seed = 1
match = re.search(r"\.(\d+)\.sol", name)
if match:
···
# Area
area = compute_area(contents)
+
objective = "UNSAT"
for line in contents[::-1]:
# Best objective
+
match = re.match(r"objective\s=\s(\d+)", line)
if match:
objective = int(match[1])
break
···
if match:
restarts = int(match.group(1))
continue
+
statistics[name[:-(4)].replace(".", ",")] = (
+
area,
+
objective,
+
solvetime,
+
restarts,
+
nodes,
+
)
sorted_stats = sorted(statistics.items())
+
a = sorted_stats[0][0][: sorted_stats[0][0].find(",")]
for key, val in sorted_stats:
+
if key[: key.find(",")] != a:
print("\n\n")
+
a = key[: key.find(",")]
print("%s,%s" % (key, ",".join([v.__str__() for v in val])))
exit(1)