A set of benchmarks to compare a new prototype MiniZinc implementation
1import csv
2import os
3import sys
4from pathlib import Path
5
6assert len(sys.argv) >= 2
7benchmarks_location = sys.argv[1]
8
9writer = csv.writer(sys.stdout, dialect="unix")
10writer.writerow(("problem", "model", "data_file"))
11for root, _, files in os.walk(benchmarks_location):
12 for name in files:
13 if name.endswith(".mzn"):
14 problem = root.split(os.sep)[-1]
15 datafiles = 0
16 for nroot, _, nfiles in os.walk(root):
17 for nname in nfiles:
18 if nname.endswith(".dzn") or nname.endswith(".json"):
19 datafiles = datafiles + 1
20 writer.writerow(
21 (
22 problem,
23 Path(root + "/" + name),
24 Path(nroot + "/" + nname),
25 )
26 )
27
28 if datafiles == 0:
29 writer.writerow((problem, Path(root + "/" + name), ""))