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

View File

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