1
0

Adjust analysis scripts for Python and solver versions

This commit is contained in:
Jip J. Dekker 2021-06-17 17:23:34 +10:00
parent 494892dbc3
commit 89528a184e
No known key found for this signature in database
GPG Key ID: 517DF4A00618C9C3
2 changed files with 17 additions and 16 deletions

View File

@ -24,15 +24,15 @@ def compute_area(file, time):
for line in contents:
# match = re.match(r'%\sinit_area\s=\s(\d+)', line)
# if match:
# objectives.append(int(match[1]))
# objectives.append(int(match.group(1)))
# continue
match = re.match(r"objective\s=\s(\d+)", line)
if match:
objectives.append(int(match[1]))
objectives.append(int(match.group(1)))
continue
match = re.match(r"%\stime elapsed:\s(\d+)\sms", line)
if match:
times.append(int(match[1]))
times.append(int(match.group(1)))
continue
times.append(time)
@ -57,14 +57,15 @@ for root, dirs, files in os.walk(folder):
contents = f.readlines()
statistics = {}
print(contents)
for line in contents:
# Nodes
match = re.search(r"nodes:\s+(\d+)", line)
match = re.search(r"nodes=(\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)
match = re.search(r"solveTime=(\d+\.\d+)", line)
if match:
statistics["search_time"] = int(float(match.group(1)) * 1000)
continue
@ -78,7 +79,7 @@ for root, dirs, files in os.walk(folder):
# Best objective
match = re.match(r"objective\s=\s(\d+)", line)
if match:
statistics["objective"] = int(match[1])
statistics["objective"] = int(match.group(1))
break
# Area
area = compute_area(contents, statistics["search_time"])

View File

@ -28,15 +28,15 @@ def compute_area(file):
# continue
match = re.match(r"objective\s=\s(\d+)", line)
if match:
objectives.append(int(match[1]))
objectives.append(int(match.group(1)))
continue
match = re.match(r"%\stime elapsed:\s(\d+)\sms", line)
match = re.match(r"%\stime elapsed:\s(\d\.\d+)\ss", line)
if match:
times.append(int(match[1]))
times.append(float(match.group(1)))
continue
match = re.search(r"solvetime:.*\((\d+).(\d+)\s+ms\)", line)
match = re.search(r"solveTime=(\d+(.\d+)?)", line)
if match:
times.append(int(match.group(1)))
times.append(float(match.group(1)))
continue
assert len(objectives) > 0
@ -47,7 +47,7 @@ def compute_area(file):
return int(area)
foler = sys.argv[1]
folder = sys.argv[1]
statistics = {}
for root, dirs, files in os.walk(folder):
for name in files:
@ -66,7 +66,7 @@ for root, dirs, files in os.walk(folder):
# Best objective
match = re.match(r"objective\s=\s(\d+)", line)
if match:
objective = int(match[1])
objective = int(match.group(1))
break
nodes = -1
@ -79,12 +79,12 @@ for root, dirs, files in os.walk(folder):
nodes = int(match.group(1))
continue
# Solve time
match = re.search(r"solvetime:.*\((\d+).(\d+)\s+ms\)", line)
match = re.search(r"solveTime=(\d+(.\d+)?)", line)
if match:
solvetime = int(match.group(1))
solvetime = float(match.group(1))
continue
# Restarts
match = re.search(r"restarts:\s+(\d+)", line)
match = re.search(r"restarts=(\d+)", line)
if match:
restarts = int(match.group(1))
continue